Merge "mm: vmscan: fix do_try_to_free_pages() livelock"
diff --git a/Documentation/devicetree/bindings/input/touchscreen/gt9xx/gt9xx.txt b/Documentation/devicetree/bindings/input/touchscreen/gt9xx/gt9xx.txt
index fdba7c2..f2ca95b 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/gt9xx/gt9xx.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/gt9xx/gt9xx.txt
@@ -30,6 +30,7 @@
 				min y, max x and max y values.
  - goodix,i2c-pull-up	: To specify pull up is required.
  - goodix,no-force-update	: To specify force update is allowed.
+ - goodix,enable-power-off	: Power off touchscreen during suspend.
  - goodix,button-map	: Button map of key codes. The number of key codes
 				depend on panel.
  - goodix,cfg-data0	: Touch screen controller config data group 0. Ask vendor
@@ -50,6 +51,7 @@
 				to provide that.
  - goodix,cfg-data5	: Touch screen controller config data group 5. Ask vendor
 				to provide that.
+ - goodix,fw-name	: Touch screen controller firmware file name.
 Example:
 i2c@f9927000 {
 		goodix@5d {
@@ -84,5 +86,6 @@
 				20 21 22 24 26 28 29 2A FF FF
 				FF FF FF FF FF FF FF 22 22 22
 				22 22 22 FF 07 01];
+			goodix,fw_name = "gtp_fw.bin";
 		};
 };
diff --git a/Documentation/devicetree/bindings/leds/leds-qpnp.txt b/Documentation/devicetree/bindings/leds/leds-qpnp.txt
index af6a0b5..749c594 100644
--- a/Documentation/devicetree/bindings/leds/leds-qpnp.txt
+++ b/Documentation/devicetree/bindings/leds/leds-qpnp.txt
@@ -10,13 +10,13 @@
 node will further contain the type of LED supported and its
 properties.  At least one child node is required for each LED
 module.  Each must have the required properties below, in addition
-to the properties for the LED type, WLED, Flash or RGB.
+to the properties for the LED type, WLED, Flash, RGB and MPP.
 
 Required properties for each child node, WLED, Flash and RGB:
 - compatible		: should be "qcom,leds-qpnp"
 - qcom,id		: must be one of values supported in enum qpnp_led
 - label			: type of led that will be used, ie "wled"
-- qcom,max-current	: maximum current that the LED can sustain
+- qcom,max-current	: maximum current that the LED can sustain in mA
 - linux,name		: name of the led that is used in led framework
 
 WLED is primarily used as display backlight. Display subsystem uses
@@ -85,6 +85,7 @@
 - qcom,vin-ctrl: select input source, supported values are 0 to 3
 - qcom,use-blink: Use blink sysfs entry for switching into lpg mode.  For optimal use, set default mode to pwm.  All required lpg parameters must be supplied.
 - qcom,min-brightness - Lowest possible brightness supported on this LED other than 0.
+- qcom,current-setting: default current value for wled used as button backlight in mA
 
 Required properties for PWM mode only:
 - qcom,pwm-channel: pwm channel the led will operate on
@@ -131,6 +132,22 @@
 
 Example:
 
+	qcom,leds@a100 {
+		status = "okay";
+		qcom,led_mpp_2 {
+			label = "mpp";
+			linux,name = "button-backlight";
+			linux,default-trigger = "hr-trigger";
+			qcom,default-state = "off";
+			qcom,current-setting = <20>;
+			qcom,max-current = <40>;
+			qcom,id = <6>;
+			qcom,source-sel = <1>;
+			qcom,mode-ctrl = <0x61>;
+			qcom,mode = "manual";
+		};
+	};
+
 	qcom,leds@a200 {
 		status = "okay";
 		qcom,led_mpp_3 {
diff --git a/Documentation/devicetree/bindings/nfc/nfc-nci.txt b/Documentation/devicetree/bindings/nfc/nfc-nci.txt
index cdd1e68..5c53470 100644
--- a/Documentation/devicetree/bindings/nfc/nfc-nci.txt
+++ b/Documentation/devicetree/bindings/nfc/nfc-nci.txt
@@ -10,23 +10,26 @@
 - qcom,irq-gpio: specific gpio for read interrupt.
 - qcom,clk-src: nfc clock source ("BBCLK2", "RFCLK3", "GPCLK", ...)
 - qcom,clk-en-gpio: msm gpio clock,used ony if clock source is msm gpio
+- vlogic-supply: LDO for power supply
 - interrupt-parent: Should be phandle for the interrupt controller
                     that services interrupts for this device.
 - interrupts: should contain the NFC interrupt. NFC has one read interrupt.
 - qcom,clk-gpio: pmic gpio on which bbclk2 signal is coming.
 
-Example:
+LDO example:
 
-	i2c@f9925000 { /* BLSP1 QUP3 */
-	    nfc-nci@0e {
-	        compatible = "qcom,nfc-nci";
-		reg = <0x0e>;
-		qcom,irq-gpio = <&msmgpio 21 0x00>;
-		qcom,dis-gpio = <&msmgpio 20 0x00>;
-		qcom,clk-src = "BBCLK2";
-		qcom,clk-en-gpio = <&msmgpio 0 0x00>;
-		interrupt-parent = <&msmgpio>;
-		interrupts = <21 0>;
-		qcom,clk-gpio = <&pm8226_gpios 3 0>;
-	    };
+	i2c@f9925000 { /* BLSP-1 QUP-3 */
+		nfc-nci@e {
+			compatible = "qcom,nfc-nci";
+			reg = <0x0e>;
+			qcom,irq-gpio = <&msmgpio 77 0x00>;
+			qcom,dis-gpio = <&msmgpio 93 0x00>;
+			qcom,clk-en-gpio = <&msmgpio 78 0x00>;
+			qcom,clk-src = "GPCLK";
+			interrupt-parent = <&msmgpio>;
+			interrupts = <77 0>;
+			qcom,clk-gpio = <&msmgpio 75 0x00>;
+			vlogic-supply = <&pm8110_l14>;
+		};
 	};
+
diff --git a/Documentation/devicetree/bindings/power/qpnp-charger.txt b/Documentation/devicetree/bindings/power/qpnp-charger.txt
index 5425c92..584a76d 100644
--- a/Documentation/devicetree/bindings/power/qpnp-charger.txt
+++ b/Documentation/devicetree/bindings/power/qpnp-charger.txt
@@ -93,6 +93,10 @@
 					set, the charger ovp status is monitored in software.
 - qcom,ext-ovp-present			Indicates if an external OVP exists which reduces the
 					overall input resistance of the charge path.
+- qcom,power-stage-reduced		Indicates if power stage workaround is enabled. This work
+					around reduces the power stage segments while charging
+					under high load during low battery voltages. It's for
+					improving IADC accuracy while board has a bad layout.
 
 Sub node required structure:
 - A qcom,chg node must be a child of an SPMI node that has specified
diff --git a/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt b/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt
index 5e686a4f..56bdc59 100644
--- a/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt
+++ b/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt
@@ -407,6 +407,17 @@
 Required properties:
 - compatible : "qcom,msm8974-audio-taiko"
 - qcom,model : The user-visible name of this sound card.
+- reg : Offset and length of the register region(s) for MI2S/PCM MUX
+- reg-names : Register region name(s) referenced in reg above
+	 Required register resource entries are:
+	 "lpaif_pri_mode_muxsel": Physical address of MUX to select between
+				  Primary PCM and Primary MI2S
+	 "lpaif_sec_mode_muxsel": Physical address of MUX to select between
+				  Secondary PCM and Secondary MI2S
+	 "lpaif_tert_mode_muxsel": Physical address of MUX to select between
+				   Primary PCM and Tertiary MI2S
+	 "lpaif_quat_mode_muxsel": Physical address of MUX to select between
+				   Secondary PCM and Quarternary MI2S
 - qcom,audio-routing : A list of the connections between audio components.
   Each entry is a pair of strings, the first being the connection's sink,
   the second being the connection's source.
diff --git a/arch/arm/boot/dts/apq8026-v1-cdp.dts b/arch/arm/boot/dts/apq8026-v1-cdp.dts
index d7e283b..b9ec6f9 100644
--- a/arch/arm/boot/dts/apq8026-v1-cdp.dts
+++ b/arch/arm/boot/dts/apq8026-v1-cdp.dts
@@ -13,7 +13,7 @@
 
 /dts-v1/;
 /include/ "apq8026-v1.dtsi"
-/include/ "msm8226-cdp.dtsi"
+/include/ "msm8226-720p-cdp.dtsi"
 
 / {
 	model = "Qualcomm APQ 8026 CDP";
diff --git a/arch/arm/boot/dts/apq8026-v1-mtp.dts b/arch/arm/boot/dts/apq8026-v1-mtp.dts
index d24875c..c2fc72c 100644
--- a/arch/arm/boot/dts/apq8026-v1-mtp.dts
+++ b/arch/arm/boot/dts/apq8026-v1-mtp.dts
@@ -13,7 +13,7 @@
 
 /dts-v1/;
 /include/ "apq8026-v1.dtsi"
-/include/ "msm8226-mtp.dtsi"
+/include/ "msm8226-720p-mtp.dtsi"
 
 / {
 	model = "Qualcomm APQ 8026 MTP";
diff --git a/arch/arm/boot/dts/apq8026-v1-xpm.dts b/arch/arm/boot/dts/apq8026-v1-xpm.dts
index f69511b..b435018 100644
--- a/arch/arm/boot/dts/apq8026-v1-xpm.dts
+++ b/arch/arm/boot/dts/apq8026-v1-xpm.dts
@@ -13,7 +13,7 @@
 
 /dts-v1/;
 /include/ "apq8026-v1.dtsi"
-/include/ "msm8226-cdp.dtsi"
+/include/ "msm8226-720p-cdp.dtsi"
 
 / {
 	model = "Qualcomm APQ 8026 XPM";
diff --git a/arch/arm/boot/dts/apq8026-v2-cdp.dts b/arch/arm/boot/dts/apq8026-v2-1080p-cdp.dts
similarity index 91%
copy from arch/arm/boot/dts/apq8026-v2-cdp.dts
copy to arch/arm/boot/dts/apq8026-v2-1080p-cdp.dts
index cb68779..5294628 100644
--- a/arch/arm/boot/dts/apq8026-v2-cdp.dts
+++ b/arch/arm/boot/dts/apq8026-v2-1080p-cdp.dts
@@ -13,10 +13,10 @@
 
 /dts-v1/;
 /include/ "apq8026-v2.dtsi"
-/include/ "msm8226-cdp.dtsi"
+/include/ "msm8226-1080p-cdp.dtsi"
 
 / {
 	model = "Qualcomm APQ 8026v2 CDP";
 	compatible = "qcom,apq8026-cdp", "qcom,apq8026", "qcom,cdp";
-	qcom,board-id = <1 0>;
+	qcom,board-id = <1 2>;
 };
diff --git a/arch/arm/boot/dts/apq8026-v2-mtp.dts b/arch/arm/boot/dts/apq8026-v2-1080p-mtp.dts
similarity index 91%
copy from arch/arm/boot/dts/apq8026-v2-mtp.dts
copy to arch/arm/boot/dts/apq8026-v2-1080p-mtp.dts
index 40856c8..0ea98f5 100644
--- a/arch/arm/boot/dts/apq8026-v2-mtp.dts
+++ b/arch/arm/boot/dts/apq8026-v2-1080p-mtp.dts
@@ -13,10 +13,10 @@
 
 /dts-v1/;
 /include/ "apq8026-v2.dtsi"
-/include/ "msm8226-mtp.dtsi"
+/include/ "msm8226-1080p-mtp.dtsi"
 
 / {
 	model = "Qualcomm APQ 8026v2 MTP";
 	compatible = "qcom,apq8026-mtp", "qcom,apq8026", "qcom,mtp";
-	qcom,board-id = <8 0>;
+	qcom,board-id = <8 2>;
 };
diff --git a/arch/arm/boot/dts/apq8026-v2-cdp.dts b/arch/arm/boot/dts/apq8026-v2-720p-cdp.dts
similarity index 95%
rename from arch/arm/boot/dts/apq8026-v2-cdp.dts
rename to arch/arm/boot/dts/apq8026-v2-720p-cdp.dts
index cb68779..cb2226a 100644
--- a/arch/arm/boot/dts/apq8026-v2-cdp.dts
+++ b/arch/arm/boot/dts/apq8026-v2-720p-cdp.dts
@@ -13,7 +13,7 @@
 
 /dts-v1/;
 /include/ "apq8026-v2.dtsi"
-/include/ "msm8226-cdp.dtsi"
+/include/ "msm8226-720p-cdp.dtsi"
 
 / {
 	model = "Qualcomm APQ 8026v2 CDP";
diff --git a/arch/arm/boot/dts/apq8026-v2-mtp.dts b/arch/arm/boot/dts/apq8026-v2-720p-mtp.dts
similarity index 95%
rename from arch/arm/boot/dts/apq8026-v2-mtp.dts
rename to arch/arm/boot/dts/apq8026-v2-720p-mtp.dts
index 40856c8..439b3d7 100644
--- a/arch/arm/boot/dts/apq8026-v2-mtp.dts
+++ b/arch/arm/boot/dts/apq8026-v2-720p-mtp.dts
@@ -13,7 +13,7 @@
 
 /dts-v1/;
 /include/ "apq8026-v2.dtsi"
-/include/ "msm8226-mtp.dtsi"
+/include/ "msm8226-720p-mtp.dtsi"
 
 / {
 	model = "Qualcomm APQ 8026v2 MTP";
diff --git a/arch/arm/boot/dts/apq8026-v2-xpm.dts b/arch/arm/boot/dts/apq8026-v2-xpm.dts
index 324516d..3133424 100644
--- a/arch/arm/boot/dts/apq8026-v2-xpm.dts
+++ b/arch/arm/boot/dts/apq8026-v2-xpm.dts
@@ -13,7 +13,7 @@
 
 /dts-v1/;
 /include/ "apq8026-v2.dtsi"
-/include/ "msm8226-cdp.dtsi"
+/include/ "msm8226-720p-cdp.dtsi"
 
 / {
 	model = "Qualcomm APQ 8026v2 XPM";
diff --git a/arch/arm/boot/dts/dsi-panel-hx8379a-wvga-video.dtsi b/arch/arm/boot/dts/dsi-panel-hx8379a-wvga-video.dtsi
index 23b65f3..92e6fc1 100644
--- a/arch/arm/boot/dts/dsi-panel-hx8379a-wvga-video.dtsi
+++ b/arch/arm/boot/dts/dsi-panel-hx8379a-wvga-video.dtsi
@@ -81,14 +81,47 @@
 				00 00 00 00
 			39 01 00 00 00 00 24
 				E0 79 05 0F
-				14 26 20 3F
-				2A 43 04 0C
-				11 15 17 15
-				15 10 13 05
-				0F 14 26 20
-				3F 2A 43 04
-				0C 11 15 17
-				15 15 10 13
+				14 23 24 3F
+				30 46 06 10
+				13 16 17 16
+				16 13 18 05
+				0F 14 23 24
+				3F 30 46 06
+				10 13 16 17
+				16 16 13 18
+			39 01 00 00 00 00 80
+				C1 01 00 07
+				10 17 1D 2A
+				33 3A 43 4A
+				52 5B 64 6D
+				78 7F 88 90
+				98 A0 A9 B2
+				B9 C1 C9 D1
+				D7 DF E6 ED
+				F4 FA FD 00
+				00 00 00 00
+				00 00 00 00
+				00 08 10 18
+				20 28 30 38
+				40 47 4F 58
+				60 68 70 78
+				80 88 90 98
+				A0 A9 B1 B9
+				C1 C9 D1 D8
+				E0 E8 F0 F9
+				FE 00 00 00
+				00 00 00 00
+				00 00 00 08
+				10 18 1E 26
+				2E 34 3A 41
+				49 4F 58 5E
+				67 6F 77 80
+				88 8F 97 9F
+				A7 AF B8 BF
+				C7 D1 D8 E3
+				EA F6 FF 00
+				00 00 00 00
+				00 00 00 00
 			23 01 00 00 00 00 02
 				cc 02
 			39 01 00 00 00 00 05
diff --git a/arch/arm/boot/dts/dsi-panel-hx8389b-qhd-video.dtsi b/arch/arm/boot/dts/dsi-panel-hx8389b-qhd-video.dtsi
index 7e63014..8f94502 100755
--- a/arch/arm/boot/dts/dsi-panel-hx8389b-qhd-video.dtsi
+++ b/arch/arm/boot/dts/dsi-panel-hx8389b-qhd-video.dtsi
@@ -124,7 +124,7 @@
 		qcom,mdss-dsi-panel-timings = [97 23 17 00 4B 53 1C 27 27 03 04 00];
 		qcom,mdss-dsi-t-clk-post = <0x04>;
 		qcom,mdss-dsi-t-clk-pre = <0x1b>;
-		qcom,mdss-dsi-bl-min-level = <1>;
+		qcom,mdss-dsi-bl-min-level = <26>;
 		qcom,mdss-dsi-bl-max-level = <255>;
 		qcom,mdss-dsi-dma-trigger = <4>;
 		qcom,mdss-dsi-mdp-trigger = <0>;
diff --git a/arch/arm/boot/dts/dsi-panel-otm8018b-fwvga-video.dtsi b/arch/arm/boot/dts/dsi-panel-otm8018b-fwvga-video.dtsi
index 9477c56..393419b 100644
--- a/arch/arm/boot/dts/dsi-panel-otm8018b-fwvga-video.dtsi
+++ b/arch/arm/boot/dts/dsi-panel-otm8018b-fwvga-video.dtsi
@@ -256,7 +256,7 @@
 		qcom,mdss-dsi-panel-timings = [8B 1F 14 00 45 4A 19 23 23 03 04 00];
 		qcom,mdss-dsi-t-clk-post = <0x04>;
 		qcom,mdss-dsi-t-clk-pre = <0x1b>;
-		qcom,mdss-dsi-bl-min-level = <1>;
+		qcom,mdss-dsi-bl-min-level = <26>;
 		qcom,mdss-dsi-bl-max-level = <255>;
 		qcom,mdss-dsi-dma-trigger = <4>;
 		qcom,mdss-dsi-mdp-trigger = <0>;
diff --git a/arch/arm/boot/dts/dsi-panel-ssd2080m-720p-video.dtsi b/arch/arm/boot/dts/dsi-panel-ssd2080m-720p-video.dtsi
index bb8389f..b510e6b 100644
--- a/arch/arm/boot/dts/dsi-panel-ssd2080m-720p-video.dtsi
+++ b/arch/arm/boot/dts/dsi-panel-ssd2080m-720p-video.dtsi
@@ -30,9 +30,9 @@
 		qcom,mdss-dsi-h-back-porch = <24>;
 		qcom,mdss-dsi-h-pulse-width = <14>;
 		qcom,mdss-dsi-h-sync-skew = <0>;
-		qcom,mdss-dsi-v-back-porch = <15>;
-		qcom,mdss-dsi-v-front-porch = <12>;
-		qcom,mdss-dsi-v-pulse-width = <10>;
+		qcom,mdss-dsi-v-back-porch = <14>;
+		qcom,mdss-dsi-v-front-porch = <11>;
+		qcom,mdss-dsi-v-pulse-width = <2>;
 		qcom,mdss-dsi-h-left-border = <0>;
 		qcom,mdss-dsi-h-right-border = <0>;
 		qcom,mdss-dsi-v-top-border = <0>;
diff --git a/arch/arm/boot/dts/msm-pm8226.dtsi b/arch/arm/boot/dts/msm-pm8226.dtsi
index f65e282..b9bcd0c 100644
--- a/arch/arm/boot/dts/msm-pm8226.dtsi
+++ b/arch/arm/boot/dts/msm-pm8226.dtsi
@@ -433,6 +433,16 @@
 				qcom,hw-settle-time = <0>;
 				qcom,fast-avg-setup = <0>;
 			};
+			chan@1 {
+				label = "external_rsense";
+				reg = <1>;
+				qcom,decimation = <0>;
+				qcom,pre-div-channel-scaling = <1>;
+				qcom,calibration-type = "absolute";
+				qcom,scale-function = <0>;
+				qcom,hw-settle-time = <0>;
+				qcom,fast-avg-setup = <0>;
+			};
 		};
 
 		pm8226_adc_tm: vadc@3400 {
diff --git a/arch/arm/boot/dts/msm8226-1080p-cdp.dtsi b/arch/arm/boot/dts/msm8226-1080p-cdp.dtsi
new file mode 100644
index 0000000..e310c17
--- /dev/null
+++ b/arch/arm/boot/dts/msm8226-1080p-cdp.dtsi
@@ -0,0 +1,492 @@
+/* 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/ "msm8226-camera-sensor-cdp.dtsi"
+
+&soc {
+	serial@f991f000 {
+		status = "ok";
+	};
+
+	i2c@f9927000 { /* BLSP1 QUP5 */
+		synaptics@20 {
+			compatible = "synaptics,rmi4";
+			reg = <0x20>;
+			interrupt-parent = <&msmgpio>;
+			interrupts = <17 0x2008>;
+			vdd-supply = <&pm8226_l19>;
+			vcc_i2c-supply = <&pm8226_lvs1>;
+			synaptics,reset-gpio = <&msmgpio 16 0x00>;
+			synaptics,irq-gpio = <&msmgpio 17 0x2008>;
+			synaptics,button-map = <139 102 158>;
+			synaptics,i2c-pull-up;
+			synaptics,power-down;
+			synaptics,disable-gpios;
+		};
+	};
+
+	i2c@f9925000 { /* BLSP1 QUP3 */
+		nfc-nci@0e {
+			compatible = "qcom,nfc-nci";
+			reg = <0x0e>;
+			qcom,irq-gpio = <&msmgpio 21 0x00>;
+			qcom,dis-gpio = <&msmgpio 20 0x00>;
+			qcom,clk-src = "BBCLK2";
+			qcom,clk-en-gpio = <&msmgpio 0 0x00>;
+			interrupt-parent = <&msmgpio>;
+			interrupts = <21 0>;
+			qcom,clk-gpio = <&pm8226_gpios 3 0>;
+		};
+	};
+
+	gpio_keys {
+		compatible = "gpio-keys";
+		input-name = "gpio-keys";
+
+		camera_focus {
+			label = "camera_focus";
+			gpios = <&msmgpio 108 0x1>;
+			linux,input-type = <1>;
+			linux,code = <0x210>;
+			gpio-key,wakeup;
+			debounce-interval = <15>;
+		};
+
+		camera_snapshot {
+			label = "camera_snapshot";
+			gpios = <&msmgpio 107 0x1>;
+			linux,input-type = <1>;
+			linux,code = <0x2fe>;
+			gpio-key,wakeup;
+			debounce-interval = <15>;
+		};
+
+		vol_up {
+			label = "volume_up";
+			gpios = <&msmgpio 106 0x1>;
+			linux,input-type = <1>;
+			linux,code = <115>;
+			gpio-key,wakeup;
+			debounce-interval = <15>;
+		};
+	};
+
+	spi@f9923000 {
+		ethernet-switch@3 {
+			compatible = "micrel,ks8851";
+			reg = <3>;
+			interrupt-parent = <&msmgpio>;
+			interrupts = <115 0x8>;
+			spi-max-frequency = <4800000>;
+			rst-gpio = <&msmgpio 114 0>;
+			vdd-io-supply = <&pm8226_lvs1>;
+			vdd-phy-supply = <&pm8226_lvs1>;
+		};
+	};
+
+	sound {
+		qcom,audio-routing =
+			"RX_BIAS", "MCLK",
+			"LDO_H", "MCLK",
+			"SPK_OUT", "MCLK",
+			"SPK_OUT", "EXT_VDD_SPKR",
+			"AMIC1", "MIC BIAS1 Internal1",
+			"MIC BIAS1 Internal1", "Handset Mic",
+			"AMIC2", "MIC BIAS2 External",
+			"MIC BIAS2 External", "Headset Mic",
+			"AMIC4", "MIC BIAS2 External",
+			"MIC BIAS2 External", "ANCRight Headset Mic",
+			"AMIC5", "MIC BIAS2 External",
+			"MIC BIAS2 External", "ANCLeft Headset Mic",
+			"DMIC1", "MIC BIAS1 External",
+			"MIC BIAS1 External", "Digital Mic1",
+			"DMIC2", "MIC BIAS1 External",
+			"MIC BIAS1 External", "Digital Mic2",
+			"DMIC3", "MIC BIAS3 External",
+			"MIC BIAS3 External", "Digital Mic3",
+			"DMIC4", "MIC BIAS3 External",
+			"MIC BIAS3 External", "Digital Mic4";
+
+		qcom,cdc-mclk-gpios = <&pm8226_gpios 1 0>;
+		qcom,cdc-vdd-spkr-gpios = <&pm8226_gpios 2 0>;
+		qcom,headset-jack-type-NC;
+	};
+
+	sound-9302 {
+		qcom,audio-routing =
+			"RX_BIAS", "MCLK",
+			"LDO_H", "MCLK",
+			"SPK_OUT", "MCLK",
+			"SPK_OUT", "EXT_VDD_SPKR",
+			"AMIC1", "MIC BIAS1 External",
+			"MIC BIAS1 External", "Handset Mic",
+			"AMIC2", "MIC BIAS2 External",
+			"MIC BIAS2 External", "Headset Mic",
+			"AMIC3", "MIC BIAS1 External",
+			"MIC BIAS1 External", "Handset Mic";
+
+		qcom,cdc-mclk-gpios = <&pm8226_gpios 1 0>;
+		qcom,cdc-vdd-spkr-gpios = <&pm8226_gpios 2 0>;
+		qcom,headset-jack-type-NC;
+	};
+};
+
+&sdcc1 {
+	vdd-supply = <&pm8226_l17>;
+	qcom,vdd-voltage-level = <2950000 2950000>;
+	qcom,vdd-current-level = <800 500000>;
+
+	vdd-io-supply = <&pm8226_l6>;
+	qcom,vdd-io-always-on;
+	qcom,vdd-io-voltage-level = <1800000 1800000>;
+	qcom,vdd-io-current-level = <250 154000>;
+
+	qcom,pad-pull-on = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-pull-off = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-drv-on = <0x4 0x4 0x4>; /* 10mA, 10mA, 10mA */
+	qcom,pad-drv-off = <0x0 0x0 0x0>; /* 2mA, 2mA, 2mA */
+
+	qcom,clk-rates = <400000 25000000 50000000 100000000 200000000>;
+	qcom,sup-voltages = <2950 2950>;
+
+	qcom,bus-speed-mode = "HS200_1p8v", "DDR_1p8v";
+	qcom,nonremovable;
+
+	status = "disabled";
+};
+
+&sdhc_1 {
+	vdd-supply = <&pm8226_l17>;
+	qcom,vdd-voltage-level = <2950000 2950000>;
+	qcom,vdd-current-level = <800 500000>;
+
+	vdd-io-supply = <&pm8226_l6>;
+	qcom,vdd-io-always-on;
+	qcom,vdd-io-voltage-level = <1800000 1800000>;
+	qcom,vdd-io-current-level = <250 154000>;
+
+	qcom,pad-pull-on = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-pull-off = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-drv-on = <0x4 0x4 0x4>; /* 10mA, 10mA, 10mA */
+	qcom,pad-drv-off = <0x0 0x0 0x0>; /* 2mA, 2mA, 2mA */
+
+	qcom,clk-rates = <400000 25000000 50000000 100000000 200000000>;
+	qcom,bus-speed-mode = "HS200_1p8v", "DDR_1p8v";
+	qcom,nonremovable;
+
+	status = "ok";
+};
+
+&sdcc2 {
+	vdd-supply = <&pm8226_l18>;
+	qcom,vdd-voltage-level = <2950000 2950000>;
+	qcom,vdd-current-level = <9000 800000>;
+
+	vdd-io-supply = <&pm8226_l21>;
+	qcom,vdd-io-voltage-level = <1800000 2950000>;
+	qcom,vdd-io-current-level = <6 22000>;
+
+	qcom,pad-pull-on = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-pull-off = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-drv-on = <0x4 0x4 0x4>; /* 10mA, 10mA, 10mA */
+	qcom,pad-drv-off = <0x0 0x0 0x0>; /* 2mA, 2mA, 2mA */
+
+	qcom,clk-rates = <400000 25000000 50000000 100000000 200000000>;
+	qcom,sup-voltages = <2950 2950>;
+
+	qcom,xpc;
+	qcom,bus-speed-mode = "SDR12", "SDR25", "SDR50", "DDR50", "SDR104";
+	qcom,current-limit = <600>;
+
+	#address-cells = <0>;
+	interrupt-parent = <&sdcc2>;
+	interrupts = <0 1 2>;
+	#interrupt-cells = <1>;
+	interrupt-map-mask = <0xffffffff>;
+	interrupt-map = <0 &intc 0 125 0
+			1 &intc 0 220 0
+			2 &msmgpio 38 0x3>;
+	interrupt-names = "core_irq", "bam_irq", "status_irq";
+	cd-gpios = <&msmgpio 38 0x1>;
+
+	status = "disabled";
+};
+
+&sdhc_2 {
+	vdd-supply = <&pm8226_l18>;
+	qcom,vdd-voltage-level = <2950000 2950000>;
+	qcom,vdd-current-level = <9000 800000>;
+
+	vdd-io-supply = <&pm8226_l21>;
+	qcom,vdd-io-voltage-level = <1800000 2950000>;
+	qcom,vdd-io-current-level = <6 22000>;
+
+	qcom,pad-pull-on = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-pull-off = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-drv-on = <0x4 0x4 0x4>; /* 10mA, 10mA, 10mA */
+	qcom,pad-drv-off = <0x0 0x0 0x0>; /* 2mA, 2mA, 2mA */
+
+	qcom,clk-rates = <400000 25000000 50000000 100000000 200000000>;
+
+	#address-cells = <0>;
+	interrupt-parent = <&sdhc_2>;
+	interrupts = <0 1 2>;
+	#interrupt-cells = <1>;
+	interrupt-map-mask = <0xffffffff>;
+	interrupt-map = <0 &intc 0 125 0
+			1 &intc 0 221 0
+			2 &msmgpio 38 0x3>;
+	interrupt-names = "hc_irq", "pwr_irq", "status_irq";
+	cd-gpios = <&msmgpio 38 0x1>;
+
+	status = "ok";
+};
+
+&sdcc3 {
+	qcom,sup-voltages = <1800 1800>;
+	status = "disabled";
+};
+
+&sdhc_3 {
+	qcom,sup-voltages = <1800 1800>;
+	status = "disabled";
+};
+
+&spmi_bus {
+	qcom,pm8226@0 {
+		qcom,leds@a100 {
+			status = "okay";
+			qcom,led_mpp_2 {
+				label = "mpp";
+				linux,name = "button-backlight";
+				linux,default-trigger = "none";
+				qcom,default-state = "off";
+				qcom,max-current = <40>;
+				qcom,current-setting = <5>;
+				qcom,id = <6>;
+				qcom,mode = "manual";
+				qcom,source-sel = <1>;
+				qcom,mode-ctrl = <0x60>;
+			};
+		};
+
+		qcom,leds@a300 {
+			status = "okay";
+			qcom,led_mpp_4 {
+				label = "mpp";
+				linux,name = "green";
+				linux,default-trigger = "battery-full";
+				qcom,default-state = "off";
+				qcom,max-current = <40>;
+				qcom,current-setting = <5>;
+				qcom,id = <6>;
+				qcom,mode = "pwm";
+				qcom,pwm-us = <1000>;
+				qcom,source-sel = <8>;
+				qcom,mode-ctrl = <0x60>;
+				qcom,pwm-channel = <0>;
+				qcom,start-idx = <1>;
+				qcom,ramp-step-ms = <120>;
+				qcom,duty-pcts = [00 00 00 00 00
+						  00 00 00 00 00
+						  50 00 00 00 00
+						  00 00 00 00 00
+						  00];
+				qcom,use-blink;
+			};
+		};
+
+		qcom,leds@a500 {
+			status = "okay";
+			qcom,led_mpp_6 {
+				label = "mpp";
+				linux,name = "red";
+				linux,default-trigger = "battery-charging";
+				qcom,default-state = "off";
+				qcom,max-current = <40>;
+				qcom,current-setting = <5>;
+				qcom,id = <6>;
+				qcom,mode = "pwm";
+				qcom,pwm-us = <1000>;
+				qcom,mode-ctrl = <0x60>;
+				qcom,source-sel = <10>;
+				qcom,pwm-channel = <5>;
+				qcom,start-idx = <1>;
+				qcom,ramp-step-ms = <120>;
+				qcom,duty-pcts = [00 00 00 00 00
+						  00 00 00 00 00
+						  50 00 00 00 00
+						  00 00 00 00 00
+						  00];
+				qcom,use-blink;
+			};
+		};
+	};
+
+	qcom,pm8226@1 {
+		qcom,leds@d800 {
+			status = "okay";
+			qcom,wled_0 {
+				label = "wled";
+				linux,name = "wled:backlight";
+				linux,default-trigger = "bkl-trigger";
+				qcom,cs-out-en;
+				qcom,op-fdbck = <1>;
+				qcom,default-state = "on";
+				qcom,max-current = <20>;
+				qcom,ctrl-delay-us = <0>;
+				qcom,boost-curr-lim = <3>;
+				qcom,cp-sel = <0>;
+				qcom,switch-freq = <11>;
+				qcom,ovp-val = <0>;
+				qcom,num-strings = <1>;
+				qcom,id = <0>;
+			};
+		};
+
+		qcom,vibrator@c000 {
+			status = "okay";
+			qcom,vib-timeout-ms = <15000>;
+			qcom,vib-vtg-level-mV = <3100>;
+		};
+	};
+};
+
+&pm8226_gpios {
+	gpio@c000 { /* GPIO 1 */
+		/* XO_PMIC_CDC_MCLK enable for tapan codec */
+		qcom,mode = <1>;		/* Digital output */
+		qcom,output-type = <0>;	/* CMOS logic */
+		qcom,pull = <5>;		/* QPNP_PIN_PULL_NO*/
+		qcom,vin-sel = <3>;		/* QPNP_PIN_VIN3 */
+		qcom,out-strength = <3>;/* QPNP_PIN_OUT_STRENGTH_HIGH */
+		qcom,src-sel = <2>;		/* QPNP_PIN_SEL_FUNC_1 */
+		qcom,master-en = <1>;	/* Enable GPIO */
+	};
+
+	gpio@c100 { /* GPIO 2 */
+		qcom,mode = <1>;
+		qcom,output-type = <0>;
+		qcom,pull = <5>;
+		qcom,vin-sel = <3>;
+		qcom,out-strength = <3>;
+		qcom,src-sel = <2>;
+		qcom,master-en = <1>;
+	};
+
+	gpio@c200 { /* GPIO 3 */
+		qcom,mode = <0>;		/* QPNP_PIN_MODE_DIG_IN */
+		qcom,pull = <5>;		/* QPNP_PIN_PULL_NO */
+		qcom,vin-sel = <2>;		/* QPNP_PIN_VIN2 */
+		qcom,src-sel = <2>;		/* QPNP_PIN_SEL_FUNC_1 */
+		qcom,master-en = <1>;
+	};
+
+	gpio@c300 { /* GPIO 4 */
+	};
+
+	gpio@c400 { /* GPIO 5 */
+	};
+
+	gpio@c500 { /* GPIO 6 */
+	};
+
+	gpio@c600 { /* GPIO 7 */
+	};
+
+	gpio@c700 { /* GPIO 8 */
+	};
+};
+
+&pm8226_mpps {
+	mpp@a000 { /* MPP 1 */
+	};
+
+	mpp@a100 { /* MPP 2 */
+	};
+
+	mpp@a200 { /* MPP 3 */
+	};
+
+	mpp@a300 { /* MPP 4 */
+	};
+
+	mpp@a400 { /* MPP 5 */
+		/* PA_THERM0 config */
+		qcom,mode = <4>; /* AIN input */
+		qcom,invert = <1>; /* Enable MPP */
+		qcom,ain-route = <0>; /* AMUX 5 */
+		qcom,master-en = <1>;
+		qcom,src-sel = <0>; /* Function constant */
+	};
+
+	mpp@a500 { /* MPP 6 */
+	};
+
+	mpp@a600 { /* MPP 7 */
+	};
+
+	mpp@a700 { /* MPP 8 */
+		/* PA_THERM1 config */
+		qcom,mode = <4>; /* AIN input */
+		qcom,invert = <1>; /* Enable MPP */
+		qcom,ain-route = <3>; /* AMUX 8 */
+		qcom,master-en = <1>;
+		qcom,src-sel = <0>; /* Function constant */
+	};
+};
+
+&pm8226_chg {
+	qcom,charging-disabled;
+	qcom,use-default-batt-values;
+
+	qcom,bat-if@1200 {
+		status = "disabled";
+	};
+};
+
+&pm8226_vadc {
+	chan@14 {
+		label = "pa_therm0";
+		reg = <0x14>;
+		qcom,decimation = <0>;
+		qcom,pre-div-channel-scaling = <0>;
+		qcom,calibration-type = "ratiometric";
+		qcom,scale-function = <2>;
+		qcom,hw-settle-time = <2>;
+		qcom,fast-avg-setup = <0>;
+	};
+
+	chan@17 {
+		label = "pa_therm1";
+		reg = <0x17>;
+		qcom,decimation = <0>;
+		qcom,pre-div-channel-scaling = <0>;
+		qcom,calibration-type = "ratiometric";
+		qcom,scale-function = <2>;
+		qcom,hw-settle-time = <2>;
+		qcom,fast-avg-setup = <0>;
+	};
+};
+
+&mdss_mdp {
+	qcom,mdss-pref-prim-intf = "dsi";
+};
+
+&mdss_dsi0 {
+	qcom,dsi-pref-prim-pan = <&dsi_jdi_1080_vid>;
+	qcom,platform-enable-gpio = <&msmgpio 109 0>;
+};
+
+&dsi_jdi_1080_vid {
+	qcom,cont-splash-enabled;
+};
diff --git a/arch/arm/boot/dts/msm8226-1080p-mtp.dtsi b/arch/arm/boot/dts/msm8226-1080p-mtp.dtsi
new file mode 100644
index 0000000..e58c321
--- /dev/null
+++ b/arch/arm/boot/dts/msm8226-1080p-mtp.dtsi
@@ -0,0 +1,509 @@
+/* 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/ "msm8226-camera-sensor-mtp.dtsi"
+
+&soc {
+	serial@f991f000 {
+		status = "ok";
+	};
+
+	i2c@f9927000 { /* BLSP1 QUP5 */
+		synaptics@20 {
+			compatible = "synaptics,rmi4";
+			reg = <0x20>;
+			interrupt-parent = <&msmgpio>;
+			interrupts = <17 0x2008>;
+			vdd-supply = <&pm8226_l19>;
+			vcc_i2c-supply = <&pm8226_lvs1>;
+			synaptics,reset-gpio = <&msmgpio 16 0x00>;
+			synaptics,irq-gpio = <&msmgpio 17 0x2008>;
+			synaptics,button-map = <139 102 158>;
+			synaptics,i2c-pull-up;
+			synaptics,power-down;
+			synaptics,disable-gpios;
+		};
+	};
+
+	i2c@f9925000 { /* BLSP1 QUP3 */
+		nfc-nci@0e {
+			compatible = "qcom,nfc-nci";
+			reg = <0x0e>;
+			qcom,irq-gpio = <&msmgpio 21 0x00>;
+			qcom,dis-gpio = <&msmgpio 20 0x00>;
+			qcom,clk-src = "BBCLK2";
+			qcom,clk-en-gpio = <&msmgpio 0 0x00>;
+			interrupt-parent = <&msmgpio>;
+			interrupts = <21 0>;
+			qcom,clk-gpio = <&pm8226_gpios 3 0>;
+		};
+	};
+	gpio_keys {
+		compatible = "gpio-keys";
+		input-name = "gpio-keys";
+
+		camera_focus {
+			label = "camera_focus";
+			gpios = <&msmgpio 108 0x1>;
+			linux,input-type = <1>;
+			linux,code = <0x210>;
+			gpio-key,wakeup;
+			debounce-interval = <15>;
+		};
+
+		camera_snapshot {
+			label = "camera_snapshot";
+			gpios = <&msmgpio 107 0x1>;
+			linux,input-type = <1>;
+			linux,code = <0x2fe>;
+			gpio-key,wakeup;
+			debounce-interval = <15>;
+		};
+
+		vol_up {
+			label = "volume_up";
+			gpios = <&msmgpio 106 0x1>;
+			linux,input-type = <1>;
+			linux,code = <115>;
+			gpio-key,wakeup;
+			debounce-interval = <15>;
+		};
+	};
+
+	spi@f9923000 {
+		ethernet-switch@3 {
+			compatible = "micrel,ks8851";
+			reg = <3>;
+			interrupt-parent = <&msmgpio>;
+			interrupts = <115 0x8>;
+			spi-max-frequency = <4800000>;
+			rst-gpio = <&msmgpio 114 0>;
+			vdd-io-supply = <&pm8226_lvs1>;
+			vdd-phy-supply = <&pm8226_lvs1>;
+		};
+	};
+
+	sound {
+		qcom,audio-routing =
+			"RX_BIAS", "MCLK",
+			"LDO_H", "MCLK",
+			"SPK_OUT", "MCLK",
+			"SPK_OUT", "EXT_VDD_SPKR",
+			"AMIC1", "MIC BIAS1 External",
+			"MIC BIAS1 External", "Handset Mic",
+			"AMIC2", "MIC BIAS2 External",
+			"MIC BIAS2 External", "Headset Mic",
+			"AMIC4", "MIC BIAS2 External",
+			"MIC BIAS2 External", "ANCRight Headset Mic",
+			"AMIC5", "MIC BIAS2 External",
+			"MIC BIAS2 External", "ANCLeft Headset Mic";
+
+		qcom,cdc-mclk-gpios = <&pm8226_gpios 1 0>;
+		qcom,cdc-vdd-spkr-gpios = <&pm8226_gpios 2 0>;
+	};
+
+	sound-9302 {
+		qcom,audio-routing =
+			"RX_BIAS", "MCLK",
+			"LDO_H", "MCLK",
+			"SPK_OUT", "MCLK",
+			"SPK_OUT", "EXT_VDD_SPKR",
+			"AMIC1", "MIC BIAS1 Internal1",
+			"MIC BIAS1 Internal1", "Handset Mic",
+			"AMIC2", "MIC BIAS2 External",
+			"MIC BIAS2 External", "Headset Mic",
+			"AMIC3", "MIC BIAS1 External",
+			"MIC BIAS1 External", "Handset Mic";
+
+		qcom,cdc-mclk-gpios = <&pm8226_gpios 1 0>;
+		qcom,cdc-vdd-spkr-gpios = <&pm8226_gpios 2 0>;
+	};
+};
+
+&usb_otg {
+	#address-cells = <0>;
+	interrupt-parent = <&usb_otg>;
+	interrupts = <0 1 2>;
+	#interrupt-cells = <1>;
+	interrupt-map-mask = <0xffffffff>;
+	interrupt-map = <0 &intc 0 134 0
+			1 &intc 0 140 0
+			2 &spmi_bus 0x0 0x0 0x9 0x0>;
+	interrupt-names = "core_irq", "async_irq", "pmic_id_irq";
+
+	qcom,hsusb-otg-mode = <3>;
+	vbus_otg-supply = <&pm8226_chg_otg>;
+};
+
+&sdcc1 {
+	vdd-supply = <&pm8226_l17>;
+	qcom,vdd-voltage-level = <2950000 2950000>;
+	qcom,vdd-current-level = <800 500000>;
+
+	vdd-io-supply = <&pm8226_l6>;
+	qcom,vdd-io-always-on;
+	qcom,vdd-io-voltage-level = <1800000 1800000>;
+	qcom,vdd-io-current-level = <250 154000>;
+
+	qcom,pad-pull-on = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-pull-off = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-drv-on = <0x4 0x4 0x4>; /* 10mA, 10mA, 10mA */
+	qcom,pad-drv-off = <0x0 0x0 0x0>; /* 2mA, 2mA, 2mA */
+
+	qcom,clk-rates = <400000 25000000 50000000 100000000 200000000>;
+	qcom,sup-voltages = <2950 2950>;
+
+	qcom,bus-speed-mode = "HS200_1p8v", "DDR_1p8v";
+	qcom,nonremovable;
+
+	status = "disabled";
+};
+
+&sdhc_1 {
+	vdd-supply = <&pm8226_l17>;
+	qcom,vdd-voltage-level = <2950000 2950000>;
+	qcom,vdd-current-level = <800 500000>;
+
+	vdd-io-supply = <&pm8226_l6>;
+	qcom,vdd-io-always-on;
+	qcom,vdd-io-voltage-level = <1800000 1800000>;
+	qcom,vdd-io-current-level = <250 154000>;
+
+	qcom,pad-pull-on = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-pull-off = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-drv-on = <0x4 0x4 0x4>; /* 10mA, 10mA, 10mA */
+	qcom,pad-drv-off = <0x0 0x0 0x0>; /* 2mA, 2mA, 2mA */
+
+	qcom,clk-rates = <400000 25000000 50000000 100000000 200000000>;
+	qcom,bus-speed-mode = "HS200_1p8v", "DDR_1p8v";
+	qcom,nonremovable;
+
+	status = "ok";
+};
+
+&sdcc2 {
+	vdd-supply = <&pm8226_l18>;
+	qcom,vdd-voltage-level = <2950000 2950000>;
+	qcom,vdd-current-level = <9000 800000>;
+
+	vdd-io-supply = <&pm8226_l21>;
+	qcom,vdd-io-voltage-level = <1800000 2950000>;
+	qcom,vdd-io-current-level = <6 22000>;
+
+	qcom,pad-pull-on = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-pull-off = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-drv-on = <0x4 0x4 0x4>; /* 10mA, 10mA, 10mA */
+	qcom,pad-drv-off = <0x0 0x0 0x0>; /* 2mA, 2mA, 2mA */
+
+	qcom,clk-rates = <400000 25000000 50000000 100000000 200000000>;
+	qcom,sup-voltages = <2950 2950>;
+
+	qcom,xpc;
+	qcom,bus-speed-mode = "SDR12", "SDR25", "SDR50", "DDR50", "SDR104";
+	qcom,current-limit = <600>; #address-cells = <0>; interrupt-parent = <&sdcc2>;
+	interrupts = <0 1 2>;
+	#interrupt-cells = <1>;
+	interrupt-map-mask = <0xffffffff>;
+	interrupt-map = <0 &intc 0 125 0
+			1 &intc 0 220 0
+			2 &msmgpio 38 0x3>;
+	interrupt-names = "core_irq", "bam_irq", "status_irq";
+	cd-gpios = <&msmgpio 38 0x1>;
+
+	status = "disabled";
+};
+
+&sdhc_2 {
+	vdd-supply = <&pm8226_l18>;
+	qcom,vdd-voltage-level = <2950000 2950000>;
+	qcom,vdd-current-level = <9000 800000>;
+
+	vdd-io-supply = <&pm8226_l21>;
+	qcom,vdd-io-voltage-level = <1800000 2950000>;
+	qcom,vdd-io-current-level = <6 22000>;
+
+	qcom,pad-pull-on = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-pull-off = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
+	qcom,pad-drv-on = <0x4 0x4 0x4>; /* 10mA, 10mA, 10mA */
+	qcom,pad-drv-off = <0x0 0x0 0x0>; /* 2mA, 2mA, 2mA */
+
+	qcom,clk-rates = <400000 25000000 50000000 100000000 200000000>;
+
+	#address-cells = <0>;
+	interrupt-parent = <&sdhc_2>;
+	interrupts = <0 1 2>;
+	#interrupt-cells = <1>;
+	interrupt-map-mask = <0xffffffff>;
+	interrupt-map = <0 &intc 0 125 0
+			1 &intc 0 221 0
+			2 &msmgpio 38 0x3>;
+	interrupt-names = "hc_irq", "pwr_irq", "status_irq";
+	cd-gpios = <&msmgpio 38 0x1>;
+
+	status = "ok";
+};
+
+&spmi_bus {
+	qcom,pm8226@0 {
+		qcom,leds@a100 {
+			status = "okay";
+			qcom,led_mpp_2 {
+				label = "mpp";
+				linux,name = "button-backlight";
+				linux,default-trigger = "none";
+				qcom,default-state = "off";
+				qcom,max-current = <40>;
+				qcom,current-setting = <5>;
+				qcom,id = <6>;
+				qcom,mode = "manual";
+				qcom,source-sel = <1>;
+				qcom,mode-ctrl = <0x60>;
+			};
+		};
+
+		qcom,leds@a300 {
+			status = "okay";
+			qcom,led_mpp_4 {
+				label = "mpp";
+				linux,name = "green";
+				linux,default-trigger = "battery-full";
+				qcom,default-state = "off";
+				qcom,max-current = <40>;
+				qcom,current-setting = <5>;
+				qcom,id = <6>;
+				qcom,mode = "pwm";
+				qcom,pwm-us = <1000>;
+				qcom,source-sel = <8>;
+				qcom,mode-ctrl = <0x60>;
+				qcom,pwm-channel = <0>;
+				qcom,start-idx = <1>;
+				qcom,ramp-step-ms = <120>;
+				qcom,duty-pcts = [00 00 00 00 00
+						  00 00 00 00 00
+						  50 00 00 00 00
+						  00 00 00 00 00
+						  00];
+				qcom,use-blink;
+			};
+		};
+
+		qcom,leds@a500 {
+			status = "okay";
+			qcom,led_mpp_6 {
+				label = "mpp";
+				linux,name = "red";
+				linux,default-trigger = "battery-charging";
+				qcom,default-state = "off";
+				qcom,max-current = <40>;
+				qcom,current-setting = <5>;
+				qcom,id = <6>;
+				qcom,mode = "pwm";
+				qcom,pwm-us = <1000>;
+				qcom,mode-ctrl = <0x60>;
+				qcom,source-sel = <10>;
+				qcom,pwm-channel = <5>;
+				qcom,start-idx = <1>;
+				qcom,ramp-step-ms = <120>;
+				qcom,duty-pcts = [00 00 00 00 00
+						  00 00 00 00 00
+						  50 00 00 00 00
+						  00 00 00 00 00
+						  00];
+				qcom,use-blink;
+			};
+		};
+	};
+
+	qcom,pm8226@1 {
+                qcom,leds@d300 {
+                        status = "okay";
+                };
+
+		qcom,leds@d800 {
+			status = "okay";
+			qcom,wled_0 {
+				label = "wled";
+				linux,name = "wled:backlight";
+				linux,default-trigger = "bkl-trigger";
+				qcom,cs-out-en;
+				qcom,op-fdbck = <1>;
+				qcom,default-state = "on";
+				qcom,max-current = <20>;
+				qcom,ctrl-delay-us = <0>;
+				qcom,boost-curr-lim = <3>;
+				qcom,cp-sel = <0>;
+				qcom,switch-freq = <11>;
+				qcom,ovp-val = <0>;
+				qcom,num-strings = <1>;
+				qcom,id = <0>;
+			};
+		};
+
+		qcom,vibrator@c000 {
+			status = "okay";
+			qcom,vib-timeout-ms = <15000>;
+			qcom,vib-vtg-level-mV = <3100>;
+		};
+	};
+};
+
+&pm8226_gpios {
+	gpio@c000 { /* GPIO 1 */
+		/* XO_PMIC_CDC_MCLK enable for tapan codec */
+		qcom,mode = <1>;		/* Digital output */
+		qcom,output-type = <0>;	/* CMOS logic */
+		qcom,pull = <5>;		/* QPNP_PIN_PULL_NO*/
+		qcom,vin-sel = <3>;		/* QPNP_PIN_VIN3 */
+		qcom,out-strength = <3>;/* QPNP_PIN_OUT_STRENGTH_HIGH */
+		qcom,src-sel = <2>;		/* QPNP_PIN_SEL_FUNC_1 */
+		qcom,master-en = <1>;	/* Enable GPIO */
+	};
+
+	gpio@c100 { /* GPIO 2 */
+		qcom,mode = <1>;
+		qcom,output-type = <0>;
+		qcom,pull = <5>;
+		qcom,vin-sel = <3>;
+		qcom,out-strength = <3>;
+		qcom,src-sel = <2>;
+		qcom,master-en = <1>;
+	};
+
+	gpio@c200 { /* GPIO 3 */
+		qcom,mode = <0>;		/* QPNP_PIN_MODE_DIG_IN */
+		qcom,pull = <5>;		/* QPNP_PIN_PULL_NO */
+		qcom,vin-sel = <2>;		/* QPNP_PIN_VIN2 */
+		qcom,src-sel = <2>;		/* QPNP_PIN_SEL_FUNC_1 */
+		qcom,master-en = <1>;
+	};
+
+	gpio@c300 { /* GPIO 4 */
+	};
+
+	gpio@c400 { /* GPIO 5 */
+	};
+
+	gpio@c500 { /* GPIO 6 */
+	};
+
+	gpio@c600 { /* GPIO 7 */
+	};
+
+	gpio@c700 { /* GPIO 8 */
+	};
+};
+
+&pm8226_mpps {
+	mpp@a000 { /* MPP 1 */
+	};
+
+	mpp@a100 { /* MPP 2 */
+	};
+
+	mpp@a200 { /* MPP 3 */
+	};
+
+	mpp@a300 { /* MPP 4 */
+	};
+
+	mpp@a400 { /* MPP 5 */
+		/* PA_THERM0 config */
+		qcom,mode = <4>; /* AIN input */
+		qcom,invert = <1>; /* Enable MPP */
+		qcom,ain-route = <0>; /* AMUX 5 */
+		qcom,master-en = <1>;
+		qcom,src-sel = <0>; /* Function constant */
+	};
+
+	mpp@a500 { /* MPP 6 */
+	};
+
+	mpp@a600 { /* MPP 7 */
+	};
+
+	mpp@a700 { /* MPP 8 */
+		/* PA_THERM1 config */
+		qcom,mode = <4>; /* AIN input */
+		qcom,invert = <1>; /* Enable MPP */
+		qcom,ain-route = <3>; /* AMUX 8 */
+		qcom,master-en = <1>;
+		qcom,src-sel = <0>; /* Function constant */
+	};
+};
+
+&pm8226_vadc {
+	chan@14 {
+		label = "pa_therm0";
+		reg = <0x14>;
+		qcom,decimation = <0>;
+		qcom,pre-div-channel-scaling = <0>;
+		qcom,calibration-type = "ratiometric";
+		qcom,scale-function = <2>;
+		qcom,hw-settle-time = <2>;
+		qcom,fast-avg-setup = <0>;
+	};
+
+	chan@17 {
+		label = "pa_therm1";
+		reg = <0x17>;
+		qcom,decimation = <0>;
+		qcom,pre-div-channel-scaling = <0>;
+		qcom,calibration-type = "ratiometric";
+		qcom,scale-function = <2>;
+		qcom,hw-settle-time = <2>;
+		qcom,fast-avg-setup = <0>;
+	};
+};
+
+/ {
+	mtp_batterydata: qcom,battery-data {
+		qcom,rpull-up-kohm = <100>;
+		qcom,vref-batt-therm = <1800000>;
+
+		/include/ "batterydata-palladium.dtsi"
+		/include/ "batterydata-mtp-3000mah.dtsi"
+	};
+};
+
+&pm8226_bms {
+	status = "ok";
+	qcom,battery-data = <&mtp_batterydata>;
+	qcom,enable-fcc-learning;
+	qcom,min-fcc-learning-soc = <20>;
+	qcom,min-fcc-ocv-pc = <30>;
+	qcom,min-fcc-learning-samples = <5>;
+	qcom,fcc-resolution = <10>;
+};
+
+&pm8226_chg {
+	qcom,charging-disabled;
+	qcom,battery-data = <&mtp_batterydata>;
+};
+
+&slim_msm {
+	tapan_codec {
+		qcom,cdc-micbias1-ext-cap;
+	};
+};
+
+&mdss_mdp {
+	qcom,mdss-pref-prim-intf = "dsi";
+};
+
+&mdss_dsi0 {
+	qcom,dsi-pref-prim-pan = <&dsi_jdi_1080_vid>;
+	qcom,platform-enable-gpio = <&msmgpio 109 0>;
+};
+
+&dsi_jdi_1080_vid {
+	qcom,cont-splash-enabled;
+};
diff --git a/arch/arm/boot/dts/msm8226-cdp.dtsi b/arch/arm/boot/dts/msm8226-720p-cdp.dtsi
similarity index 100%
rename from arch/arm/boot/dts/msm8226-cdp.dtsi
rename to arch/arm/boot/dts/msm8226-720p-cdp.dtsi
diff --git a/arch/arm/boot/dts/msm8226-mtp.dtsi b/arch/arm/boot/dts/msm8226-720p-mtp.dtsi
similarity index 100%
rename from arch/arm/boot/dts/msm8226-mtp.dtsi
rename to arch/arm/boot/dts/msm8226-720p-mtp.dtsi
diff --git a/arch/arm/boot/dts/msm8226-bus.dtsi b/arch/arm/boot/dts/msm8226-bus.dtsi
index d87aa3e..74b4a30 100644
--- a/arch/arm/boot/dts/msm8226-bus.dtsi
+++ b/arch/arm/boot/dts/msm8226-bus.dtsi
@@ -78,7 +78,7 @@
 		mas-vfe {
 			cell-id = <29>;
 			label = "mas-vfe";
-			qcom,masterp = <16>;
+			qcom,masterp = <7>;
 			qcom,tier = <2>;
 			qcom,hw-sel = "NoC";
 			qcom,perm-mode = "Bypass";
diff --git a/arch/arm/boot/dts/msm8226-mdss-panels.dtsi b/arch/arm/boot/dts/msm8226-mdss-panels.dtsi
index eeec175..0731a9a 100644
--- a/arch/arm/boot/dts/msm8226-mdss-panels.dtsi
+++ b/arch/arm/boot/dts/msm8226-mdss-panels.dtsi
@@ -16,3 +16,4 @@
 /include/ "dsi-panel-nt35596-1080p-video.dtsi"
 /include/ "dsi-panel-nt35590-720p-cmd.dtsi"
 /include/ "dsi-panel-ssd2080m-720p-video.dtsi"
+/include/ "dsi-panel-jdi-1080p-video.dtsi"
diff --git a/arch/arm/boot/dts/msm8226-qrd-skuf.dtsi b/arch/arm/boot/dts/msm8226-qrd-skuf.dtsi
index 66f5095..76bd262 100755
--- a/arch/arm/boot/dts/msm8226-qrd-skuf.dtsi
+++ b/arch/arm/boot/dts/msm8226-qrd-skuf.dtsi
@@ -124,6 +124,7 @@
 				20 21 22 24 26 28 29 2A FF FF
 				FF FF FF FF FF FF FF FF FF FF
 				FF FF FF FF 3E 01];
+			goodix,fw_name = "gtp_fw.bin";
 		};
 	};
 };
diff --git a/arch/arm/boot/dts/msm8226-regulator.dtsi b/arch/arm/boot/dts/msm8226-regulator.dtsi
index 23a2158..9764982 100644
--- a/arch/arm/boot/dts/msm8226-regulator.dtsi
+++ b/arch/arm/boot/dts/msm8226-regulator.dtsi
@@ -336,7 +336,7 @@
 		pm8226_l16: regulator-l16 {
 			regulator-name = "8226_l16";
 			regulator-min-microvolt = <3000000>;
-			regulator-max-microvolt = <3300000>;
+			regulator-max-microvolt = <3350000>;
 			qcom,init-voltage = <3300000>;
 			status = "okay";
 		};
@@ -423,7 +423,7 @@
 		pm8226_l24: regulator-l24 {
 			regulator-name = "8226_l24";
 			regulator-min-microvolt = <1300000>;
-			regulator-max-microvolt = <1300000>;
+			regulator-max-microvolt = <1350000>;
 			qcom,init-voltage = <1300000>;
 			status = "okay";
 		};
diff --git a/arch/arm/boot/dts/msm8226-v1-cdp.dts b/arch/arm/boot/dts/msm8226-v1-cdp.dts
index e426a97..4b8cafd 100644
--- a/arch/arm/boot/dts/msm8226-v1-cdp.dts
+++ b/arch/arm/boot/dts/msm8226-v1-cdp.dts
@@ -12,7 +12,7 @@
 
 /dts-v1/;
 /include/ "msm8226-v1.dtsi"
-/include/ "msm8226-cdp.dtsi"
+/include/ "msm8226-720p-cdp.dtsi"
 
 / {
 	model = "Qualcomm MSM 8226 CDP";
diff --git a/arch/arm/boot/dts/msm8226-v1-mtp.dts b/arch/arm/boot/dts/msm8226-v1-mtp.dts
index 08d7cec..a1e78b7 100644
--- a/arch/arm/boot/dts/msm8226-v1-mtp.dts
+++ b/arch/arm/boot/dts/msm8226-v1-mtp.dts
@@ -12,7 +12,7 @@
 
 /dts-v1/;
 /include/ "msm8226-v1.dtsi"
-/include/ "msm8226-mtp.dtsi"
+/include/ "msm8226-720p-mtp.dtsi"
 
 / {
 	model = "Qualcomm MSM 8226 MTP";
diff --git a/arch/arm/boot/dts/msm8226-v2-cdp.dts b/arch/arm/boot/dts/msm8226-v2-1080p-cdp.dts
similarity index 92%
copy from arch/arm/boot/dts/msm8226-v2-cdp.dts
copy to arch/arm/boot/dts/msm8226-v2-1080p-cdp.dts
index 3302d26..77cc08c 100644
--- a/arch/arm/boot/dts/msm8226-v2-cdp.dts
+++ b/arch/arm/boot/dts/msm8226-v2-1080p-cdp.dts
@@ -12,13 +12,13 @@
 
 /dts-v1/;
 /include/ "msm8226-v2.dtsi"
-/include/ "msm8226-cdp.dtsi"
+/include/ "msm8226-1080p-cdp.dtsi"
 /include/ "msm8226-camera-sensor-cdp.dtsi"
 
 / {
 	model = "Qualcomm MSM 8226v2 CDP";
 	compatible = "qcom,msm8226-cdp", "qcom,msm8226", "qcom,cdp";
-	qcom,board-id = <1 0>;
+	qcom,board-id = <1 2>;
 };
 
 &hsic_host {
diff --git a/arch/arm/boot/dts/msm8226-v2-mtp.dts b/arch/arm/boot/dts/msm8226-v2-1080p-mtp.dts
similarity index 92%
copy from arch/arm/boot/dts/msm8226-v2-mtp.dts
copy to arch/arm/boot/dts/msm8226-v2-1080p-mtp.dts
index 6034107..b12a77d 100644
--- a/arch/arm/boot/dts/msm8226-v2-mtp.dts
+++ b/arch/arm/boot/dts/msm8226-v2-1080p-mtp.dts
@@ -12,11 +12,11 @@
 
 /dts-v1/;
 /include/ "msm8226-v2.dtsi"
-/include/ "msm8226-mtp.dtsi"
+/include/ "msm8226-1080p-mtp.dtsi"
 /include/ "msm8226-camera-sensor-mtp.dtsi"
 
 / {
 	model = "Qualcomm MSM 8226v2 MTP";
 	compatible = "qcom,msm8226-mtp", "qcom,msm8226", "qcom,mtp";
-	qcom,board-id = <8 0>;
+	qcom,board-id = <8 2>;
 };
diff --git a/arch/arm/boot/dts/msm8226-v2-cdp.dts b/arch/arm/boot/dts/msm8226-v2-720p-cdp.dts
similarity index 95%
rename from arch/arm/boot/dts/msm8226-v2-cdp.dts
rename to arch/arm/boot/dts/msm8226-v2-720p-cdp.dts
index 3302d26..966ae2b 100644
--- a/arch/arm/boot/dts/msm8226-v2-cdp.dts
+++ b/arch/arm/boot/dts/msm8226-v2-720p-cdp.dts
@@ -12,7 +12,7 @@
 
 /dts-v1/;
 /include/ "msm8226-v2.dtsi"
-/include/ "msm8226-cdp.dtsi"
+/include/ "msm8226-720p-cdp.dtsi"
 /include/ "msm8226-camera-sensor-cdp.dtsi"
 
 / {
diff --git a/arch/arm/boot/dts/msm8226-v2-mtp.dts b/arch/arm/boot/dts/msm8226-v2-720p-mtp.dts
similarity index 95%
rename from arch/arm/boot/dts/msm8226-v2-mtp.dts
rename to arch/arm/boot/dts/msm8226-v2-720p-mtp.dts
index 6034107..0768b75 100644
--- a/arch/arm/boot/dts/msm8226-v2-mtp.dts
+++ b/arch/arm/boot/dts/msm8226-v2-720p-mtp.dts
@@ -12,7 +12,7 @@
 
 /dts-v1/;
 /include/ "msm8226-v2.dtsi"
-/include/ "msm8226-mtp.dtsi"
+/include/ "msm8226-720p-mtp.dtsi"
 /include/ "msm8226-camera-sensor-mtp.dtsi"
 
 / {
diff --git a/arch/arm/boot/dts/msm8226.dtsi b/arch/arm/boot/dts/msm8226.dtsi
index 151b508..abe5ff3 100644
--- a/arch/arm/boot/dts/msm8226.dtsi
+++ b/arch/arm/boot/dts/msm8226.dtsi
@@ -183,8 +183,8 @@
 			<268000 348000>,
 			<505000 657000>;
 		qcom,buffer-type-tz-usage-table = <0x1 0x1>,
-			<0x2 0x2>,
-			<0x1f0 0x3>;
+			<0x6 0x2>,
+			<0x7C0 0x3>;
 		qcom,max-hw-load = <352800>; /* 720p @ 30 + 1080p @ 30 */
 		qcom,vidc-iommu-domains {
 			qcom,domain-ns {
diff --git a/arch/arm/boot/dts/msm8610-cdp.dtsi b/arch/arm/boot/dts/msm8610-cdp.dtsi
index 9920f77..d63c6e5 100644
--- a/arch/arm/boot/dts/msm8610-cdp.dtsi
+++ b/arch/arm/boot/dts/msm8610-cdp.dtsi
@@ -20,7 +20,7 @@
 		compatible = "atmel,mxt-ts";
 		reg = <0x4a>;
 		interrupt-parent = <&msmgpio>;
-		interrupts = <1 0x2>;
+		interrupts = <1 0x2002>;
 		vdd_ana-supply = <&pm8110_l19>;
 		vcc_i2c-supply = <&pm8110_l14>;
 		atmel,reset-gpio = <&msmgpio 0 0x00>;
@@ -76,6 +76,21 @@
 				];
 			};
 		};
+
+		synaptics@20 {
+			compatible = "synaptics,rmi4";
+			reg = <0x20>;
+			interrupt-parent = <&msmgpio>;
+			interrupts = <1 0x2002>;
+			vdd-supply = <&pm8110_l19>;
+			vcc_i2c-supply = <&pm8110_l14>;
+			synaptics,reset-gpio = <&msmgpio 0 0x00>;
+			synaptics,irq-gpio = <&msmgpio 1 0x2008>;
+			synaptics,button-map = <139 102 158>;
+			synaptics,i2c-pull-up;
+			synaptics,power-down;
+			synaptics,disable-gpios;
+		};
 	};
 
 	gen-vkeys {
diff --git a/arch/arm/boot/dts/msm8610-mtp.dtsi b/arch/arm/boot/dts/msm8610-mtp.dtsi
index 0244b89..6ce0109 100644
--- a/arch/arm/boot/dts/msm8610-mtp.dtsi
+++ b/arch/arm/boot/dts/msm8610-mtp.dtsi
@@ -20,7 +20,7 @@
 		compatible = "atmel,mxt-ts";
 		reg = <0x4a>;
 		interrupt-parent = <&msmgpio>;
-		interrupts = <1 0x2>;
+		interrupts = <1 0x2002>;
 		vdd_ana-supply = <&pm8110_l19>;
 		vcc_i2c-supply = <&pm8110_l14>;
 		atmel,reset-gpio = <&msmgpio 0 0x00>;
@@ -76,6 +76,21 @@
 				];
 			};
 		};
+
+		synaptics@20 {
+			compatible = "synaptics,rmi4";
+			reg = <0x20>;
+			interrupt-parent = <&msmgpio>;
+			interrupts = <1 0x2002>;
+			vdd-supply = <&pm8110_l19>;
+			vcc_i2c-supply = <&pm8110_l14>;
+			synaptics,reset-gpio = <&msmgpio 0 0x00>;
+			synaptics,irq-gpio = <&msmgpio 1 0x2008>;
+			synaptics,button-map = <139 102 158>;
+			synaptics,i2c-pull-up;
+			synaptics,power-down;
+			synaptics,disable-gpios;
+		};
 	};
 
 	i2c@f9925000 {
diff --git a/arch/arm/boot/dts/msm8610-qrd-skuaa.dtsi b/arch/arm/boot/dts/msm8610-qrd-skuaa.dtsi
index 86f1210..bb866b2 100644
--- a/arch/arm/boot/dts/msm8610-qrd-skuaa.dtsi
+++ b/arch/arm/boot/dts/msm8610-qrd-skuaa.dtsi
@@ -32,6 +32,21 @@
 		qcom,hsusb-otg-phy-init-seq =
 		<0x44 0x80 0x6a 0x81 0x34 0x82 0x13 0x83 0xffffffff>;
 	};
+
+	i2c@f9925000 { /* BLSP-1 QUP-3 */
+		nfc-nci@e {
+			compatible = "qcom,nfc-nci";
+			reg = <0x0e>;
+			qcom,irq-gpio = <&msmgpio 77 0x00>;
+			qcom,dis-gpio = <&msmgpio 93 0x00>;
+			qcom,clk-en-gpio = <&msmgpio 78 0x00>;
+			qcom,clk-src = "GPCLK";
+			interrupt-parent = <&msmgpio>;
+			interrupts = <77 0>;
+			qcom,clk-gpio = <&msmgpio 75 0x00>;
+			vlogic-supply = <&pm8110_l14>;
+		};
+	};
 };
 
 / {
@@ -41,6 +56,7 @@
 
 		/include/ "batterydata-qrd-4v2-1300mah.dtsi"
 	};
+
 };
 
 &pm8110_bms {
@@ -70,3 +86,13 @@
 &dsi_hx8379a_wvga_vid {
 	qcom,cont-splash-enabled;
 };
+
+&pm8110_gpios {
+	gpio@c000 { /* GPIO 1 */
+		qcom,mode = <0>;		/* QPNP_PIN_MODE_DIG_IN */
+		qcom,pull = <5>;		/* QPNP_PIN_PULL_NO */
+		qcom,vin-sel = <2>;		/* QPNP_PIN_VIN2 */
+		qcom,src-sel = <2>;		/* QPNP_PIN_SEL_FUNC_1 */
+		qcom,master-en = <1>;
+	};
+};
diff --git a/arch/arm/boot/dts/msm8610-qrd-skuab.dtsi b/arch/arm/boot/dts/msm8610-qrd-skuab.dtsi
index 08e9be5..a22958a 100644
--- a/arch/arm/boot/dts/msm8610-qrd-skuab.dtsi
+++ b/arch/arm/boot/dts/msm8610-qrd-skuab.dtsi
@@ -67,6 +67,7 @@
 			goodix,display-coords = <0 0 540 960>;
 			goodix,button-map= <139 102 158>;
 			goodix,product-id = "915";
+			goodix,enable-power-off;
 			goodix,cfg-data0 = [
 				46 1C 02 C0 03 0A 05 11 01 08
 				14 3B 46 32 03 05 00 00 00 00
diff --git a/arch/arm/boot/dts/msm8610-qrd.dtsi b/arch/arm/boot/dts/msm8610-qrd.dtsi
index d578ef6..85bd746 100644
--- a/arch/arm/boot/dts/msm8610-qrd.dtsi
+++ b/arch/arm/boot/dts/msm8610-qrd.dtsi
@@ -210,8 +210,9 @@
 			status = "okay";
 			qcom,led_mpp_2 {
 				label = "mpp";
-				linux,name = "wled-homerow";
-				linux-default-trigger = "hr-trigger";
+				linux,name = "button-backlight";
+				linux,default-trigger = "hr-trigger";
+				qcom,current-setting = <20>;
 				qcom,default-state = "off";
 				qcom,max-current = <40>;
 				qcom,id = <6>;
@@ -287,7 +288,7 @@
 	qcom,pad-drv-on = <0x4 0x4 0x4>; /* 10mA, 10mA, 10mA */
 	qcom,pad-drv-off = <0x0 0x0 0x0>; /* 2mA, 2mA, 2mA */
 
-	qcom,clk-rates = <400000 25000000 50000000 100000000 200000000>;
+	qcom,clk-rates = <400000 25000000 50000000>;
 
 	#address-cells = <0>;
 	interrupt-parent = <&sdhc_2>;
@@ -308,6 +309,7 @@
 
 	qcom,chgr@1000 {
 		status = "ok";
+		qcom,tchg-mins = <250>;
 	};
 
 	qcom,buck@1100 {
diff --git a/arch/arm/boot/dts/msm8610-regulator.dtsi b/arch/arm/boot/dts/msm8610-regulator.dtsi
index f97d991..7eb6a22 100644
--- a/arch/arm/boot/dts/msm8610-regulator.dtsi
+++ b/arch/arm/boot/dts/msm8610-regulator.dtsi
@@ -215,7 +215,7 @@
 		status = "okay";
 		pm8110_l5: regulator-l5 {
 			regulator-min-microvolt = <1300000>;
-			regulator-max-microvolt = <1300000>;
+			regulator-max-microvolt = <1350000>;
 			qcom,init-voltage = <1300000>;
 			status = "okay";
 		};
@@ -325,7 +325,7 @@
 		status = "okay";
 		pm8110_l16: regulator-l16 {
 			regulator-min-microvolt = <3000000>;
-			regulator-max-microvolt = <3000000>;
+			regulator-max-microvolt = <3350000>;
 			qcom,init-voltage = <3000000>;
 			status = "okay";
 		};
diff --git a/arch/arm/boot/dts/msm8610.dtsi b/arch/arm/boot/dts/msm8610.dtsi
index f6ced20..133757a 100644
--- a/arch/arm/boot/dts/msm8610.dtsi
+++ b/arch/arm/boot/dts/msm8610.dtsi
@@ -182,7 +182,7 @@
 		compatible = "qcom,msm-vidc";
 		qcom,vidc-ns-map = <0x40000000 0x40000000>;
 		qcom,buffer-type-tz-usage-map = <0x1 0x1>,
-						<0x1fe 0x2>;
+						<0x7fe 0x2>;
 		qcom,hfi = "q6";
 		qcom,max-hw-load = <244800>; /* 1080p @ 30 * 1 */
 		qcom,vidc-iommu-domains {
diff --git a/arch/arm/boot/dts/msm8926-cdp.dts b/arch/arm/boot/dts/msm8926-1080p-cdp.dts
similarity index 93%
copy from arch/arm/boot/dts/msm8926-cdp.dts
copy to arch/arm/boot/dts/msm8926-1080p-cdp.dts
index d6e70e6..33e484a 100644
--- a/arch/arm/boot/dts/msm8926-cdp.dts
+++ b/arch/arm/boot/dts/msm8926-1080p-cdp.dts
@@ -13,13 +13,13 @@
 
 /dts-v1/;
 /include/ "msm8926.dtsi"
-/include/ "msm8226-cdp.dtsi"
+/include/ "msm8226-1080p-cdp.dtsi"
 /include/ "msm8226-camera-sensor-cdp.dtsi"
 
 / {
 	model = "Qualcomm MSM 8926 CDP";
 	compatible = "qcom,msm8926-cdp", "qcom,msm8926", "qcom,cdp";
-	qcom,board-id = <1 0>;
+	qcom,board-id = <1 2>;
 };
 
 &pm8226_chg {
diff --git a/arch/arm/boot/dts/msm8926-mtp.dts b/arch/arm/boot/dts/msm8926-1080p-mtp.dts
similarity index 92%
copy from arch/arm/boot/dts/msm8926-mtp.dts
copy to arch/arm/boot/dts/msm8926-1080p-mtp.dts
index 624781b..c1217a2 100644
--- a/arch/arm/boot/dts/msm8926-mtp.dts
+++ b/arch/arm/boot/dts/msm8926-1080p-mtp.dts
@@ -13,11 +13,11 @@
 
 /dts-v1/;
 /include/ "msm8926.dtsi"
-/include/ "msm8226-mtp.dtsi"
+/include/ "msm8226-1080p-mtp.dtsi"
 /include/ "msm8226-camera-sensor-mtp.dtsi"
 
 / {
 	model = "Qualcomm MSM 8926 MTP";
 	compatible = "qcom,msm8926-mtp", "qcom,msm8926", "qcom,mtp";
-	qcom,board-id = <8 0>;
+	qcom,board-id = <8 2>;
 };
diff --git a/arch/arm/boot/dts/msm8926-cdp.dts b/arch/arm/boot/dts/msm8926-720p-cdp.dts
similarity index 96%
rename from arch/arm/boot/dts/msm8926-cdp.dts
rename to arch/arm/boot/dts/msm8926-720p-cdp.dts
index d6e70e6..80bb5e6 100644
--- a/arch/arm/boot/dts/msm8926-cdp.dts
+++ b/arch/arm/boot/dts/msm8926-720p-cdp.dts
@@ -13,7 +13,7 @@
 
 /dts-v1/;
 /include/ "msm8926.dtsi"
-/include/ "msm8226-cdp.dtsi"
+/include/ "msm8226-720p-cdp.dtsi"
 /include/ "msm8226-camera-sensor-cdp.dtsi"
 
 / {
diff --git a/arch/arm/boot/dts/msm8926-mtp.dts b/arch/arm/boot/dts/msm8926-720p-mtp.dts
similarity index 95%
rename from arch/arm/boot/dts/msm8926-mtp.dts
rename to arch/arm/boot/dts/msm8926-720p-mtp.dts
index 624781b..32301fd 100644
--- a/arch/arm/boot/dts/msm8926-mtp.dts
+++ b/arch/arm/boot/dts/msm8926-720p-mtp.dts
@@ -13,7 +13,7 @@
 
 /dts-v1/;
 /include/ "msm8926.dtsi"
-/include/ "msm8226-mtp.dtsi"
+/include/ "msm8226-720p-mtp.dtsi"
 /include/ "msm8226-camera-sensor-mtp.dtsi"
 
 / {
diff --git a/arch/arm/boot/dts/msm8974-regulator.dtsi b/arch/arm/boot/dts/msm8974-regulator.dtsi
index 344c26f..9b9202e 100644
--- a/arch/arm/boot/dts/msm8974-regulator.dtsi
+++ b/arch/arm/boot/dts/msm8974-regulator.dtsi
@@ -289,7 +289,7 @@
 		status = "okay";
 		pm8941_l11: regulator-l11 {
 			regulator-min-microvolt = <1300000>;
-			regulator-max-microvolt = <1300000>;
+			regulator-max-microvolt = <1350000>;
 			qcom,init-voltage = <1300000>;
 			status = "okay";
 		};
@@ -376,7 +376,7 @@
 		status = "okay";
 		pm8941_l19: regulator-l19 {
 			regulator-min-microvolt = <2900000>;
-			regulator-max-microvolt = <3300000>;
+			regulator-max-microvolt = <3350000>;
 			qcom,init-voltage = <2900000>;
 			status = "okay";
 		};
diff --git a/arch/arm/boot/dts/msm8974-v1.dtsi b/arch/arm/boot/dts/msm8974-v1.dtsi
index 249c963..556e912 100644
--- a/arch/arm/boot/dts/msm8974-v1.dtsi
+++ b/arch/arm/boot/dts/msm8974-v1.dtsi
@@ -134,7 +134,7 @@
 	qcom,iommu-groups = <&venus_domain_ns &venus_domain_cp>;
 	qcom,iommu-group-buffer-types = <0xfff 0x1ff>;
 	qcom,buffer-type-tz-usage-table = <0x1 0x1>,
-					<0x1fe 0x2>;
+					<0x7fe 0x2>;
 };
 
 &sfpb_spinlock {
diff --git a/arch/arm/boot/dts/msm8974-v2.dtsi b/arch/arm/boot/dts/msm8974-v2.dtsi
index 55e18f0..0da5658 100644
--- a/arch/arm/boot/dts/msm8974-v2.dtsi
+++ b/arch/arm/boot/dts/msm8974-v2.dtsi
@@ -136,9 +136,9 @@
 		<3240000 1600000>,
 		<4048000 1600000>,
 		<4264000 1600000>;
-	qcom,buffer-type-tz-usage-table = <0x91 0x1>,
-					<0x42 0x2>,
-					<0x120 0x3>;
+	qcom,buffer-type-tz-usage-table = <0x241 0x1>,
+					<0x106 0x2>,
+					<0x480 0x3>;
 	qcom,vidc-iommu-domains {
 		qcom,domain-ns {
 			qcom,vidc-domain-phandle = <&venus_domain_ns>;
diff --git a/arch/arm/boot/dts/msm8974.dtsi b/arch/arm/boot/dts/msm8974.dtsi
index 999fff2..e612df7 100644
--- a/arch/arm/boot/dts/msm8974.dtsi
+++ b/arch/arm/boot/dts/msm8974.dtsi
@@ -600,7 +600,7 @@
 		#size-cells = <0>;
 		reg-names = "spi_physical", "spi_bam_physical";
 		reg = <0xf9966000 0x1000>,
-		      <0xf9944000 0x15000>;
+		      <0xf9944000 0x19000>;
 		interrupt-names = "spi_irq", "spi_bam_irq";
 		interrupts = <0 104 0>, <0 239 0>;
 		spi-max-frequency = <19200000>;
@@ -741,6 +741,14 @@
 	sound {
 		compatible = "qcom,msm8974-audio-taiko";
 		qcom,model = "msm8974-taiko-snd-card";
+		reg = <0xfe02b000 0x4>,
+		      <0xfe02c000 0x4>,
+		      <0xfe02d000 0x4>,
+		      <0xfe02e000 0x4>;
+		reg-names = "lpaif_pri_mode_muxsel",
+			    "lpaif_sec_mode_muxsel",
+			    "lpaif_tert_mode_muxsel",
+			    "lpaif_quat_mode_muxsel";
 
 		qcom,audio-routing =
 			"RX_BIAS", "MCLK",
@@ -847,7 +855,7 @@
 		#size-cells = <0>;
 		reg-names = "spi_physical", "spi_bam_physical";
 		reg = <0xf9923000 0x1000>,
-		      <0xf9904000 0xf000>;
+		      <0xf9904000 0x19000>;
 		interrupt-names = "spi_irq", "spi_bam_irq";
 		interrupts = <0 95 0>, <0 238 0>;
 		spi-max-frequency = <19200000>;
diff --git a/arch/arm/boot/dts/msm8974pro-pm8941.dtsi b/arch/arm/boot/dts/msm8974pro-pm8941.dtsi
index 0f37584..2c06c3c 100644
--- a/arch/arm/boot/dts/msm8974pro-pm8941.dtsi
+++ b/arch/arm/boot/dts/msm8974pro-pm8941.dtsi
@@ -38,18 +38,22 @@
 
 &krait0_vreg {
 		regulator-max-microvolt = <1120000>;
+		qcom,ldo-delta-voltage = <25000>;
 };
 
 &krait1_vreg {
 		regulator-max-microvolt = <1120000>;
+		qcom,ldo-delta-voltage = <25000>;
 };
 
 &krait2_vreg {
 		regulator-max-microvolt = <1120000>;
+		qcom,ldo-delta-voltage = <25000>;
 };
 
 &krait3_vreg {
 		regulator-max-microvolt = <1120000>;
+		qcom,ldo-delta-voltage = <25000>;
 };
 
 &tspp {
diff --git a/arch/arm/boot/dts/msm8974pro-pma8084-regulator.dtsi b/arch/arm/boot/dts/msm8974pro-pma8084-regulator.dtsi
index df00f8a..00e3b8b 100644
--- a/arch/arm/boot/dts/msm8974pro-pma8084-regulator.dtsi
+++ b/arch/arm/boot/dts/msm8974pro-pma8084-regulator.dtsi
@@ -494,7 +494,7 @@
 			qcom,retention-voltage = <675000>;
 			qcom,ldo-default-voltage = <750000>;
 			qcom,ldo-threshold-voltage = <850000>;
-			qcom,ldo-delta-voltage = <50000>;
+			qcom,ldo-delta-voltage = <25000>;
 			qcom,cpu-num = <0>;
 		};
 
@@ -510,7 +510,7 @@
 			qcom,retention-voltage = <675000>;
 			qcom,ldo-default-voltage = <750000>;
 			qcom,ldo-threshold-voltage = <850000>;
-			qcom,ldo-delta-voltage = <50000>;
+			qcom,ldo-delta-voltage = <25000>;
 			qcom,cpu-num = <1>;
 		};
 
@@ -526,7 +526,7 @@
 			qcom,retention-voltage = <675000>;
 			qcom,ldo-default-voltage = <750000>;
 			qcom,ldo-threshold-voltage = <850000>;
-			qcom,ldo-delta-voltage = <50000>;
+			qcom,ldo-delta-voltage = <25000>;
 			qcom,cpu-num = <2>;
 		};
 
@@ -542,7 +542,7 @@
 			qcom,retention-voltage = <675000>;
 			qcom,ldo-default-voltage = <750000>;
 			qcom,ldo-threshold-voltage = <850000>;
-			qcom,ldo-delta-voltage = <50000>;
+			qcom,ldo-delta-voltage = <25000>;
 			qcom,cpu-num = <3>;
 		};
 	};
diff --git a/arch/arm/boot/dts/msm8974pro.dtsi b/arch/arm/boot/dts/msm8974pro.dtsi
index bd58653..174cee6 100644
--- a/arch/arm/boot/dts/msm8974pro.dtsi
+++ b/arch/arm/boot/dts/msm8974pro.dtsi
@@ -39,6 +39,17 @@
 		/delete-property/ qcom,pmic-sw-mode-temp-hysteresis;
 		/delete-property/ qcom,pmic-sw-mode-regs;
 	};
+
+	sound {
+		reg = <0xfe02c000 0x4>,
+		      <0xfe02d000 0x4>,
+		      <0xfe02e000 0x4>,
+		      <0xfe02f000 0x4>;
+		reg-names = "lpaif_pri_mode_muxsel",
+			    "lpaif_sec_mode_muxsel",
+			    "lpaif_tert_mode_muxsel",
+			    "lpaif_quat_mode_muxsel";
+	};
 };
 
 /* GPU overrides */
@@ -48,20 +59,29 @@
 
 	qcom,initial-pwrlevel = <6>;
 
+	qcom,msm-bus,num-cases = <10>;
 	/* Updated bus bandwidth requirements */
 	qcom,msm-bus,vectors-KBps =
 		/* Off */
 		<26 512 0 0>, <89 604 0 0>,
 		/* SVS */
-		<26 512 0 2400000>, <89 604 0 3000000>,
+		<26 512 0 2400000>, <89 604 0 3200000>,
 		/* Nominal / SVS */
-		<26 512 0 4656000>, <89 604 0 3000000>,
-		/* Nominal */
-		<26 512 0 4656000>, <89 604 0 5120000>,
-		/* Turbo / Nominal */
-		<26 512 0 7464000>, <89 604 0 5120000>,
+		<26 512 0 3680000>, <89 604 0 3200000>,
+		/* Nominal / Nominal */
+		<26 512 0 3680000>, <89 604 0 5280000>,
+		/* Nominal / Nominal */
+		<26 512 0 4912000>, <89 604 0 5280000>,
+		/* Nominal / Turbo */
+		<26 512 0 4912000>, <89 604 0 6224000>,
+		/* Turbo / Turbo */
+		<26 512 0 7464000>, <89 604 0 6224000>,
+		/* Nominal / Turbo */
+		<26 512 0 4912000>, <89 604 0 7400000>,
 		/* Turbo */
-		<26 512 0 7464000>, <89 604 0 6400000>;
+		<26 512 0 7464000>, <89 604 0 7400000>,
+		/* Turbo */
+		<26 512 0 7464000>, <89 604 0 9248000>;
 
        qcom,gpu-pwrlevels {
                #address-cells = <1>;
@@ -72,35 +92,35 @@
                qcom,gpu-pwrlevel@0 {
                        reg = <0>;
                        qcom,gpu-freq = <578000000>;
-                       qcom,bus-freq = <5>;
+                       qcom,bus-freq = <9>;
                        qcom,io-fraction = <33>;
                };
 
 		qcom,gpu-pwrlevel@1 {
 			reg = <1>;
 			qcom,gpu-freq = <462400000>;
-			qcom,bus-freq = <4>;
+			qcom,bus-freq = <8>;
 			qcom,io-fraction = <33>;
 		};
 
 		qcom,gpu-pwrlevel@2 {
 			reg = <2>;
 			qcom,gpu-freq = <462400000>;
-			qcom,bus-freq = <3>;
+			qcom,bus-freq = <7>;
 			qcom,io-fraction = <66>;
 		};
 
 		qcom,gpu-pwrlevel@3 {
 			reg = <3>;
 			qcom,gpu-freq = <389000000>;
-			qcom,bus-freq = <4>;
+			qcom,bus-freq = <6>;
 			qcom,io-fraction = <66>;
 		};
 
 		qcom,gpu-pwrlevel@4 {
 			reg = <4>;
 			qcom,gpu-freq = <389000000>;
-			qcom,bus-freq = <3>;
+			qcom,bus-freq = <5>;
 			qcom,io-fraction = <66>;
 		};
 
@@ -208,9 +228,9 @@
 		<4048000 1600000>,
 		<4264000 1600000>;
 	qcom,max-hw-load = <1281600>; /* max(4k X 2304 @ 24, 4k X 2160 @ 30) + 1080p @ 30 */
-	qcom,buffer-type-tz-usage-table = <0x91 0x1>,
-					<0x42 0x2>,
-					<0x120 0x3>;
+	qcom,buffer-type-tz-usage-table = <0x241 0x1>,
+					<0x106 0x2>,
+					<0x480 0x3>;
 	qcom,vidc-iommu-domains {
 		qcom,domain-ns {
 			qcom,vidc-domain-phandle = <&venus_domain_ns>;
diff --git a/arch/arm/configs/apq8084_defconfig b/arch/arm/configs/apq8084_defconfig
index 7c1af1a..cda1e59 100644
--- a/arch/arm/configs/apq8084_defconfig
+++ b/arch/arm/configs/apq8084_defconfig
@@ -90,6 +90,7 @@
 CONFIG_AEABI=y
 CONFIG_HIGHMEM=y
 CONFIG_COMPACTION=y
+CONFIG_ENABLE_VMALLOC_SAVING=y
 CONFIG_CC_STACKPROTECTOR=y
 CONFIG_CP_ACCESS=y
 CONFIG_USE_OF=y
diff --git a/arch/arm/configs/msm8226-perf_defconfig b/arch/arm/configs/msm8226-perf_defconfig
index 2f38ebf..818e052 100644
--- a/arch/arm/configs/msm8226-perf_defconfig
+++ b/arch/arm/configs/msm8226-perf_defconfig
@@ -25,6 +25,7 @@
 CONFIG_PANIC_TIMEOUT=5
 CONFIG_KALLSYMS_ALL=y
 CONFIG_EMBEDDED=y
+# CONFIG_SLUB_DEBUG is not set
 CONFIG_PROFILING=y
 CONFIG_OPROFILE=m
 CONFIG_KPROBES=y
@@ -65,7 +66,6 @@
 CONFIG_MSM_OCMEM=y
 CONFIG_MSM_OCMEM_LOCAL_POWER_CTRL=y
 CONFIG_MSM_OCMEM_DEBUG=y
-CONFIG_MSM_OCMEM_NONSECURE=y
 CONFIG_MSM_OCMEM_POWER_DISABLE=y
 CONFIG_SENSORS_ADSP=y
 CONFIG_MSM_RTB=y
@@ -82,6 +82,7 @@
 CONFIG_AEABI=y
 CONFIG_HIGHMEM=y
 CONFIG_COMPACTION=y
+CONFIG_ENABLE_VMALLOC_SAVING=y
 CONFIG_CC_STACKPROTECTOR=y
 CONFIG_CP_ACCESS=y
 CONFIG_USE_OF=y
diff --git a/arch/arm/configs/msm8226_defconfig b/arch/arm/configs/msm8226_defconfig
index 8ca54fd..c1f2ca2 100644
--- a/arch/arm/configs/msm8226_defconfig
+++ b/arch/arm/configs/msm8226_defconfig
@@ -65,7 +65,6 @@
 CONFIG_MSM_OCMEM=y
 CONFIG_MSM_OCMEM_LOCAL_POWER_CTRL=y
 CONFIG_MSM_OCMEM_DEBUG=y
-CONFIG_MSM_OCMEM_NONSECURE=y
 CONFIG_MSM_OCMEM_POWER_DISABLE=y
 CONFIG_SENSORS_ADSP=y
 CONFIG_MSM_RTB=y
@@ -83,6 +82,7 @@
 CONFIG_AEABI=y
 CONFIG_HIGHMEM=y
 CONFIG_COMPACTION=y
+CONFIG_ENABLE_VMALLOC_SAVING=y
 CONFIG_CC_STACKPROTECTOR=y
 CONFIG_CP_ACCESS=y
 CONFIG_USE_OF=y
diff --git a/arch/arm/configs/msm8610-perf_defconfig b/arch/arm/configs/msm8610-perf_defconfig
index 7ea1bd5..efdd8de 100644
--- a/arch/arm/configs/msm8610-perf_defconfig
+++ b/arch/arm/configs/msm8610-perf_defconfig
@@ -82,6 +82,7 @@
 CONFIG_HIGHMEM=y
 CONFIG_COMPACTION=y
 CONFIG_CC_STACKPROTECTOR=y
+CONFIG_ENABLE_VMALLOC_SAVING=y
 CONFIG_CP_ACCESS=y
 CONFIG_USE_OF=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=y
@@ -313,7 +314,6 @@
 CONFIG_MSM_KGSL=y
 CONFIG_KGSL_PER_PROCESS_PAGE_TABLE=y
 CONFIG_FB=y
-CONFIG_FB_VIRTUAL=y
 CONFIG_FB_MSM=y
 # CONFIG_FB_MSM_BACKLIGHT is not set
 CONFIG_FB_MSM_MDSS=y
diff --git a/arch/arm/configs/msm8610_defconfig b/arch/arm/configs/msm8610_defconfig
index 8e6f5f9..c140a46 100644
--- a/arch/arm/configs/msm8610_defconfig
+++ b/arch/arm/configs/msm8610_defconfig
@@ -83,6 +83,7 @@
 CONFIG_HIGHMEM=y
 CONFIG_COMPACTION=y
 CONFIG_CC_STACKPROTECTOR=y
+CONFIG_ENABLE_VMALLOC_SAVING=y
 CONFIG_CP_ACCESS=y
 CONFIG_USE_OF=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=y
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index 87c2f8c..a341c23 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -280,11 +280,11 @@
 	select MEMORY_HOLE_CARVEOUT
 	select MSM_RPM_STATS_LOG
 	select QMI_ENCDEC
-	select DONT_MAP_HOLE_AFTER_MEMBANK0
 	select MSM_ULTRASOUND_B
 	select MSM_RPM_LOG
 	select ARCH_WANT_KMAP_ATOMIC_FLUSH
 	select KRAIT_REGULATOR
+	select ENABLE_VMALLOC_SAVINGS
 
 config ARCH_APQ8084
 	bool "APQ8084"
@@ -305,12 +305,12 @@
 	select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
 	select ARCH_WANT_KMAP_ATOMIC_FLUSH
 	select MEMORY_HOLE_CARVEOUT
-	select DONT_MAP_HOLE_AFTER_MEMBANK0
 	select QMI_ENCDEC
 	select MSM_SPM_V2
 	select MSM_L2_SPM
 	select MSM_PM8X60 if PM
 	select MSM_RPM_SMD
+	select ENABLE_VMALLOC_SAVINGS
 
 config ARCH_MPQ8092
 	bool "MPQ8092"
@@ -460,7 +460,6 @@
 	select MSM_L2_SPM
 	select MSM_PM8X60 if PM
 	select MEMORY_HOLE_CARVEOUT
-	select DONT_MAP_HOLE_AFTER_MEMBANK0
 	select MSM_BUS_SCALING
 	select CPU_FREQ_MSM
 	select CPU_FREQ
@@ -475,6 +474,7 @@
 	select MSM_RPM_LOG
 	select MSM_IOMMU_SYNC
 	select MSM_RPM_STATS_LOG
+	select ENABLE_VMALLOC_SAVINGS
 
 config ARCH_MSM8226
 	bool "MSM8226"
@@ -500,7 +500,6 @@
 	select MSM_L2_SPM
 	select MSM_PM8X60 if PM
 	select MEMORY_HOLE_CARVEOUT
-	select DONT_MAP_HOLE_AFTER_MEMBANK0
 	select MSM_BUS_SCALING
 	select CPU_FREQ_MSM
 	select CPU_FREQ
@@ -515,6 +514,7 @@
 	select MSM_RPM_LOG
 	select MSM_RPM_STATS_LOG
 	select ARCH_WANT_KMAP_ATOMIC_FLUSH
+	select ENABLE_VMALLOC_SAVINGS
 
 config ARCH_MSMSAMARIUM
 	bool "MSMSAMARIUM"
diff --git a/arch/arm/mach-msm/Makefile.boot b/arch/arm/mach-msm/Makefile.boot
index 552ed16..83c1d4c 100644
--- a/arch/arm/mach-msm/Makefile.boot
+++ b/arch/arm/mach-msm/Makefile.boot
@@ -99,28 +99,34 @@
 
 # MSM8226
    zreladdr-$(CONFIG_ARCH_MSM8226)	:= 0x00008000
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-sim.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-fluid.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v1-cdp.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v1-mtp.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v1-qrd-evt.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v1-qrd-dvt.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v2-cdp.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v2-mtp.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v2-qrd-evt.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v2-qrd-dvt.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8926-cdp.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8926-mtp.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8926-qrd.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8926-qrd-skug.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v1-qrd-skuf.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v2-qrd-skuf.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= apq8026-v1-xpm.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= apq8026-v1-cdp.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= apq8026-v1-mtp.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= apq8026-v2-xpm.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= apq8026-v2-cdp.dtb
-        dtb-$(CONFIG_ARCH_MSM8226)	+= apq8026-v2-mtp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-sim.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-fluid.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v1-cdp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v1-mtp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v1-qrd-evt.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v1-qrd-dvt.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v2-720p-cdp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v2-1080p-cdp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v2-720p-mtp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v2-1080p-mtp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v2-qrd-evt.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v2-qrd-dvt.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8926-720p-cdp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8926-1080p-cdp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8926-720p-mtp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8926-1080p-mtp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8926-qrd.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8926-qrd-skug.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v1-qrd-skuf.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= msm8226-v2-qrd-skuf.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= apq8026-v1-xpm.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= apq8026-v1-cdp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= apq8026-v1-mtp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= apq8026-v2-xpm.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= apq8026-v2-720p-cdp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= apq8026-v2-1080p-cdp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= apq8026-v2-720p-mtp.dtb
+	dtb-$(CONFIG_ARCH_MSM8226)	+= apq8026-v2-1080p-mtp.dtb
 
 # FSM9XXX
    zreladdr-$(CONFIG_ARCH_FSM9XXX)	:= 0x10008000
diff --git a/arch/arm/mach-msm/board-8226-gpiomux.c b/arch/arm/mach-msm/board-8226-gpiomux.c
index 4dcbc3a..9767746 100644
--- a/arch/arm/mach-msm/board-8226-gpiomux.c
+++ b/arch/arm/mach-msm/board-8226-gpiomux.c
@@ -185,7 +185,14 @@
 
 static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
 	{
-		.gpio = 25,
+		.gpio = 25,		/* LCD Reset */
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &lcd_rst_act_cfg,
+			[GPIOMUX_SUSPENDED] = &lcd_rst_sus_cfg,
+		},
+	},
+	{
+		.gpio = 109,		/* LCD Enable */
 		.settings = {
 			[GPIOMUX_ACTIVE]    = &lcd_rst_act_cfg,
 			[GPIOMUX_SUSPENDED] = &lcd_rst_sus_cfg,
@@ -303,13 +310,13 @@
 
 static struct gpiomux_setting goodix_ldo_en_sus_cfg = {
 	.func = GPIOMUX_FUNC_GPIO,
-	.drv = GPIOMUX_DRV_6MA,
-	.pull = GPIOMUX_PULL_UP,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_DOWN,
 };
 
 static struct gpiomux_setting goodix_int_act_cfg = {
 	.func = GPIOMUX_FUNC_GPIO,
-	.drv = GPIOMUX_DRV_8MA,
+	.drv = GPIOMUX_DRV_6MA,
 	.pull = GPIOMUX_PULL_UP,
 };
 
@@ -321,14 +328,14 @@
 
 static struct gpiomux_setting goodix_reset_act_cfg = {
 	.func = GPIOMUX_FUNC_GPIO,
-	.drv = GPIOMUX_DRV_8MA,
+	.drv = GPIOMUX_DRV_6MA,
 	.pull = GPIOMUX_PULL_UP,
 };
 
 static struct gpiomux_setting goodix_reset_sus_cfg = {
 	.func = GPIOMUX_FUNC_GPIO,
-	.drv = GPIOMUX_DRV_8MA,
-	.pull = GPIOMUX_PULL_UP,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_DOWN,
 };
 
 static struct msm_gpiomux_config msm_skuf_blsp_configs[] __initdata = {
diff --git a/arch/arm/mach-msm/board-8226.c b/arch/arm/mach-msm/board-8226.c
index aff2d75..5244918 100644
--- a/arch/arm/mach-msm/board-8226.c
+++ b/arch/arm/mach-msm/board-8226.c
@@ -82,6 +82,8 @@
 			"msm_sdcc.2", NULL),
 	OF_DEV_AUXDATA("qcom,sdhci-msm", 0xF9864900, \
 			"msm_sdcc.3", NULL),
+	OF_DEV_AUXDATA("qcom,hsic-host", 0xF9A00000, "msm_hsic_host", NULL),
+
 	{}
 };
 
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c
index e3c11c5..6063302 100644
--- a/arch/arm/mach-msm/clock.c
+++ b/arch/arm/mach-msm/clock.c
@@ -557,7 +557,7 @@
 		return -ENOSYS;
 
 	mutex_lock(&clk->prepare_lock);
-	if (clk->parent == parent)
+	if (clk->parent == parent && !(clk->flags & CLKFLAG_NO_RATE_CACHE))
 		goto out;
 	rc = clk->ops->set_parent(clk, parent);
 	if (!rc)
diff --git a/arch/arm/mach-msm/msm_watchdog_v2.c b/arch/arm/mach-msm/msm_watchdog_v2.c
index 52e94e6..ead2e95 100644
--- a/arch/arm/mach-msm/msm_watchdog_v2.c
+++ b/arch/arm/mach-msm/msm_watchdog_v2.c
@@ -68,7 +68,7 @@
 
 /*
  * On the kernel command line specify
- * msm_watchdog.enable=1 to enable the watchdog
+ * msm_watchdog_v2.enable=1 to enable the watchdog
  * By default watchdog is turned on
  */
 static int enable = 1;
@@ -76,7 +76,7 @@
 
 /*
  * On the kernel command line specify
- * msm_watchdog.WDT_HZ=<clock val in HZ> to set Watchdog
+ * msm_watchdog_v2.WDT_HZ=<clock val in HZ> to set Watchdog
  * ticks. By default it is set to 32765.
  */
 static long WDT_HZ = 32765;
diff --git a/arch/arm/mach-msm/ocmem.c b/arch/arm/mach-msm/ocmem.c
index d31f3c4..99e54b7 100644
--- a/arch/arm/mach-msm/ocmem.c
+++ b/arch/arm/mach-msm/ocmem.c
@@ -836,7 +836,7 @@
 		return -EBUSY;
 
 	if (ocmem_debugfs_init(pdev))
-		return -EBUSY;
+		dev_err(dev, "ocmem: No debugfs node available\n");
 
 	if (ocmem_core_init(pdev))
 		return -EBUSY;
diff --git a/arch/arm/mach-msm/qdsp6v2/audio_lpa.c b/arch/arm/mach-msm/qdsp6v2/audio_lpa.c
index f6dd9fab..afdfd6d 100644
--- a/arch/arm/mach-msm/qdsp6v2/audio_lpa.c
+++ b/arch/arm/mach-msm/qdsp6v2/audio_lpa.c
@@ -921,6 +921,7 @@
 
 	case AUDIO_GET_CONFIG:{
 		struct msm_audio_config config;
+		memset(&config, 0, sizeof(config));
 		config.buffer_count = audio->buffer_count;
 		config.buffer_size = audio->buffer_size;
 		config.sample_rate = audio->out_sample_rate;
diff --git a/arch/arm/mach-msm/qdsp6v2/audio_utils.c b/arch/arm/mach-msm/qdsp6v2/audio_utils.c
index 85af4a7..ccacd3e 100644
--- a/arch/arm/mach-msm/qdsp6v2/audio_utils.c
+++ b/arch/arm/mach-msm/qdsp6v2/audio_utils.c
@@ -99,7 +99,7 @@
 int audio_in_disable(struct q6audio_in  *audio)
 {
 	int rc = 0;
-	if (audio->opened) {
+	if (!audio->stopped) {
 		audio->enabled = 0;
 		audio->opened = 0;
 		pr_debug("%s:session id %d: inbytes[%d] insamples[%d]\n",
diff --git a/arch/arm/mach-msm/qdsp6v2/pcm_out.c b/arch/arm/mach-msm/qdsp6v2/pcm_out.c
index 4097b72..c6ae427 100644
--- a/arch/arm/mach-msm/qdsp6v2/pcm_out.c
+++ b/arch/arm/mach-msm/qdsp6v2/pcm_out.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2009 Google, Inc.
- * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
  * Author: Brian Swetland <swetland@google.com>
  *
  * This software is licensed under the terms of the GNU General Public
@@ -260,6 +260,7 @@
 	case AUDIO_GET_CONFIG: {
 		struct msm_audio_config config;
 		pr_debug("%s: AUDIO_GET_CONFIG\n", __func__);
+		memset(&config, 0, sizeof(config));
 		config.buffer_size = pcm->buffer_size;
 		config.buffer_count = pcm->buffer_count;
 		config.sample_rate = pcm->sample_rate;
diff --git a/arch/arm/mach-msm/sensors_adsp.c b/arch/arm/mach-msm/sensors_adsp.c
index 1534358..fab10b8 100644
--- a/arch/arm/mach-msm/sensors_adsp.c
+++ b/arch/arm/mach-msm/sensors_adsp.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+/* 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
@@ -355,6 +355,7 @@
 	if (temp == NULL) {
 		pr_err("%s: allocation failure\n", __func__);
 		rv = -ENOMEM;
+		goto out;
 	}
 
 	hdr->dst_module = SNS_OCMEM_MODULE_ADSP;
@@ -387,6 +388,7 @@
 
 	kfree(temp);
 
+out:
 	return rv;
 }
 
@@ -874,7 +876,7 @@
 
 	vectors = ocmem_get_vectors(SNS_OCMEM_CLIENT_ID, sns_ctl.buf);
 	if ((vectors != NULL)) {
-		memcpy(&msg.vectors, vectors, sizeof(vectors));
+		memcpy(&msg.vectors, vectors, sizeof(*vectors));
 		/* TODO: set vectors_len */
 		msg.vectors_valid = true;
 		msg.vectors_len = 0;
diff --git a/drivers/char/diag/diag_dci.c b/drivers/char/diag/diag_dci.c
index 97dc26d..91b90a8 100644
--- a/drivers/char/diag/diag_dci.c
+++ b/drivers/char/diag/diag_dci.c
@@ -419,6 +419,8 @@
 
 	/* Notify the DCI process that the peripheral DCI Channel is up */
 	for (i = 0; i < MAX_DCI_CLIENTS; i++) {
+		if (!driver->dci_client_tbl[i].client)
+			continue;
 		if (driver->dci_client_tbl[i].list & peripheral_mask) {
 			info.si_signo = driver->dci_client_tbl[i].signal_type;
 			stat = send_sig_info(
diff --git a/drivers/char/diag/diag_masks.c b/drivers/char/diag/diag_masks.c
index 69e6250..c28b3bd 100644
--- a/drivers/char/diag/diag_masks.c
+++ b/drivers/char/diag/diag_masks.c
@@ -229,83 +229,90 @@
 static void diag_disable_log_mask(void)
 {
 	int i = 0;
-	struct mask_info *parse_ptr = (struct mask_info *)(driver->log_masks);
+	struct diag_log_mask_t *log_item = NULL;
 
-	pr_debug("diag: disable log masks\n");
-	mutex_lock(&driver->diagchar_mutex);
-	for (i = 0; i < MAX_EQUIP_ID; i++) {
-		pr_debug("diag: equip id %d\n", parse_ptr->equip_id);
-		if (!(parse_ptr->equip_id)) /* Reached a null entry */
-			break;
-		memset(driver->log_masks + parse_ptr->index, 0,
-			    (parse_ptr->num_items + 7)/8);
-		parse_ptr++;
-	}
+	mutex_lock(&driver->log_mask_mutex);
+	log_item = (struct diag_log_mask_t *)driver->log_masks;
+	for (i = 0; i < MAX_EQUIP_ID; i++, log_item++)
+		memset(log_item->ptr, 0, MAX_ITEMS_PER_EQUIP_ID);
+
 	driver->log_status = DIAG_CTRL_MASK_ALL_DISABLED;
-	mutex_unlock(&driver->diagchar_mutex);
+	mutex_unlock(&driver->log_mask_mutex);
 }
 
-int chk_equip_id_and_mask(int equip_id, uint8_t *buf)
+static int copy_log_mask_equip(int equip_id, uint8_t *buf)
 {
-	int i = 0, flag = 0, num_items, offset;
-	unsigned char *ptr_data;
-	struct mask_info *ptr = (struct mask_info *)(driver->log_masks);
+	int i, ret = 0;
+	uint8_t *temp = buf;
+	struct diag_log_mask_t *log_item = NULL;
+	uint32_t mask_size = 0;
 
-	pr_debug("diag: received equip id = %d\n", equip_id);
-	/* Check if this is valid equipment ID */
-	for (i = 0; i < MAX_EQUIP_ID; i++) {
-		if ((ptr->equip_id == equip_id) && (ptr->index != 0)) {
-			offset = ptr->index;
-			num_items = ptr->num_items;
-			flag = 1;
+	if (!buf)
+		return ret;
+
+	log_item = (struct diag_log_mask_t *)driver->log_masks;
+	for (i = 0; i < MAX_EQUIP_ID; i++, log_item++) {
+		if (log_item->equip_id != equip_id)
+			continue;
+		*(int *)temp = log_item->equip_id;
+		temp += sizeof(int);
+		*(int *)(temp) = log_item->num_items;
+		temp += sizeof(int);
+		mask_size = LOG_ITEMS_TO_SIZE(log_item->num_items);
+		if (mask_size > MAX_ITEMS_PER_EQUIP_ID) {
+			pr_err("diag: Invalid length: %d in %s, perimissible: %d",
+				mask_size, __func__, MAX_ITEMS_PER_EQUIP_ID);
 			break;
 		}
-		ptr++;
+		if (mask_size > 0) {
+			memcpy(temp, log_item->ptr, mask_size);
+			/*
+			 * Return the total number of bytes copied = size of
+			 * equip_id (int) + size of num_items (int) + mask_size
+			 */
+			ret = (2 * sizeof(int)) + mask_size;
+		}
+		break;
 	}
-	if (!flag)
-		return -EPERM;
-	ptr_data = driver->log_masks + offset;
-	memcpy(buf, ptr_data, (num_items+7)/8);
-	return 0;
+
+	return ret;
 }
 
 static void diag_update_log_mask(int equip_id, uint8_t *buf, int num_items)
 {
-	uint8_t *temp = buf;
 	int i = 0;
-	unsigned char *ptr_data;
-	int offset = (sizeof(struct mask_info))*MAX_EQUIP_ID;
-	struct mask_info *ptr = (struct mask_info *)(driver->log_masks);
+	struct diag_log_mask_t *log_item = NULL;
+	uint32_t mask_size = 0;
 
-	pr_debug("diag: received equip id = %d\n", equip_id);
-	mutex_lock(&driver->diagchar_mutex);
-	/* Check if we already know index of this equipment ID */
-	for (i = 0; i < MAX_EQUIP_ID; i++) {
-		if ((ptr->equip_id == equip_id) && (ptr->index != 0)) {
-			offset = ptr->index;
-			break;
-		}
-		if ((ptr->equip_id == 0) && (ptr->index == 0)) {
-			/* Reached a null entry */
-			ptr->equip_id = equip_id;
-			ptr->num_items = num_items;
-			ptr->index = driver->log_masks_length;
-			offset = driver->log_masks_length;
-			driver->log_masks_length += ((num_items+7)/8);
-			break;
-		}
-		ptr++;
+	mutex_lock(&driver->log_mask_mutex);
+	driver->log_status = DIAG_CTRL_MASK_INVALID;
+	if (!buf || (equip_id < 0 || equip_id >= MAX_EQUIP_ID) ||
+							num_items < 1) {
+		pr_err("diag: Invalid params in %s, buf: %x equip_id: %d, num_items: %d\n",
+		       __func__, (unsigned int)buf, equip_id, num_items);
+		mutex_unlock(&driver->log_mask_mutex);
+		return;
 	}
-	ptr_data = driver->log_masks + offset;
-	if (CHK_OVERFLOW(driver->log_masks, ptr_data, driver->log_masks
-					 + LOG_MASK_SIZE, (num_items+7)/8)) {
-		memcpy(ptr_data, temp, (num_items+7)/8);
+	mask_size = LOG_ITEMS_TO_SIZE(num_items);
+	if (mask_size > MAX_ITEMS_PER_EQUIP_ID) {
+		pr_err("diag: In %s, Invalid mask_size %d\n", __func__,
+								mask_size);
+		mutex_unlock(&driver->log_mask_mutex);
+		return;
+	}
+
+	log_item = (struct diag_log_mask_t *)driver->log_masks;
+	for (i = 0; i < MAX_EQUIP_ID; i++, log_item++) {
+		if (log_item->equip_id != equip_id)
+			continue;
+		/* Found the equip id */
+		log_item->num_items = num_items;
+		if (mask_size > 0)
+			memcpy(log_item->ptr, buf, mask_size);
 		driver->log_status = DIAG_CTRL_MASK_VALID;
-	} else {
-		pr_err("diag: Not enough buffer space for LOG_MASK\n");
-		driver->log_status = DIAG_CTRL_MASK_INVALID;
+		break;
 	}
-	mutex_unlock(&driver->diagchar_mutex);
+	mutex_unlock(&driver->log_mask_mutex);
 }
 
 void diag_mask_update_fn(struct work_struct *work)
@@ -335,72 +342,76 @@
 void diag_send_log_mask_update(smd_channel_t *ch, int equip_id)
 {
 	void *buf = driver->buf_log_mask_update;
-	int header_size = sizeof(struct diag_ctrl_log_mask);
-	struct mask_info *ptr = (struct mask_info *)driver->log_masks;
-	int i, size, wr_size = -ENOMEM, retry_count = 0;
+	struct diag_log_mask_t *log_item = NULL;
+	struct diag_ctrl_log_mask ctrl_pkt;
+	uint32_t log_mask_size = 0;
+	int wr_size = -ENOMEM, retry_count = 0;
+	int i, header_size, send_once = 0;
 
+	header_size = sizeof(struct diag_ctrl_log_mask);
+	log_item = (struct diag_log_mask_t *)driver->log_masks;
 	mutex_lock(&driver->diag_cntl_mutex);
-	for (i = 0; i < MAX_EQUIP_ID; i++) {
-		size = (ptr->num_items+7)/8;
-		/* reached null entry */
-		if ((ptr->equip_id == 0) && (ptr->index == 0))
-			break;
-		driver->log_mask->cmd_type = DIAG_CTRL_MSG_LOG_MASK;
-		driver->log_mask->num_items = ptr->num_items;
-		driver->log_mask->data_len  = 11 + size;
-		driver->log_mask->stream_id = 1; /* 2, if dual stream */
-		driver->log_mask->equip_id = ptr->equip_id;
-		driver->log_mask->status = driver->log_status;
+	for (i = 0; i < MAX_EQUIP_ID; i++, log_item++) {
+		if (equip_id != i && equip_id != ALL_EQUIP_ID)
+			continue;
+		log_mask_size = LOG_ITEMS_TO_SIZE(log_item->num_items);
+		ctrl_pkt.cmd_type = DIAG_CTRL_MSG_LOG_MASK;
+		ctrl_pkt.data_len = 11 + log_mask_size;
+		ctrl_pkt.stream_id = 1;
+		ctrl_pkt.status = driver->log_status;
 		switch (driver->log_status) {
 		case DIAG_CTRL_MASK_ALL_DISABLED:
-			driver->log_mask->log_mask_size = 0;
+			ctrl_pkt.equip_id = 0;
+			ctrl_pkt.num_items = 0;
+			ctrl_pkt.log_mask_size = 0;
+			send_once = 1;
 			break;
 		case DIAG_CTRL_MASK_ALL_ENABLED:
-			driver->log_mask->log_mask_size = 0;
+			ctrl_pkt.equip_id = 0;
+			ctrl_pkt.num_items = 0;
+			ctrl_pkt.log_mask_size = 0;
+			send_once = 1;
 			break;
 		case DIAG_CTRL_MASK_VALID:
-			driver->log_mask->log_mask_size = size;
+			ctrl_pkt.equip_id = i;
+			ctrl_pkt.num_items = log_item->num_items;
+			ctrl_pkt.log_mask_size = log_mask_size;
+			send_once = 0;
 			break;
 		default:
-			/* Log status is not set or the buffer is corrupted */
 			pr_err("diag: In %s, invalid status %d", __func__,
-							driver->log_status);
-			driver->log_mask->status = DIAG_CTRL_MASK_INVALID;
-		}
-
-		if (driver->log_mask->status == DIAG_CTRL_MASK_INVALID) {
+				 driver->log_status);
 			mutex_unlock(&driver->diag_cntl_mutex);
 			return;
 		}
-		/* send only desired update, NOT ALL */
-		if (equip_id == ALL_EQUIP_ID || equip_id ==
-					 driver->log_mask->equip_id) {
-			memcpy(buf, driver->log_mask, header_size);
-			if (driver->log_status == DIAG_CTRL_MASK_VALID)
-				memcpy(buf + header_size,
-				       driver->log_masks+ptr->index, size);
-			if (ch) {
-				while (retry_count < 3) {
-					wr_size = smd_write(ch, buf,
-							 header_size + size);
-					if (wr_size == -ENOMEM) {
-						retry_count++;
-						usleep_range(10000, 10100);
-					} else
-						break;
-				}
-				if (wr_size != header_size + size)
-					pr_err("diag: log mask update failed %d, tried %d",
-						wr_size, header_size + size);
-				else
-					pr_debug("diag: updated log equip ID %d,len %d\n",
-					driver->log_mask->equip_id,
-					driver->log_mask->log_mask_size);
-			} else
-				pr_err("diag: ch not valid for log update\n");
+		memcpy(buf, &ctrl_pkt, header_size);
+		if (log_mask_size > 0) {
+			memcpy(buf + header_size, log_item->ptr,
+			       log_mask_size);
 		}
-		ptr++;
+
+		if (ch) {
+			while (retry_count < 3) {
+				wr_size = smd_write(ch, buf,
+						header_size + log_mask_size);
+				if (wr_size == -ENOMEM) {
+					retry_count++;
+					usleep_range(10000, 10100);
+				} else
+				break;
+			}
+			if (wr_size != header_size + log_mask_size)
+				pr_err("diag: log mask update failed %d, tried %d",
+					wr_size, header_size + log_mask_size);
+			else
+				pr_debug("diag: updated log equip ID %d,len %d\n",
+					 i, log_mask_size);
+		} else
+			pr_err("diag: ch not valid for log update\n");
+		if (send_once)
+			break;
 	}
+
 	mutex_unlock(&driver->diag_cntl_mutex);
 }
 
@@ -623,7 +634,7 @@
 	int ssid_first, ssid_last, ssid_range;
 	int rt_mask, rt_first_ssid, rt_last_ssid, rt_mask_size;
 	uint8_t *rt_mask_ptr;
-	int equip_id, num_items;
+	int equip_id, copy_len;
 #if defined(CONFIG_DIAG_OVER_USB)
 	int payload_length;
 #endif
@@ -631,7 +642,6 @@
 	/* Set log masks */
 	if (*buf == 0x73 && *(int *)(buf+4) == 3) {
 		buf += 8;
-		/* Read Equip ID and pass as first param below*/
 		diag_update_log_mask(*(int *)buf, buf+8, *(int *)(buf+4));
 		diag_update_userspace_clients(LOG_MASKS_TYPE);
 #if defined(CONFIG_DIAG_OVER_USB)
@@ -639,7 +649,8 @@
 			driver->apps_rsp_buf[0] = 0x73;
 			*(int *)(driver->apps_rsp_buf + 4) = 0x3; /* op. ID */
 			*(int *)(driver->apps_rsp_buf + 8) = 0x0; /* success */
-			payload_length = 8 + ((*(int *)(buf + 4)) + 7)/8;
+			payload_length = 8 +
+					LOG_ITEMS_TO_SIZE(*(int *)(buf + 4));
 			if (payload_length > APPS_BUF_SIZE - 12) {
 				pr_err("diag: log masks: buffer overflow\n");
 				return -EIO;
@@ -663,20 +674,16 @@
 		if (!(driver->smd_data[MODEM_DATA].ch) &&
 						chk_apps_only()) {
 			equip_id = *(int *)(buf + 8);
-			num_items = *(int *)(buf + 12);
 			driver->apps_rsp_buf[0] = 0x73;
 			driver->apps_rsp_buf[1] = 0x0;
 			driver->apps_rsp_buf[2] = 0x0;
 			driver->apps_rsp_buf[3] = 0x0;
 			*(int *)(driver->apps_rsp_buf + 4) = 0x4;
-			if (!chk_equip_id_and_mask(equip_id,
-				driver->apps_rsp_buf+20))
-				*(int *)(driver->apps_rsp_buf + 8) = 0x0;
-			else
-				*(int *)(driver->apps_rsp_buf + 8) = 0x1;
-			*(int *)(driver->apps_rsp_buf + 12) = equip_id;
-			*(int *)(driver->apps_rsp_buf + 16) = num_items;
-			encode_rsp_and_send(20+(num_items+7)/8-1);
+			copy_len = copy_log_mask_equip(equip_id,
+						driver->apps_rsp_buf + 12);
+			*(int *)(driver->apps_rsp_buf + 8) =
+						(copy_len == 0) ? 1 : 0;
+			encode_rsp_and_send(12 + copy_len);
 			return 0;
 		}
 #endif
@@ -858,6 +865,19 @@
 	return  packet_type;
 }
 
+static void diag_log_mask_init(void)
+{
+	struct diag_log_mask_t *log_item = NULL;
+	uint8_t i;
+
+	mutex_init(&driver->log_mask_mutex);
+	log_item = (struct diag_log_mask_t *)driver->log_masks;
+	for (i = 0; i < MAX_EQUIP_ID; i++, log_item++) {
+		log_item->equip_id = i;
+		log_item->num_items = LOG_GET_ITEM_NUM(log_code_last_tbl[i]);
+	}
+}
+
 void diag_masks_init(void)
 {
 	driver->event_status = DIAG_CTRL_MASK_INVALID;
@@ -936,7 +956,7 @@
 			goto err;
 		kmemleak_not_leak(driver->log_masks);
 	}
-	driver->log_masks_length = (sizeof(struct mask_info))*MAX_EQUIP_ID;
+	diag_log_mask_init();
 	if (driver->event_masks == NULL) {
 		driver->event_masks = kzalloc(EVENT_MASK_SIZE, GFP_KERNEL);
 		if (driver->event_masks == NULL)
diff --git a/drivers/char/diag/diag_masks.h b/drivers/char/diag/diag_masks.h
index c66a4b6..856d4fc 100644
--- a/drivers/char/diag/diag_masks.h
+++ b/drivers/char/diag/diag_masks.h
@@ -15,7 +15,12 @@
 
 #include "diagfwd.h"
 
-int chk_equip_id_and_mask(int equip_id, uint8_t *buf);
+struct diag_log_mask_t {
+	uint8_t equip_id;
+	uint32_t num_items;
+	uint8_t ptr[MAX_ITEMS_PER_EQUIP_ID];
+} __packed;
+
 void diag_send_event_mask_update(smd_channel_t *, int num_bytes);
 void diag_send_msg_mask_update(smd_channel_t *, int ssid_first,
 					 int ssid_last, int proc);
diff --git a/drivers/char/diag/diagchar.h b/drivers/char/diag/diagchar.h
index 9d9d89b..5be77c4 100644
--- a/drivers/char/diag/diagchar.h
+++ b/drivers/char/diag/diagchar.h
@@ -82,11 +82,14 @@
  * And there are MSG_MASK_TBL_CNT rows.
  */
 #define MSG_MASK_SIZE		((MAX_SSID_PER_RANGE+3) * 4 * MSG_MASK_TBL_CNT)
-#define LOG_MASK_SIZE 8000
+#define MAX_EQUIP_ID		16
+#define MAX_ITEMS_PER_EQUIP_ID	512
+#define LOG_MASK_ITEM_SIZE	(5 + MAX_ITEMS_PER_EQUIP_ID)
+#define LOG_MASK_SIZE		(MAX_EQUIP_ID * LOG_MASK_ITEM_SIZE)
 #define EVENT_MASK_SIZE 1000
 #define USER_SPACE_DATA 8192
 #define PKT_SIZE 4096
-#define MAX_EQUIP_ID 15
+
 #define DIAG_CTRL_MSG_LOG_MASK	9
 #define DIAG_CTRL_MSG_EVENT_MASK	10
 #define DIAG_CTRL_MSG_F3_MASK	11
@@ -334,6 +337,7 @@
 	struct diag_ctrl_log_mask *log_mask;
 	struct diag_ctrl_msg_mask *msg_mask;
 	struct diag_ctrl_feature_mask *feature_mask;
+	struct mutex log_mask_mutex;
 	/* State for diag forwarding */
 	struct diag_smd_info smd_data[NUM_SMD_DATA_CHANNELS];
 	struct diag_smd_info smd_cntl[NUM_SMD_CONTROL_CHANNELS];
@@ -380,7 +384,6 @@
 	uint8_t msg_status;
 	uint8_t *log_masks;
 	uint8_t log_status;
-	int log_masks_length;
 	uint8_t *event_masks;
 	uint8_t event_status;
 	uint8_t log_on_demand_support;
diff --git a/drivers/char/diag/diagfwd.c b/drivers/char/diag/diagfwd.c
index cdd315e..ba3ecc2 100644
--- a/drivers/char/diag/diagfwd.c
+++ b/drivers/char/diag/diagfwd.c
@@ -1051,9 +1051,10 @@
 	return is_mode_reset;
 }
 
-void diag_send_data(struct diag_master_table entry, unsigned char *buf,
+int diag_send_data(struct diag_master_table entry, unsigned char *buf,
 					 int len, int type)
 {
+	int success = 1;
 	driver->pkt_length = len;
 
 	/* If the process_id corresponds to an apps process */
@@ -1069,13 +1070,19 @@
 			if (entry.client_id < NUM_SMD_DATA_CHANNELS) {
 				struct diag_smd_info *smd_info;
 				int index = entry.client_id;
+				if (!driver->rcvd_feature_mask[
+					entry.client_id]) {
+					pr_debug("diag: In %s, feature mask for peripheral: %d not received yet\n",
+						__func__, entry.client_id);
+					return 0;
+				}
 				/*
 				 * Mode reset should work even if
 				 * modem is down
 				 */
 				if ((index == MODEM_DATA) &&
 					diag_check_mode_reset(buf)) {
-					return;
+					return 1;
 				}
 				smd_info = (driver->separate_cmdrsp[index] &&
 						index < NUM_SMD_CMD_CHANNELS) ?
@@ -1095,9 +1102,12 @@
 			} else {
 				pr_alert("diag: In %s, incorrect channel: %d",
 					__func__, entry.client_id);
+				success = 0;
 			}
 		}
 	}
+
+	return success;
 }
 
 void diag_process_stm_mask(uint8_t cmd, uint8_t data_mask, int data_type,
@@ -1191,6 +1201,7 @@
 	unsigned char *temp = buf;
 	int data_type;
 	int mask_ret;
+	int status = 0;
 #if defined(CONFIG_DIAG_OVER_USB)
 	unsigned char *ptr;
 #endif
@@ -1217,14 +1228,15 @@
 	pr_debug("diag: %d %d %d", cmd_code, subsys_id, subsys_cmd_code);
 	for (i = 0; i < diag_max_reg; i++) {
 		entry = driver->table[i];
-		if (entry.process_id != NO_PROCESS &&
-				driver->rcvd_feature_mask[entry.client_id]) {
+		if (entry.process_id != NO_PROCESS) {
 			if (entry.cmd_code == cmd_code && entry.subsys_id ==
 				 subsys_id && entry.cmd_code_lo <=
 							 subsys_cmd_code &&
 				  entry.cmd_code_hi >= subsys_cmd_code) {
-				diag_send_data(entry, buf, len, data_type);
-				packet_type = 0;
+				status = diag_send_data(entry, buf, len,
+								data_type);
+				if (status)
+					packet_type = 0;
 			} else if (entry.cmd_code == 255
 				  && cmd_code == 75) {
 				if (entry.subsys_id ==
@@ -1233,9 +1245,10 @@
 					subsys_cmd_code &&
 					 entry.cmd_code_hi >=
 					subsys_cmd_code) {
-					diag_send_data(entry, buf, len,
-								 data_type);
-					packet_type = 0;
+					status = diag_send_data(entry, buf,
+								len, data_type);
+					if (status)
+						packet_type = 0;
 				}
 			} else if (entry.cmd_code == 255 &&
 				  entry.subsys_id == 255) {
@@ -1243,9 +1256,10 @@
 						 cmd_code &&
 						 entry.
 						cmd_code_hi >= cmd_code) {
-					diag_send_data(entry, buf, len,
+					status = diag_send_data(entry, buf, len,
 								 data_type);
-					packet_type = 0;
+					if (status)
+						packet_type = 0;
 				}
 			}
 		}
@@ -1280,22 +1294,38 @@
 		driver->apps_rsp_buf[0] = 0x73;
 		*(int *)(driver->apps_rsp_buf + 4) = 0x1; /* operation ID */
 		*(int *)(driver->apps_rsp_buf + 8) = 0x0; /* success code */
-		*(int *)(driver->apps_rsp_buf + 12) = LOG_GET_ITEM_NUM(LOG_0);
-		*(int *)(driver->apps_rsp_buf + 16) = LOG_GET_ITEM_NUM(LOG_1);
-		*(int *)(driver->apps_rsp_buf + 20) = LOG_GET_ITEM_NUM(LOG_2);
-		*(int *)(driver->apps_rsp_buf + 24) = LOG_GET_ITEM_NUM(LOG_3);
-		*(int *)(driver->apps_rsp_buf + 28) = LOG_GET_ITEM_NUM(LOG_4);
-		*(int *)(driver->apps_rsp_buf + 32) = LOG_GET_ITEM_NUM(LOG_5);
-		*(int *)(driver->apps_rsp_buf + 36) = LOG_GET_ITEM_NUM(LOG_6);
-		*(int *)(driver->apps_rsp_buf + 40) = LOG_GET_ITEM_NUM(LOG_7);
-		*(int *)(driver->apps_rsp_buf + 44) = LOG_GET_ITEM_NUM(LOG_8);
-		*(int *)(driver->apps_rsp_buf + 48) = LOG_GET_ITEM_NUM(LOG_9);
-		*(int *)(driver->apps_rsp_buf + 52) = LOG_GET_ITEM_NUM(LOG_10);
-		*(int *)(driver->apps_rsp_buf + 56) = LOG_GET_ITEM_NUM(LOG_11);
-		*(int *)(driver->apps_rsp_buf + 60) = LOG_GET_ITEM_NUM(LOG_12);
-		*(int *)(driver->apps_rsp_buf + 64) = LOG_GET_ITEM_NUM(LOG_13);
-		*(int *)(driver->apps_rsp_buf + 68) = LOG_GET_ITEM_NUM(LOG_14);
-		*(int *)(driver->apps_rsp_buf + 72) = LOG_GET_ITEM_NUM(LOG_15);
+		*(int *)(driver->apps_rsp_buf + 12) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[0]);
+		*(int *)(driver->apps_rsp_buf + 16) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[1]);
+		*(int *)(driver->apps_rsp_buf + 20) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[2]);
+		*(int *)(driver->apps_rsp_buf + 24) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[3]);
+		*(int *)(driver->apps_rsp_buf + 28) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[4]);
+		*(int *)(driver->apps_rsp_buf + 32) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[5]);
+		*(int *)(driver->apps_rsp_buf + 36) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[6]);
+		*(int *)(driver->apps_rsp_buf + 40) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[7]);
+		*(int *)(driver->apps_rsp_buf + 44) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[8]);
+		*(int *)(driver->apps_rsp_buf + 48) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[9]);
+		*(int *)(driver->apps_rsp_buf + 52) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[10]);
+		*(int *)(driver->apps_rsp_buf + 56) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[11]);
+		*(int *)(driver->apps_rsp_buf + 60) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[12]);
+		*(int *)(driver->apps_rsp_buf + 64) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[13]);
+		*(int *)(driver->apps_rsp_buf + 68) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[14]);
+		*(int *)(driver->apps_rsp_buf + 72) =
+				LOG_GET_ITEM_NUM(log_code_last_tbl[15]);
 		encode_rsp_and_send(75);
 		return 0;
 	}
diff --git a/drivers/coresight/coresight-tmc.c b/drivers/coresight/coresight-tmc.c
index 8267293..f35ba53 100644
--- a/drivers/coresight/coresight-tmc.c
+++ b/drivers/coresight/coresight-tmc.c
@@ -1407,32 +1407,39 @@
 
 	ret = alloc_chrdev_region(&dev, 0, 1, drvdata->byte_cntr_node);
 	if (ret)
-		goto dev_err0;
+		goto err0;
+
 	cdev_init(&drvdata->byte_cntr_dev, &byte_cntr_fops);
+
 	drvdata->byte_cntr_dev.owner = THIS_MODULE;
 	drvdata->byte_cntr_dev.ops = &byte_cntr_fops;
 	ret = cdev_add(&drvdata->byte_cntr_dev, dev, 1);
 	if (ret)
-		goto dev_err1;
+		goto err1;
+
 	drvdata->byte_cntr_class = class_create(THIS_MODULE,
 						drvdata->byte_cntr_node);
-	if (!drvdata->byte_cntr_class)
-		goto dev_err2;
+	if (IS_ERR(drvdata->byte_cntr_class)) {
+		ret = PTR_ERR(drvdata->byte_cntr_class);
+		goto err2;
+	}
+
 	device = device_create(drvdata->byte_cntr_class, NULL,
 			       drvdata->byte_cntr_dev.dev, drvdata,
 			       drvdata->byte_cntr_node);
 	if (IS_ERR(device)) {
 		ret = PTR_ERR(device);
-		goto dev_err3;
+		goto err3;
 	}
+
 	return 0;
-dev_err3:
+err3:
 	class_destroy(drvdata->byte_cntr_class);
-dev_err2:
+err2:
 	cdev_del(&drvdata->byte_cntr_dev);
-dev_err1:
+err1:
 	unregister_chrdev_region(drvdata->byte_cntr_dev.dev, 1);
-dev_err0:
+err0:
 	return ret;
 }
 
@@ -1466,6 +1473,7 @@
 		dev_err(&pdev->dev, "Byte-cntr-irq not specified\n");
 		goto err;
 	}
+
 	ret = devm_request_irq(&pdev->dev, drvdata->byte_cntr_irq,
 			tmc_etr_byte_cntr_irq,
 			IRQF_TRIGGER_RISING | IRQF_SHARED,
@@ -1474,17 +1482,27 @@
 		dev_err(&pdev->dev, "Request irq failed\n");
 		goto err;
 	}
+
 	init_waitqueue_head(&drvdata->wq);
 	node_size += strlen(node_name);
+
 	drvdata->byte_cntr_node = devm_kzalloc(&pdev->dev,
-				node_size, GFP_KERNEL);
+					       node_size, GFP_KERNEL);
+	if (!drvdata->byte_cntr_node) {
+		dev_err(&pdev->dev, "Byte cntr node name allocation failed\n");
+		ret = -ENOMEM;
+		goto err;
+	}
+
 	strlcpy(drvdata->byte_cntr_node, node_name, node_size);
 	strlcat(drvdata->byte_cntr_node, "-stream", node_size);
+
 	ret = tmc_etr_byte_cntr_dev_register(drvdata);
 	if (ret) {
 		dev_err(&pdev->dev, "Byte cntr node not registered\n");
 		goto err;
 	}
+
 	dev_info(&pdev->dev, "Byte Counter feature enabled\n");
 	return 0;
 err:
diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c
index 50a0d12..becb611 100644
--- a/drivers/gpu/msm/adreno.c
+++ b/drivers/gpu/msm/adreno.c
@@ -2304,12 +2304,18 @@
 _adreno_ft_restart_device(struct kgsl_device *device,
 			   struct kgsl_context *context)
 {
-	/* If device soft reset fails try hard reset */
-	if (adreno_soft_reset(device))
-		KGSL_DEV_ERR_ONCE(device, "Device soft reset failed\n");
-	else
-		/* Soft reset is successful */
-		goto reset_done;
+	/*
+	 * If device soft reset fails try hard reset, but don't attempt
+	 * soft reset on page faults. In cases of page faults, go straight
+	 * to hard reset.
+	 */
+	if (!(device->mmu.fault)) {
+		if (adreno_soft_reset(device))
+			KGSL_DEV_ERR_ONCE(device, "Device soft reset failed\n");
+		else
+			/* Soft reset is successful */
+			goto reset_done;
+	}
 
 	/* restart device */
 	if (adreno_stop(device)) {
@@ -2432,7 +2438,6 @@
 	struct adreno_context *last_active_ctx = adreno_dev->drawctxt_active;
 	unsigned int long_ib = 0;
 	static int no_context_ft;
-	struct kgsl_mmu *mmu = &device->mmu;
 
 	context = kgsl_context_get(device, ft_data->context_id);
 
@@ -2507,8 +2512,6 @@
 
 	/* Do not try to replay if hang is due to a pagefault */
 	if (context && test_bit(KGSL_CONTEXT_PAGEFAULT, &context->priv)) {
-		/* Resume MMU */
-		mmu->mmu_ops->mmu_pagefault_resume(mmu);
 		if ((ft_data->context_id == context->id) &&
 			(ft_data->global_eop == context->pagefault_ts)) {
 			ft_data->ft_policy &= ~KGSL_FT_REPLAY;
diff --git a/drivers/gpu/msm/kgsl_iommu.c b/drivers/gpu/msm/kgsl_iommu.c
index acb3b17..6275a72 100644
--- a/drivers/gpu/msm/kgsl_iommu.c
+++ b/drivers/gpu/msm/kgsl_iommu.c
@@ -2052,7 +2052,6 @@
 	.mmu_setstate = kgsl_iommu_setstate,
 	.mmu_device_setstate = kgsl_iommu_default_setstate,
 	.mmu_pagefault = NULL,
-	.mmu_pagefault_resume = kgsl_iommu_pagefault_resume,
 	.mmu_get_current_ptbase = kgsl_iommu_get_current_ptbase,
 	.mmu_enable_clk = kgsl_iommu_enable_clk,
 	.mmu_disable_clk_on_ts = kgsl_iommu_disable_clk_on_ts,
diff --git a/drivers/gpu/msm/kgsl_mmu.h b/drivers/gpu/msm/kgsl_mmu.h
index faba81e..64705f8 100644
--- a/drivers/gpu/msm/kgsl_mmu.h
+++ b/drivers/gpu/msm/kgsl_mmu.h
@@ -141,8 +141,6 @@
 	void (*mmu_pagefault) (struct kgsl_mmu *mmu);
 	phys_addr_t (*mmu_get_current_ptbase)
 			(struct kgsl_mmu *mmu);
-	void (*mmu_pagefault_resume)
-			(struct kgsl_mmu *mmu);
 	void (*mmu_disable_clk_on_ts)
 		(struct kgsl_mmu *mmu, uint32_t ts, bool ts_valid);
 	int (*mmu_enable_clk)
diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index 74a252f..57aa835 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
@@ -192,6 +192,10 @@
 	struct qup_i2c_clk_path_vote clk_path_vote;
 };
 
+#ifdef CONFIG_PM
+static int i2c_qup_pm_resume_runtime(struct device *device);
+#endif
+
 #ifdef DEBUG
 static void
 qup_print_status(struct qup_i2c_dev *dev)
@@ -944,7 +948,13 @@
 	long timeout;
 	int err;
 
-	pm_runtime_get_sync(dev->dev);
+	/* Alternate if runtime power management is disabled */
+	if (!pm_runtime_enabled(dev->dev)) {
+		dev_dbg(dev->dev, "Runtime PM is disabled\n");
+		i2c_qup_pm_resume_runtime(dev->dev);
+	} else {
+		pm_runtime_get_sync(dev->dev);
+	}
 	mutex_lock(&dev->mlock);
 
 	if (dev->suspended) {
@@ -1754,22 +1764,24 @@
 	if (!pm_runtime_enabled(device) || !pm_runtime_suspended(device)) {
 		dev_dbg(device, "system suspend");
 		i2c_qup_pm_suspend_runtime(device);
+		/*
+		 * set the device's runtime PM status to 'suspended'
+		 */
+		pm_runtime_disable(device);
+		pm_runtime_set_suspended(device);
+		pm_runtime_enable(device);
 	}
 	return 0;
 }
 
 static int qup_i2c_resume(struct device *device)
 {
-	int ret = 0;
-	if (!pm_runtime_enabled(device) || !pm_runtime_suspended(device)) {
-		dev_dbg(device, "system resume");
-		ret = i2c_qup_pm_resume_runtime(device);
-		if (!ret) {
-			pm_runtime_mark_last_busy(device);
-			pm_request_autosuspend(device);
-		}
-		return ret;
-	}
+	/*
+	 * Rely on runtime-PM to call resume in case it is enabled
+	 * Even if it's not enabled, rely on 1st client transaction to do
+	 * clock ON and gpio configuration
+	 */
+	dev_dbg(device, "system resume");
 	return 0;
 }
 #endif /* CONFIG_PM */
diff --git a/drivers/input/touchscreen/ft5x06_ts.c b/drivers/input/touchscreen/ft5x06_ts.c
index ef76e69..f366364 100644
--- a/drivers/input/touchscreen/ft5x06_ts.c
+++ b/drivers/input/touchscreen/ft5x06_ts.c
@@ -131,8 +131,9 @@
 #define FT_FW_PKT_DLY_MS	20
 #define FT_FW_LAST_PKT		0x6ffa
 #define FT_EARSE_DLY_MS		100
+#define FT_55_AA_DLY_NS		5000
 
-#define FT_UPGRADE_LOOP		10
+#define FT_UPGRADE_LOOP		30
 #define FT_CAL_START		0x04
 #define FT_CAL_FIN		0x00
 #define FT_CAL_STORE		0x05
@@ -142,6 +143,30 @@
 
 #define FT_INFO_MAX_LEN		512
 
+#define FT_BLOADER_SIZE_OFF	12
+#define FT_BLOADER_NEW_SIZE	30
+#define FT_DATA_LEN_OFF_OLD_FW	8
+#define FT_DATA_LEN_OFF_NEW_FW	14
+#define FT_FINISHING_PKT_LEN_OLD_FW	6
+#define FT_FINISHING_PKT_LEN_NEW_FW	12
+#define FT_MAGIC_BLOADER_Z7	0x7bfa
+#define FT_MAGIC_BLOADER_LZ4	0x6ffa
+#define FT_MAGIC_BLOADER_GZF_30	0x7ff4
+#define FT_MAGIC_BLOADER_GZF	0x7bf4
+
+enum {
+	FT_BLOADER_VERSION_LZ4 = 0,
+	FT_BLOADER_VERSION_Z7 = 1,
+	FT_BLOADER_VERSION_GZF = 2,
+};
+
+enum {
+	FT_FT5336_FAMILY_ID_0x11 = 0x11,
+	FT_FT5336_FAMILY_ID_0x12 = 0x12,
+	FT_FT5336_FAMILY_ID_0x13 = 0x13,
+	FT_FT5336_FAMILY_ID_0x14 = 0x14,
+};
+
 #define FT_STORE_TS_INFO(buf, id, name, max_tch, group_id, fw_vkey_support, \
 			fw_name, fw_maj, fw_min, fw_sub_min) \
 			snprintf(buf, FT_INFO_MAX_LEN, \
@@ -645,11 +670,20 @@
 	u8 reset_reg;
 	u8 w_buf[FT_MAX_WR_BUF] = {0}, r_buf[FT_MAX_RD_BUF] = {0};
 	u8 pkt_buf[FT_FW_PKT_LEN + FT_FW_PKT_META_LEN];
-	int rc, i, j, temp;
+	int i, j, temp;
 	u32 pkt_num, pkt_len;
+	u8 is_5336_new_bootloader = false;
+	u8 is_5336_fwsize_30 = false;
 	u8 fw_ecc;
 
+	/* determine firmware size */
+	if (*(data + data_len - FT_BLOADER_SIZE_OFF) == FT_BLOADER_NEW_SIZE)
+		is_5336_fwsize_30 = true;
+	else
+		is_5336_fwsize_30 = false;
+
 	for (i = 0, j = 0; i < FT_UPGRADE_LOOP; i++) {
+		msleep(FT_EARSE_DLY_MS);
 		/* reset - write 0xaa and 0x55 to reset register */
 		if (ts_data->family_id == FT6X06_ID)
 			reset_reg = FT_RST_CMD_REG2;
@@ -660,16 +694,17 @@
 		msleep(info.delay_aa);
 
 		ft5x0x_write_reg(client, reset_reg, FT_UPGRADE_55);
-		msleep(info.delay_55);
+		if (i <= (FT_UPGRADE_LOOP / 2))
+			msleep(info.delay_55 + i * 3);
+		else
+			msleep(info.delay_55 - (i - (FT_UPGRADE_LOOP / 2)) * 2);
 
 		/* Enter upgrade mode */
 		w_buf[0] = FT_UPGRADE_55;
-		w_buf[1] = FT_UPGRADE_AA;
-		do {
-			j++;
-			rc = ft5x06_i2c_write(client, w_buf, 2);
-			msleep(FT_RETRY_DLY);
-		} while (rc <= 0 && j < FT_MAX_TRIES);
+		ft5x06_i2c_write(client, w_buf, 1);
+		usleep(FT_55_AA_DLY_NS);
+		w_buf[0] = FT_UPGRADE_AA;
+		ft5x06_i2c_write(client, w_buf, 1);
 
 		/* check READ_ID */
 		msleep(info.delay_readid);
@@ -692,17 +727,40 @@
 		return -EIO;
 	}
 
+	w_buf[0] = 0xcd;
+	ft5x06_i2c_read(client, w_buf, 1, r_buf, 1);
+
+	if (r_buf[0] <= 4)
+		is_5336_new_bootloader = FT_BLOADER_VERSION_LZ4;
+	else if (r_buf[0] == 7)
+		is_5336_new_bootloader = FT_BLOADER_VERSION_Z7;
+	else if (r_buf[0] >= 0x0f &&
+		((ts_data->family_id == FT_FT5336_FAMILY_ID_0x11) ||
+		(ts_data->family_id == FT_FT5336_FAMILY_ID_0x12) ||
+		(ts_data->family_id == FT_FT5336_FAMILY_ID_0x13) ||
+		(ts_data->family_id == FT_FT5336_FAMILY_ID_0x14)))
+		is_5336_new_bootloader = FT_BLOADER_VERSION_GZF;
+	else
+		is_5336_new_bootloader = FT_BLOADER_VERSION_LZ4;
+
 	/* erase app and panel paramenter area */
 	w_buf[0] = FT_ERASE_APP_REG;
 	ft5x06_i2c_write(client, w_buf, 1);
 	msleep(info.delay_erase_flash);
 
-	w_buf[0] = FT_ERASE_PANEL_REG;
-	ft5x06_i2c_write(client, w_buf, 1);
+	if (is_5336_fwsize_30) {
+		w_buf[0] = FT_ERASE_PANEL_REG;
+		ft5x06_i2c_write(client, w_buf, 1);
+	}
 	msleep(FT_EARSE_DLY_MS);
 
 	/* program firmware */
-	data_len = data_len - 8;
+	if (is_5336_new_bootloader == FT_BLOADER_VERSION_LZ4
+		|| is_5336_new_bootloader == FT_BLOADER_VERSION_Z7)
+		data_len = data_len - FT_DATA_LEN_OFF_OLD_FW;
+	else
+		data_len = data_len - FT_DATA_LEN_OFF_NEW_FW;
+
 	pkt_num = (data_len) / FT_FW_PKT_LEN;
 	pkt_len = FT_FW_PKT_LEN;
 	pkt_buf[0] = FT_FW_START_REG;
@@ -745,17 +803,45 @@
 	}
 
 	/* send the finishing packet */
-	for (i = 0; i < 6; i++) {
-		temp = FT_FW_LAST_PKT + i;
-		pkt_buf[2] = (u8) (temp >> 8);
-		pkt_buf[3] = (u8) temp;
-		temp = 1;
-		pkt_buf[4] = (u8) (temp >> 8);
-		pkt_buf[5] = (u8) temp;
-		pkt_buf[6] = data[data_len + i];
-		fw_ecc ^= pkt_buf[6];
-		ft5x06_i2c_write(client, pkt_buf, temp + FT_FW_PKT_META_LEN);
-		msleep(FT_FW_PKT_DLY_MS);
+	if (is_5336_new_bootloader == FT_BLOADER_VERSION_LZ4 ||
+		is_5336_new_bootloader == FT_BLOADER_VERSION_Z7) {
+		for (i = 0; i < FT_FINISHING_PKT_LEN_OLD_FW; i++) {
+			if (is_5336_new_bootloader  == FT_BLOADER_VERSION_Z7)
+				temp = FT_MAGIC_BLOADER_Z7 + i;
+			else if (is_5336_new_bootloader ==
+						FT_BLOADER_VERSION_LZ4)
+				temp = FT_MAGIC_BLOADER_LZ4 + i;
+			pkt_buf[2] = (u8)(temp >> 8);
+			pkt_buf[3] = (u8)temp;
+			temp = 1;
+			pkt_buf[4] = (u8)(temp >> 8);
+			pkt_buf[5] = (u8)temp;
+			pkt_buf[6] = data[data_len + i];
+			fw_ecc ^= pkt_buf[6];
+
+			ft5x06_i2c_write(client,
+				pkt_buf, temp + FT_FW_PKT_META_LEN);
+			msleep(FT_FW_PKT_DLY_MS);
+		}
+	} else if (is_5336_new_bootloader == FT_BLOADER_VERSION_GZF) {
+		for (i = 0; i < FT_FINISHING_PKT_LEN_NEW_FW; i++) {
+			if (is_5336_fwsize_30)
+				temp = FT_MAGIC_BLOADER_GZF_30 + i;
+			else
+				temp = FT_MAGIC_BLOADER_GZF + i;
+			pkt_buf[2] = (u8)(temp >> 8);
+			pkt_buf[3] = (u8)temp;
+			temp = 1;
+			pkt_buf[4] = (u8)(temp >> 8);
+			pkt_buf[5] = (u8)temp;
+			pkt_buf[6] = data[data_len + i];
+			fw_ecc ^= pkt_buf[6];
+
+			ft5x06_i2c_write(client,
+				pkt_buf, temp + FT_FW_PKT_META_LEN);
+			msleep(FT_FW_PKT_DLY_MS);
+
+		}
 	}
 
 	/* verify checksum */
diff --git a/drivers/input/touchscreen/gt9xx/gt9xx.c b/drivers/input/touchscreen/gt9xx/gt9xx.c
index 8b08ac9..ba38061 100644
--- a/drivers/input/touchscreen/gt9xx/gt9xx.c
+++ b/drivers/input/touchscreen/gt9xx/gt9xx.c
@@ -95,6 +95,8 @@
 static void gtp_reset_guitar(struct goodix_ts_data *ts, int ms);
 static void gtp_int_sync(struct goodix_ts_data *ts, int ms);
 static int gtp_i2c_test(struct i2c_client *client);
+static int goodix_power_off(struct goodix_ts_data *ts);
+static int goodix_power_on(struct goodix_ts_data *ts);
 
 #if defined(CONFIG_FB)
 static int fb_notifier_callback(struct notifier_block *self,
@@ -758,7 +760,7 @@
 	ts: private data.
 Output:
 	Executive outcomes.
-	1: succeed, otherwise failed.
+	>0: succeed, otherwise failed.
 *******************************************************/
 static s8 gtp_enter_sleep(struct goodix_ts_data  *ts)
 {
@@ -769,20 +771,37 @@
 		(u8)GTP_REG_SLEEP, 5};
 
 	ret = gpio_direction_output(ts->pdata->irq_gpio, 0);
-	usleep(5000);
-	while (retry++ < 5) {
-		ret = gtp_i2c_write(ts->client, i2c_control_buf, 3);
-		if (ret > 0) {
-			dev_dbg(&ts->client->dev,
-				"GTP enter sleep!");
-			return ret;
+	if (ret)
+		dev_err(&ts->client->dev,
+			"GTP sleep: Cannot reconfig gpio %d.\n",
+			ts->pdata->irq_gpio);
+	if (ts->pdata->enable_power_off) {
+		ret = gpio_direction_output(ts->pdata->reset_gpio, 0);
+		if (ret)
+			dev_err(&ts->client->dev,
+				"GTP sleep: Cannot reconfig gpio %d.\n",
+				ts->pdata->reset_gpio);
+		ret = goodix_power_off(ts);
+		if (ret) {
+			dev_err(&ts->client->dev, "GTP power off failed.\n");
+			return 0;
 		}
-		msleep(20);
+		return 1;
+	} else {
+		usleep(5000);
+		while (retry++ < 5) {
+			ret = gtp_i2c_write(ts->client, i2c_control_buf, 3);
+			if (ret == 1) {
+				dev_dbg(&ts->client->dev, "GTP enter sleep!");
+				return ret;
+			}
+			msleep(20);
+		}
+		dev_err(&ts->client->dev, "GTP send sleep cmd failed.\n");
+		return ret;
 	}
-	dev_err(&ts->client->dev, "GTP send sleep cmd failed.\n");
-	return ret;
 }
-#endif
+#endif /* !GTP_SLIDE_WAKEUP */
 
 /*******************************************************
 Function:
@@ -798,17 +817,36 @@
 	u8 retry = 0;
 	s8 ret = -1;
 
-#if GTP_POWER_CTRL_SLEEP
-	gtp_reset_guitar(ts, 20);
+	if (ts->pdata->enable_power_off) {
+		ret = gpio_direction_output(ts->pdata->irq_gpio, 0);
+		if (ret)
+			dev_err(&ts->client->dev,
+				"GTP wakeup: Cannot reconfig gpio %d.\n",
+				ts->pdata->irq_gpio);
+		ret = gpio_direction_output(ts->pdata->reset_gpio, 0);
+		if (ret)
+			dev_err(&ts->client->dev,
+				"GTP wakeup: Cannot reconfig gpio %d.\n",
+				ts->pdata->reset_gpio);
+		ret = goodix_power_on(ts);
+		if (ret) {
+			dev_err(&ts->client->dev, "GTP power on failed.\n");
+			return 0;
+		}
 
-	ret = gtp_send_cfg(ts);
-	if (ret > 0) {
+		gtp_reset_guitar(ts, 20);
+
+		ret = gtp_send_cfg(ts);
+		if (ret <= 0) {
+			dev_err(&ts->client->dev,
+				"GTP wakeup sleep failed.\n");
+			return ret;
+		}
+
 		dev_dbg(&ts->client->dev,
-			"Wakeup sleep send config success.");
-		return 1;
-	}
-#else
-	while (retry++ < 10) {
+				"Wakeup sleep send config success.");
+	} else {
+err_retry:
 #if GTP_SLIDE_WAKEUP
 		/* wakeup not by slide */
 		if (DOZE_WAKEUP != doze_status)
@@ -825,7 +863,7 @@
 		}
 #endif
 		ret = gtp_i2c_test(ts->client);
-		if (ret > 0) {
+		if (ret == 2) {
 			dev_dbg(&ts->client->dev, "GTP wakeup sleep.");
 #if (!GTP_SLIDE_WAKEUP)
 			if (chip_gt9xxs == 0) {
@@ -839,10 +877,10 @@
 			return ret;
 		}
 		gtp_reset_guitar(ts, 20);
+		if (retry++ < 10)
+			goto err_retry;
+		dev_err(&ts->client->dev, "GTP wakeup sleep failed.\n");
 	}
-#endif
-
-	dev_err(&ts->client->dev, "GTP wakeup sleep failed.\n");
 	return ret;
 }
 #endif /* !CONFIG_HAS_EARLYSUSPEND && !CONFIG_FB*/
@@ -1055,9 +1093,7 @@
 
 	dev_info(&client->dev, "Goodix Product ID = %s\n", product_id);
 
-	if (!IS_ERR(ts->pdata->product_id))
-		ret = strcmp(product_id, ts->pdata->product_id);
-
+	ret = strcmp(product_id, ts->pdata->product_id);
 	if (ret != 0)
 		return -EINVAL;
 
@@ -1292,6 +1328,12 @@
 {
 	int ret;
 
+	if (ts->power_on) {
+		dev_info(&ts->client->dev,
+				"Device already power on\n");
+		return 0;
+	}
+
 	if (!IS_ERR(ts->avdd)) {
 		ret = reg_set_optimum_mode_check(ts->avdd,
 			GOODIX_VDD_LOAD_MAX_UA);
@@ -1358,6 +1400,7 @@
 			}
 	}
 
+	ts->power_on = true;
 	return 0;
 
 err_enable_vcc_i2c:
@@ -1376,6 +1419,7 @@
 		regulator_disable(ts->avdd);
 err_enable_avdd:
 err_set_opt_avdd:
+	ts->power_on = false;
 	return ret;
 }
 
@@ -1389,6 +1433,12 @@
 {
 	int ret;
 
+	if (!ts->power_on) {
+		dev_info(&ts->client->dev,
+				"Device already power off\n");
+		return 0;
+	}
+
 	if (!IS_ERR(ts->vcc_i2c)) {
 		ret = regulator_set_voltage(ts->vcc_i2c, 0,
 			GOODIX_I2C_VTG_MAX_UV);
@@ -1421,6 +1471,7 @@
 				"Regulator avdd disable failed ret=%d\n", ret);
 	}
 
+	ts->power_on = false;
 	return 0;
 }
 
@@ -1473,6 +1524,50 @@
 	return 0;
 }
 
+static ssize_t gtp_fw_name_show(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	struct goodix_ts_data *ts = dev_get_drvdata(dev);
+
+	if (!strlen(ts->fw_name))
+		return snprintf(buf, GTP_FW_NAME_MAXSIZE - 1,
+			"No fw name has been given.");
+	else
+		return snprintf(buf, GTP_FW_NAME_MAXSIZE - 1,
+			"%s\n", ts->fw_name);
+}
+
+static ssize_t gtp_fw_name_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t size)
+{
+	struct goodix_ts_data *ts = dev_get_drvdata(dev);
+
+	if (size > GTP_FW_NAME_MAXSIZE - 1) {
+		dev_err(dev, "FW name size exceeds the limit.");
+		return -EINVAL;
+	}
+
+	strlcpy(ts->fw_name, buf, size);
+	if (ts->fw_name[size-1] == '\n')
+		ts->fw_name[size-1] = '\0';
+
+	return size;
+}
+
+static DEVICE_ATTR(fw_name, (S_IRUGO | S_IWUSR | S_IWGRP),
+			gtp_fw_name_show,
+			gtp_fw_name_store);
+
+static struct attribute *gtp_attrs[] = {
+	&dev_attr_fw_name.attr,
+	NULL
+};
+
+static const struct attribute_group gtp_attr_grp = {
+	.attrs = gtp_attrs,
+};
+
 static int goodix_ts_get_dt_coords(struct device *dev, char *name,
 				struct goodix_ts_platform_data *pdata)
 {
@@ -1536,6 +1631,9 @@
 
 	pdata->no_force_update = of_property_read_bool(np,
 						"goodix,no-force-update");
+
+	pdata->enable_power_off = of_property_read_bool(np,
+						"goodix,enable-power-off");
 	/* reset, irq gpio info */
 	pdata->reset_gpio = of_get_named_gpio_flags(np, "reset-gpios",
 				0, &pdata->reset_gpio_flags);
@@ -1549,8 +1647,17 @@
 
 	rc = of_property_read_string(np, "goodix,product-id",
 						&pdata->product_id);
-	if (rc < 0 || strlen(pdata->product_id) > GTP_PRODUCT_ID_MAXSIZE)
-		return rc;
+	if (rc && (rc != -EINVAL)) {
+		dev_err(dev, "Failed to parse product_id.");
+		return -EINVAL;
+	}
+
+	rc = of_property_read_string(np, "goodix,fw_name",
+						&pdata->fw_name);
+	if (rc && (rc != -EINVAL)) {
+		dev_err(dev, "Failed to parse firmware name.\n");
+		return -EINVAL;
+	}
 
 	prop = of_find_property(np, "goodix,button-map", NULL);
 	if (prop) {
@@ -1662,6 +1769,7 @@
 	spin_lock_init(&ts->irq_lock);
 	i2c_set_clientdata(client, ts);
 	ts->gtp_rawdiff_mode = 0;
+	ts->power_on = false;
 
 	ret = goodix_power_init(ts);
 	if (ret) {
@@ -1689,12 +1797,16 @@
 		goto exit_free_io_port;
 	}
 
+	if (pdata->fw_name)
+		strlcpy(ts->fw_name, pdata->fw_name,
+						strlen(pdata->fw_name) + 1);
+
 #if GTP_AUTO_UPDATE
 	ret = gup_init_update_proc(ts);
 	if (ret < 0) {
 		dev_err(&client->dev,
 			"GTP Create firmware update thread error.\n");
-		goto exit_free_io_port;
+		goto exit_power_off;
 	}
 #endif
 
@@ -1711,7 +1823,9 @@
 		dev_err(&client->dev, "GTP request input dev failed.\n");
 		goto exit_free_inputdev;
 	}
+	input_set_drvdata(ts->input_dev, ts);
 
+	mutex_init(&ts->lock);
 #if defined(CONFIG_FB)
 	ts->fb_notif.notifier_call = fb_notifier_callback;
 	ret = fb_register_client(&ts->fb_notif);
@@ -1754,9 +1868,16 @@
 #if GTP_ESD_PROTECT
 	gtp_esd_switch(client, SWITCH_ON);
 #endif
+	ret = sysfs_create_group(&client->dev.kobj, &gtp_attr_grp);
+	if (ret < 0) {
+		dev_err(&client->dev, "sys file creation failed.\n");
+		goto exit_free_irq;
+	}
+
 	init_done = true;
 	return 0;
 exit_free_irq:
+	mutex_destroy(&ts->lock);
 #if defined(CONFIG_FB)
 	if (fb_unregister_client(&ts->fb_notif))
 		dev_err(&client->dev,
@@ -1806,6 +1927,8 @@
 {
 	struct goodix_ts_data *ts = i2c_get_clientdata(client);
 
+	sysfs_remove_group(&ts->input_dev->dev.kobj, &gtp_attr_grp);
+
 #if defined(CONFIG_FB)
 	if (fb_unregister_client(&ts->fb_notif))
 		dev_err(&client->dev,
@@ -1813,6 +1936,7 @@
 #elif defined(CONFIG_HAS_EARLYSUSPEND)
 	unregister_early_suspend(&ts->early_suspend);
 #endif
+	mutex_destroy(&ts->lock);
 
 #if GTP_CREATE_WR_NODE
 	uninit_wr_node();
@@ -1868,6 +1992,7 @@
 {
 	int ret = -1, i;
 
+	mutex_lock(&ts->lock);
 #if GTP_ESD_PROTECT
 	ts->gtp_is_suspend = 1;
 	gtp_esd_switch(ts->client, SWITCH_OFF);
@@ -1888,12 +2013,13 @@
 
 	ret = gtp_enter_sleep(ts);
 #endif
-	if (ret < 0)
+	if (ret <= 0)
 		dev_err(&ts->client->dev, "GTP early suspend failed.\n");
 	/* to avoid waking up while not sleeping,
 	 * delay 48 + 10ms to ensure reliability
 	 */
 	msleep(58);
+	mutex_unlock(&ts->lock);
 }
 
 /*******************************************************
@@ -1908,13 +2034,14 @@
 {
 	int ret = -1;
 
+	mutex_lock(&ts->lock);
 	ret = gtp_wakeup_sleep(ts);
 
 #if GTP_SLIDE_WAKEUP
 	doze_status = DOZE_DISABLED;
 #endif
 
-	if (ret < 0)
+	if (ret <= 0)
 		dev_err(&ts->client->dev, "GTP resume failed.\n");
 
 	if (ts->use_irq)
@@ -1927,6 +2054,7 @@
 	ts->gtp_is_suspend = 0;
 	gtp_esd_switch(ts->client, SWITCH_ON);
 #endif
+	mutex_unlock(&ts->lock);
 }
 
 #if defined(CONFIG_FB)
diff --git a/drivers/input/touchscreen/gt9xx/gt9xx.h b/drivers/input/touchscreen/gt9xx/gt9xx.h
index 1fdbfa3..1d31f2a 100644
--- a/drivers/input/touchscreen/gt9xx/gt9xx.h
+++ b/drivers/input/touchscreen/gt9xx/gt9xx.h
@@ -36,6 +36,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/firmware.h>
 #include <linux/debugfs.h>
+#include <linux/mutex.h>
 
 #if defined(CONFIG_FB)
 #include <linux/notifier.h>
@@ -46,12 +47,15 @@
 #endif
 
 #define GOODIX_MAX_CFG_GROUP	6
+#define GTP_FW_NAME_MAXSIZE	50
+
 struct goodix_ts_platform_data {
 	int irq_gpio;
 	u32 irq_gpio_flags;
 	int reset_gpio;
 	u32 reset_gpio_flags;
 	const char *product_id;
+	const char *fw_name;
 	u32 x_max;
 	u32 y_max;
 	u32 x_min;
@@ -62,6 +66,7 @@
 	u32 panel_maxy;
 	bool no_force_update;
 	bool i2c_pull_up;
+	bool enable_power_off;
 	size_t config_data_len[GOODIX_MAX_CFG_GROUP];
 	u8 *config_data[GOODIX_MAX_CFG_GROUP];
 };
@@ -73,6 +78,7 @@
 	struct hrtimer timer;
 	struct workqueue_struct *goodix_wq;
 	struct work_struct	work;
+	char fw_name[GTP_FW_NAME_MAXSIZE];
 	s32 irq_is_disabled;
 	s32 use_irq;
 	u16 abs_x_max;
@@ -89,6 +95,8 @@
 	u8  fixed_cfg;
 	u8  esd_running;
 	u8  fw_error;
+	bool power_on;
+	struct mutex lock;
 	struct regulator *avdd;
 	struct regulator *vdd;
 	struct regulator *vcc_i2c;
@@ -107,7 +115,6 @@
 #define GTP_CHANGE_X2Y			0
 #define GTP_DRIVER_SEND_CFG		1
 #define GTP_HAVE_TOUCH_KEY		1
-#define GTP_POWER_CTRL_SLEEP	0
 
 /* auto updated by .bin file as default */
 #define GTP_AUTO_UPDATE			0
@@ -119,6 +126,7 @@
 #define GTP_ESD_PROTECT			0
 #define GTP_WITH_PEN			0
 
+/* This cannot work when enable-power-off is on */
 #define GTP_SLIDE_WAKEUP		0
 /* double-click wakeup, function together with GTP_SLIDE_WAKEUP */
 #define GTP_DBL_CLK_WAKEUP		0
diff --git a/drivers/media/platform/msm/Kconfig b/drivers/media/platform/msm/Kconfig
index e344719..adef2b9 100644
--- a/drivers/media/platform/msm/Kconfig
+++ b/drivers/media/platform/msm/Kconfig
@@ -19,10 +19,6 @@
 	help
 	  Enable printk() debug for msm camera
 
-if MSM_CAMERA
-source "drivers/media/platform/msm/camera_v1/Kconfig"
-endif # MSM_CAMERA
-
 menuconfig MSMB_CAMERA
 	bool "Qualcomm MSM camera and video capture 2.0 support"
 	depends on ARCH_MSM && VIDEO_V4L2 && I2C
diff --git a/drivers/media/platform/msm/Makefile b/drivers/media/platform/msm/Makefile
index c1d86df..8ea6a4a 100644
--- a/drivers/media/platform/msm/Makefile
+++ b/drivers/media/platform/msm/Makefile
@@ -1,6 +1,6 @@
 obj-$(CONFIG_MSM_VIDC_V4L2) += vidc/
 obj-$(CONFIG_MSM_WFD) += wfd/
 obj-$(CONFIG_DVB_MPQ) += dvb/
-obj-$(CONFIG_MSM_CAMERA) += camera_v1/
+
 obj-$(CONFIG_MSMB_CAMERA) += camera_v2/
 obj-y += vcap/
diff --git a/drivers/media/platform/msm/camera_v1/Kconfig b/drivers/media/platform/msm/camera_v1/Kconfig
deleted file mode 100644
index ac449cc..0000000
--- a/drivers/media/platform/msm/camera_v1/Kconfig
+++ /dev/null
@@ -1,409 +0,0 @@
-config MSM_CAMERA_V4L2
-        bool "MSM Camera V4L2 Interface"
-        depends on MSM_CAMERA
-        default n
-        ---help---
-          This flag enables V4L2 interface of MSM
-          camera driver. If enabled, application interacts
-          with /dev/video0 through V4L2 APIs. Otherwise,
-          native APIs are used through /dev/config0, /dev/frame0,
-          and /dev/control0.
-
-comment "Camera Sensor Selection"
-config MT9T013
-	bool "Sensor mt9t013 (BAYER 3M)"
-	depends on MSM_CAMERA && !ARCH_MSM8X60 && !ARCH_MSM8960 && !MSM_CAMERA_V4L2
-	default y
-	---help---
-	  MICRON 3M Bayer Sensor with AutoFocus
-config MT9D113
-	bool "Sensor mt9d113 (YUV 2M)"
-	depends on MSM_CAMERA && ARCH_MSM8X60 && !MSM_CAMERA_V4L2
-	default y
-	---help---
-	  MICRON 2M YUV Sensor
-	  This sensor is the front camera on QT8660.
-	  This uses csi mipi interface.
-	  This sensor is used only on QT device.
-config MT9D112
-	bool "Sensor mt9d112 (YUV 2M)"
-	depends on MSM_CAMERA && !ARCH_MSM8X60 && !ARCH_MSM8960 && !MSM_CAMERA_V4L2
-	default y
-	---help---
-	  MICRON 2M YUV Sensor
-config IMX074
-	bool "Sensor IMX074 (BAYER 13.5M)"
-	depends on MSM_CAMERA
-	---help---
-	SONY 13.5 MP Bayer Sensor
-config OV5640
-	bool "Sensor OV5640 (YUV 5M)"
-	depends on MSM_CAMERA && !MSM_CAMERA_V4L2
-	default n
-	---help---
-	Omni 5M YUV Sensor
-
-config OV5647
-	bool "Sensor ov5647 (BAYER 5M)"
-	depends on MSM_CAMERA
-	---help---
-	  OV 5M Bayer Sensor with AutoFocus
-
-config AD5046_ACT
-	bool "Lens actuator ad5046"
-	depends on MSM_CAMERA && OV5647
-	---help---
-	  ad5046 lens actuator driver for ov5647.
-	  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)
-	default n
-	---help---
-	  Omni Vision VGA YUV Sensor for QRD Devices
-config MT9M114
-        bool "Sensor MT9M114 (YUV 1.26M)"
-        depends on MSM_CAMERA
-        ---help---
-        APTINA 1.26 MP yuv Sensor
-config WEBCAM_OV7692
-	bool "Sensor OV7692 (VGA YUV)"
-	depends on MSM_CAMERA && ARCH_MSM8X60 && !MSM_CAMERA_V4L2
-	default y
-	---help---
-	  Omni Vision VGA YUV Sensor.
-config WEBCAM_OV9726
-	bool "Sensor OV9726 (VGA Bayer)"
-	depends on MSM_CAMERA && (ARCH_MSM8X60 || ARCH_MSM7X30 || ARCH_MSM7X27A)
-	default n
-	---help---
-	  Omni Vision VGA Bayer Sensor.
-#	This Senosr is used as a webcam.
-#	This uses the CSI interface.
-config VX6953
-	bool "Sensor VX6953 (BAYER 5M)"
-	depends on MSM_CAMERA && (ARCH_MSM7X30 || ARCH_MSM8X60) && !MSM_CAMERA_V4L2
-	default y
-	---help---
-	STM 5M Bayer Sensor with EDOF
-config SN12M0PZ
-	bool "Sensor sn12m0pz (Bayer 12 MP)"
-	depends on MSM_CAMERA && ARCH_MSM7X30 && !MSM_CAMERA_V4L2
-	default y
-	---help---
-	  Sony 12 MP Bayer Sensor
-config MT9P012
-	bool "Sensor mt9p012 (BAYER 5M)"
-	depends on MSM_CAMERA && !ARCH_MSM8X60 && !MSM_CAMERA_V4L2
-	default y
-	---help---
-	  MICRON 5M Bayer Sensor with Autofocus
-
-choice
-	prompt "AF module"
-	depends on MT9P012 && !ARCH_MSM8X60 && !MSM_CAMERA_V4L2
-	default MSM_CAMERA_AF_FOXCONN
-
-config MSM_CAMERA_AF_FOXCONN
-	bool "FOXCONN Module"
-	help
-	  This driver supports FOXCONN AF module for 5M Bayer sensor
-
-config MSM_CAMERA_AF_BAM
-	bool "BAM Module"
-	help
-	  This driver supports BAM AF module for 5M Bayer sensor
-
-endchoice
-
-config MT9P012_KM
-	bool "Sensor mt9p012 KM module (BAYER 5M)"
-	depends on MSM_CAMERA && !ARCH_MSM8X60 && !MSM_CAMERA_V4L2
-	default y
-	---help---
-	  MICRON 5M Bayer Sensor KM modules with Autofocus
-
-config MT9E013
-	bool "Sensor mt9e013 module (BAYER 8M)"
-	depends on MSM_CAMERA && (ARCH_MSM7X30 || ARCH_MSM8X60 || ARCH_MSM7X27A)
-	default n
-	---help---
-	  Aptina 8M Bayer Sensor modules with Autofocus
-
-config IMX074_ACT
-	bool "Actuator IMX074 (BAYER 13.5M)"
-	depends on MSM_CAMERA
-	---help---
-	Actuator for SONY 13.5 MP Bayer Sensor
-
-config S5K3E2FX
-	bool "Sensor s5k3e2fx (Samsung 5M)"
-	depends on MSM_CAMERA && !ARCH_MSM8X60 && !MSM_CAMERA_V4L2
-	default y
-	---help---
-	  Samsung 5M with Autofocus
-
-config QS_S5K4E1
-	bool "Sensor qs_s5k4e1 (Samsung 5M)"
-	depends on MSM_CAMERA && ARCH_MSM8X60 && !MSM_CAMERA_V4L2
-	default y
-	---help---
-	  Samsung 5M with Autofocus
-
-config S5K4E1
-	bool "Sensor Sensor s5k4e1 (Samsung 5M)"
-	depends on MSM_CAMERA
-	default n
-	---help---
-	  Support for S5k4E1 samsung sensor driver.
-	  It is a Bayer 5MP sensor with auto focus and it supports
-	  two mipi lanes, required for msm7x2xA platform.
-	  Say Y here if this is msm7x2xA variant platform.
-
-config DW9712_ACT
-	bool "Lens actuator dw9721"
-	depends on MSM_CAMERA && S5K4E1
-	---help---
-	  dw9721 lens actuator driver for S5K4E1.
-	  Say Y here if this is msm7627A variant platform.
-
-config MSM_CAMERA_FLASH_SC628A
-	bool "Qualcomm MSM camera sc628a flash support"
-	depends on MSM_CAMERA
-	default n
-	---help---
-	  Enable support for LED flash for msm camera.
-	  It is a samtech charge pump flash driver and it
-	  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 MSM_CAMERA_LED_TRIGGER_FLASH
-	bool "Qualcomm MSM LED trigger flash support"
-	depends on MSM_CAMERA
-	default n
-	---help---
-	  Enable support for LED flash for msm camera.
-	  It creates LED trigger client, reads LED flash
-	  hardware properties provided in board file /
-	  device tree and uses these information to configure
-	  LED flash using LED trigger event function.
-
-config IMX072
-	bool "Sensor imx072 (Sony 5M)"
-	default n
-	---help---
-	  Support for IMX072 sony sensor driver.
-	  It is a Bayer 5MP sensor with auto focus and it supports
-	  two mipi lanes, required for msm7x2xA platform.
-	  Say Y here if this is msm7x2xA variant platform.
-
-config OV2720
-	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 VB6801
-	bool "Sensor vb6801"
-	depends on MSM_CAMERA && !ARCH_MSM8X60 && !MSM_CAMERA_V4L2
-	---help---
-	  5M with flash
-
-config MSM_CAMERA_FLASH
-	bool "Qualcomm MSM camera flash support"
-	depends on MSM_CAMERA
-	default y
-	---help---
-	  Enable support for LED flash for msm camera
-
-config MSM_CAMERA_SENSOR
-	bool "Qualcomm MSM camera sensor support"
-	depends on MSM_CAMERA
-
-config MSM_ACTUATOR
-	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)
-	default n
-	---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_VPE
-	tristate "Qualcomm MSM Video Pre-processing Engine support"
-	depends on MSM_CAMERA && (ARCH_MSM7X30 || ARCH_MSM8X60)
-	default y
-	---help---
-	  Enable support for Video Pre-processing Engine
-
-config MSM_CAM_IRQ_ROUTER
-	bool "Enable MSM CAM IRQ Router"
-	depends on MSM_CAMERA
-	---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.
-
-config QUP_EXCLUSIVE_TO_CAMERA
-	bool "QUP exclusive to camera"
-	depends on MSM_CAMERA
-	default y
-	---help---
-	  This flag enabled states that QUP
-	  is exclusive to camera. In case this
-	  is disabled, the lvs1 voltage is enabled
-	  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
-	---help---
-		Samsung 12 MP Bayer Sensor with auto focus, uses
-		4 mipi lanes, preview config = 1984 * 1508 at 30 fps,
-		snapshot config = 4000 * 3000 at 20 fps,
-		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)"
-	depends on MSM_CAMERA
-	---help---
-	  Omni Vision VGA YUV Sensor
diff --git a/drivers/media/platform/msm/camera_v1/Makefile b/drivers/media/platform/msm/camera_v1/Makefile
deleted file mode 100644
index eb66b29..0000000
--- a/drivers/media/platform/msm/camera_v1/Makefile
+++ /dev/null
@@ -1,59 +0,0 @@
-GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-
-ccflags-y += -Idrivers/media/platform/msm/camera_v1/io
-ccflags-y += -Idrivers/media/platform/msm/camera_v1/vfe
-obj-$(CONFIG_MSM_CAMERA) += io/
-ifeq ($(CONFIG_MSM_CAMERA_V4L2),y)
-  EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/cci
-  EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/csi
-  EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/eeprom
-  EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/sensors
-  EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/actuators
-  EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/server
-  EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/flash
-  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) += msm_gesture.o
-  obj-$(CONFIG_MSM_CAMERA) += flash/
-else
-  obj-$(CONFIG_MSM_CAMERA) += msm_camera.o
-endif
-obj-$(CONFIG_MSM_CAMERA) += vfe/
-obj-$(CONFIG_MSM_CAMERA) += msm_axi_qos.o gemini/ mercury/
-ifeq ($(CONFIG_MSM_CAMERA_V4L2),y)
-  obj-$(CONFIG_ARCH_MSM8X60) += msm_vpe.o
-  obj-$(CONFIG_ARCH_MSM7X30) += msm_vpe.o msm_axi_qos.o
-else
-  obj-$(CONFIG_ARCH_MSM8X60) += msm_vpe1.o
-  obj-$(CONFIG_ARCH_MSM7X30) += msm_vpe1.o
-endif
-obj-$(CONFIG_ARCH_MSM8960) += 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
-obj-$(CONFIG_MSM_CAMERA_AF_FOXCONN) += mt9p012_fox.o
-obj-$(CONFIG_MSM_CAMERA_AF_BAM) += mt9p012_bam.o
-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)
-  obj-$(CONFIG_VX6953) += vx6953.o vx6953_reg.o
-  obj-$(CONFIG_IMX074) += imx074.o imx074_reg.o
-  obj-$(CONFIG_MT9E013) += mt9e013.o mt9e013_reg.o
-  obj-$(CONFIG_WEBCAM_OV9726) += ov9726.o ov9726_reg.o
-  obj-$(CONFIG_OV5647) += ov5647.o ov5647_reg.o
-  obj-$(CONFIG_S5K4E1) += s5k4e1.o s5k4e1_reg.o
-  obj-$(CONFIG_WEBCAM_OV7692) += ov7692.o
-  obj-$(CONFIG_WEBCAM_OV7692_QRD) += ov7692_qrd.o
-endif
-obj-$(CONFIG_QS_S5K4E1) += qs_s5k4e1.o qs_s5k4e1_reg.o
-obj-$(CONFIG_VB6801) += vb6801.o
-obj-$(CONFIG_IMX072) += imx072.o imx072_reg.o
-obj-$(CONFIG_OV5640) += ov5640.o
-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/platform/msm/camera_v1/actuators/Makefile b/drivers/media/platform/msm/camera_v1/actuators/Makefile
deleted file mode 100644
index 95713a1..0000000
--- a/drivers/media/platform/msm/camera_v1/actuators/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1
-EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/io
-obj-$(CONFIG_MSM_ACTUATOR) += msm_actuator.o
diff --git a/drivers/media/platform/msm/camera_v1/actuators/msm_actuator.c b/drivers/media/platform/msm/camera_v1/actuators/msm_actuator.c
deleted file mode 100644
index 29a4866..0000000
--- a/drivers/media/platform/msm/camera_v1/actuators/msm_actuator.c
+++ /dev/null
@@ -1,692 +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_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(
-	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;
-	int16_t next_lens_pos = 0;
-	uint16_t damping_code_step = 0;
-	uint16_t wait_time = 0;
-
-	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) <=
-			(sign_direction * code_boundary);
-		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;
-		}
-		curr_lens_pos = next_lens_pos;
-	}
-
-	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);
-	}
-	return rc;
-}
-
-static int32_t msm_actuator_piezo_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)
-{
-	int32_t rc = 0;
-	int8_t sign_dir = move_params->sign_dir;
-	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;
-	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",
-		__func__,
-		dir,
-		num_steps);
-
-	if (dest_step_pos == a_ctrl->curr_step_pos)
-		return rc;
-
-	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);
-
-	while (a_ctrl->curr_step_pos != dest_step_pos) {
-		step_boundary =
-			a_ctrl->region_params[a_ctrl->curr_region_index].
-			step_bound[dir];
-		if ((dest_step_pos * sign_dir) <=
-			(step_boundary * sign_dir)) {
-
-			target_step_pos = dest_step_pos;
-			target_lens_pos =
-				a_ctrl->step_position_table[target_step_pos];
-			rc = a_ctrl->func_tbl->
-				actuator_write_focus(
-					a_ctrl,
-					curr_lens_pos,
-					&(move_params->
-						ringing_params[a_ctrl->
-						curr_region_index]),
-					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->
-				actuator_write_focus(
-					a_ctrl,
-					curr_lens_pos,
-					&(move_params->
-						ringing_params[a_ctrl->
-						curr_region_index]),
-					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)
-{
-	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__);
-
-	for (; data_size > 0; data_size--)
-		max_code_size *= 2;
-
-	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;
-	a_ctrl->step_position_table[step_index++] = cur_code;
-	for (region_index = 0;
-		region_index < a_ctrl->region_size;
-		region_index++) {
-		code_per_step =
-			a_ctrl->region_params[region_index].code_per_step;
-		step_boundary =
-			a_ctrl->region_params[region_index].
-			step_bound[MOVE_NEAR];
-		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;
-			}
-		}
-	}
-
-	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);
-	}
-
-	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;
-}
-
-
-static int32_t msm_actuator_config(struct msm_actuator_ctrl_t *a_ctrl,
-							void __user *argp)
-{
-	struct msm_actuator_cfg_data cdata;
-	int32_t rc = 0;
-	if (copy_from_user(&cdata,
-		(void *)argp,
-		sizeof(struct msm_actuator_cfg_data)))
-		return -EFAULT;
-	mutex_lock(a_ctrl->actuator_mutex);
-	CDBG("%s called, type %d\n", __func__, cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CFG_SET_ACTUATOR_INFO:
-		rc = msm_actuator_init(a_ctrl, &cdata.cfg.set_info);
-		if (rc < 0)
-			pr_err("%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);
-		if (rc < 0)
-			pr_err("%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);
-		if (rc < 0)
-			pr_err("%s move focus failed %d\n", __func__, rc);
-		break;
-
-	default:
-		break;
-	}
-	mutex_unlock(a_ctrl->actuator_mutex);
-	return rc;
-}
-
-static 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__);
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		pr_err("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	act_ctrl_t = (struct msm_actuator_ctrl_t *)(id->driver_data);
-	CDBG("%s client = %x\n",
-		__func__, (unsigned int) client);
-	act_ctrl_t->i2c_client.client = client;
-
-	/* 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__);
-	return rc;
-
-probe_failure:
-	pr_err("%s failed! rc = %d\n", __func__, rc);
-	return rc;
-}
-
-static int32_t msm_actuator_power_up(struct msm_actuator_ctrl_t *a_ctrl)
-{
-	int rc = 0;
-	CDBG("%s called\n", __func__);
-
-	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);
-		}
-	}
-	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/platform/msm/camera_v1/actuators/msm_actuator.h b/drivers/media/platform/msm/camera_v1/actuators/msm_actuator.h
deleted file mode 100644
index 19b71a6..0000000
--- a/drivers/media/platform/msm/camera_v1/actuators/msm_actuator.h
+++ /dev/null
@@ -1,99 +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_ACTUATOR_H
-#define MSM_ACTUATOR_H
-
-#include <linux/i2c.h>
-#include <mach/camera.h>
-#include <mach/gpio.h>
-#include <media/v4l2-subdev.h>
-#include <media/msm_camera.h>
-#include "msm_camera_i2c.h"
-
-#ifdef LERROR
-#undef LERROR
-#endif
-
-#ifdef LINFO
-#undef LINFO
-#endif
-
-#define LERROR(fmt, args...) pr_err(fmt, ##args)
-
-#define CONFIG_MSM_CAMERA_ACT_DBG 0
-
-#if CONFIG_MSM_CAMERA_ACT_DBG
-#define LINFO(fmt, args...) printk(fmt, ##args)
-#else
-#define LINFO(fmt, args...) CDBG(fmt, ##args)
-#endif
-
-struct msm_actuator_ctrl_t;
-
-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_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);
-	int32_t (*actuator_write_focus)(struct msm_actuator_ctrl_t *,
-			uint16_t,
-			struct damping_params_t *,
-			int8_t,
-			int16_t);
-};
-
-struct msm_actuator {
-	enum actuator_type act_type;
-	struct msm_actuator_func_tbl func_tbl;
-};
-
-struct msm_actuator_ctrl_t {
-	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 v4l2_subdev_ops *act_v4l2_subdev_ops;
-
-	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 region_size;
-	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 *)
-
-#endif
diff --git a/drivers/media/platform/msm/camera_v1/cci/Makefile b/drivers/media/platform/msm/camera_v1/cci/Makefile
deleted file mode 100644
index 0f23f6c..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1 -Idrivers/media/platform/msm/camera_v1/server
-obj-$(CONFIG_MSM_CCI) += msm_cci.o
diff --git a/drivers/media/platform/msm/camera_v1/cci/msm_cam_cci_hwreg.h b/drivers/media/platform/msm/camera_v1/cci/msm_cam_cci_hwreg.h
deleted file mode 100644
index 0262eb4..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/cci/msm_cci.c b/drivers/media/platform/msm/camera_v1/cci/msm_cci.c
deleted file mode 100644
index 4da5897..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/cci/msm_cci.h b/drivers/media/platform/msm/camera_v1/cci/msm_cci.h
deleted file mode 100644
index 827916d..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/cpp/Makefile b/drivers/media/platform/msm/camera_v1/cpp/Makefile
deleted file mode 100644
index aa4c362..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1
-ccflags-y += -Idrivers/media/platform/msm/camera_v1/io
-obj-$(CONFIG_MSM_CPP) += msm_cpp.o
-
diff --git a/drivers/media/platform/msm/camera_v1/cpp/msm_cpp.c b/drivers/media/platform/msm/camera_v1/cpp/msm_cpp.c
deleted file mode 100644
index cd932bd..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/cpp/msm_cpp.h b/drivers/media/platform/msm/camera_v1/cpp/msm_cpp.h
deleted file mode 100644
index f585569..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/csi/Makefile b/drivers/media/platform/msm/camera_v1/csi/Makefile
deleted file mode 100644
index 6284511..0000000
--- a/drivers/media/platform/msm/camera_v1/csi/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-ccflags-y += -Idrivers/media/platform/msm/camera_v1 -Idrivers/media/platform/msm/camera_v1/server
-ifeq ($(CONFIG_MSM_CSI20_HEADER),y)
-  ccflags-y += -Idrivers/media/platform/msm/camera_v1/csi/include/csi2.0
-else ifeq ($(CONFIG_MSM_CSI30_HEADER),y)
-  ccflags-y += -Idrivers/media/platform/msm/camera_v1/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
diff --git a/drivers/media/platform/msm/camera_v1/csi/include/csi2.0/msm_csid_hwreg.h b/drivers/media/platform/msm/camera_v1/csi/include/csi2.0/msm_csid_hwreg.h
deleted file mode 100644
index cc8a9cf..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/csi/include/csi2.0/msm_csiphy_hwreg.h b/drivers/media/platform/msm/camera_v1/csi/include/csi2.0/msm_csiphy_hwreg.h
deleted file mode 100644
index 9263483..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/csi/include/csi2.0/msm_ispif_hwreg.h b/drivers/media/platform/msm/camera_v1/csi/include/csi2.0/msm_ispif_hwreg.h
deleted file mode 100644
index 1864d40..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/csi/include/csi3.0/msm_csid_hwreg.h b/drivers/media/platform/msm/camera_v1/csi/include/csi3.0/msm_csid_hwreg.h
deleted file mode 100644
index 7f35c2c..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/csi/include/csi3.0/msm_csiphy_hwreg.h b/drivers/media/platform/msm/camera_v1/csi/include/csi3.0/msm_csiphy_hwreg.h
deleted file mode 100644
index c290731..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/csi/include/csi3.0/msm_ispif_hwreg.h b/drivers/media/platform/msm/camera_v1/csi/include/csi3.0/msm_ispif_hwreg.h
deleted file mode 100644
index 4b69dda..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/csi/msm_csi2_register.c b/drivers/media/platform/msm/camera_v1/csi/msm_csi2_register.c
deleted file mode 100644
index cebfa7f..0000000
--- a/drivers/media/platform/msm/camera_v1/csi/msm_csi2_register.c
+++ /dev/null
@@ -1,50 +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,
-	uint8_t csiphy_code_index, uint8_t csid_core_index,
-	struct msm_cam_server_dev *server_dev)
-{
-	int rc = -ENODEV;
-
-	CDBG("%s csiphy sel %d csid sel %d\n", __func__, csiphy_code_index,
-		csid_core_index);
-	/* register csiphy subdev */
-	p_mctl->csiphy_sdev = server_dev->csiphy_device[csiphy_code_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[csid_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/platform/msm/camera_v1/csi/msm_csi_register.h b/drivers/media/platform/msm/camera_v1/csi/msm_csi_register.h
deleted file mode 100644
index b276267..0000000
--- a/drivers/media/platform/msm/camera_v1/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,
-	uint8_t csiphy_code_index, uint8_t csid_core_index,
-	struct msm_cam_server_dev *server_dev);
diff --git a/drivers/media/platform/msm/camera_v1/csi/msm_csic.c b/drivers/media/platform/msm/camera_v1/csi/msm_csic.c
deleted file mode 100644
index 34489cb..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/csi/msm_csic.h b/drivers/media/platform/msm/camera_v1/csi/msm_csic.h
deleted file mode 100644
index f8aa92a..0000000
--- a/drivers/media/platform/msm/camera_v1/csi/msm_csic.h
+++ /dev/null
@@ -1,42 +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_CSIC_H
-#define MSM_CSIC_H
-
-#include <linux/clk.h>
-#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;
-	struct resource *mem;
-	struct resource *irq;
-	struct resource *io;
-	void __iomem *base;
-	struct mutex mutex;
-	uint32_t hw_version;
-
-	struct clk *csic_clk[5];
-};
-
-#define VIDIOC_MSM_CSIC_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct csic_cfg_data*)
-
-#define VIDIOC_MSM_CSIC_RELEASE \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct v4l2_subdev*)
-
-#endif
diff --git a/drivers/media/platform/msm/camera_v1/csi/msm_csic_register.c b/drivers/media/platform/msm/camera_v1/csi/msm_csic_register.c
deleted file mode 100644
index 660fdaf..0000000
--- a/drivers/media/platform/msm/camera_v1/csi/msm_csic_register.c
+++ /dev/null
@@ -1,37 +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,
-	uint8_t csiphy_code_index, uint8_t csid_core_index,
-	struct msm_cam_server_dev *server_dev)
-{
-	int rc = -ENODEV;
-
-	p_mctl->csic_sdev = server_dev->csic_device[csid_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/platform/msm/camera_v1/csi/msm_csid.c b/drivers/media/platform/msm/camera_v1/csi/msm_csid.c
deleted file mode 100644
index c1ffac3..0000000
--- a/drivers/media/platform/msm/camera_v1/csi/msm_csid.c
+++ /dev/null
@@ -1,649 +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/module.h>
-#include <linux/of.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 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)
-{
-	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);
-		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 +
-			(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 +
-			(csid_lut_params->vc_cfg[i].cid * 4));
-	}
-	return rc;
-}
-
-#if DBG_CSID
-static void msm_csid_set_debug_reg(void __iomem *csidbase,
-	struct msm_camera_csid_params *csid_params)
-{
-	uint32_t val = 0;
-	val = ((1 << csid_params->lane_cnt) - 1) << 20;
-	msm_camera_io_w(0x7f010800 | val, csidbase + CSID_IRQ_MASK_ADDR);
-	msm_camera_io_w(0x7f010800 | val, csidbase + CSID_IRQ_CLEAR_CMD_ADDR);
-}
-#else
-static void msm_csid_set_debug_reg(void __iomem *csidbase,
-	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)
-{
-	int rc = 0;
-	uint32_t val = 0;
-	void __iomem *csidbase;
-	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);
-	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);
-	}
-
-	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;
-}
-
-static irqreturn_t msm_csid_irq(int irq_num, void *data)
-{
-	uint32_t irq;
-	struct csid_device *csid_dev = data;
-	if (!csid_dev) {
-		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);
-	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)
-{
-	BUG_ON(!chip);
-	chip->ident = V4L2_IDENT_CSID;
-	chip->revision = 0;
-	return 0;
-}
-
-static struct msm_cam_clk_info csid_8960_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)
-{
-	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;
-		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;
-			}
-		}
-	}
-
-	csid_dev->hw_version =
-		msm_camera_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)
-{
-	int rc = 0;
-	struct csid_cfg_data cdata;
-
-	if (!csid_dev) {
-		pr_err("%s:%d csid_dev NULL\n", __func__, __LINE__);
-		return -EINVAL;
-	}
-
-	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;
-}
-
-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);
-	switch (cmd) {
-	case VIDIOC_MSM_CSID_CFG:
-		rc = msm_csid_cmd(csid_dev, arg);
-		break;
-	case VIDIOC_MSM_CSID_RELEASE:
-		rc = msm_csid_release(csid_dev);
-		break;
-	default:
-		pr_err("%s: command not found\n", __func__);
-	}
-	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 = {
-	.core = &msm_csid_subdev_core_ops,
-};
-
-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__);
-	new_csid_dev = kzalloc(sizeof(struct csid_device), GFP_KERNEL);
-	if (!new_csid_dev) {
-		pr_err("%s: no enough memory\n", __func__);
-		return -ENOMEM;
-	}
-
-	v4l2_subdev_init(&new_csid_dev->subdev, &msm_csid_subdev_ops);
-	new_csid_dev->subdev.internal_ops = &msm_csid_internal_ops;
-	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) {
-		pr_err("%s: no mem resource?\n", __func__);
-		rc = -ENODEV;
-		goto csid_no_resource;
-	}
-	new_csid_dev->irq = platform_get_resource_byname(pdev,
-					IORESOURCE_IRQ, "csid");
-	if (!new_csid_dev->irq) {
-		pr_err("%s: no irq resource?\n", __func__);
-		rc = -ENODEV;
-		goto csid_no_resource;
-	}
-	new_csid_dev->io = request_mem_region(new_csid_dev->mem->start,
-		resource_size(new_csid_dev->mem), pdev->name);
-	if (!new_csid_dev->io) {
-		pr_err("%s: no valid mem region\n", __func__);
-		rc = -EBUSY;
-		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) {
-		release_mem_region(new_csid_dev->mem->start,
-			resource_size(new_csid_dev->mem));
-		pr_err("%s Error registering irq ", __func__);
-		goto csid_no_resource;
-	}
-
-	new_csid_dev->csid_state = CSID_POWER_DOWN;
-	return 0;
-
-csid_no_resource:
-	mutex_destroy(&new_csid_dev->mutex);
-	kfree(new_csid_dev);
-	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,
-	},
-};
-
-static int __init msm_csid_init_module(void)
-{
-	return platform_driver_register(&csid_driver);
-}
-
-static void __exit msm_csid_exit_module(void)
-{
-	platform_driver_unregister(&csid_driver);
-}
-
-module_init(msm_csid_init_module);
-module_exit(msm_csid_exit_module);
-MODULE_DESCRIPTION("MSM CSID driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/platform/msm/camera_v1/csi/msm_csid.h b/drivers/media/platform/msm/camera_v1/csi/msm_csid.h
deleted file mode 100644
index 252f5fd..0000000
--- a/drivers/media/platform/msm/camera_v1/csi/msm_csid.h
+++ /dev/null
@@ -1,49 +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_CSID_H
-#define MSM_CSID_H
-
-#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;
-	struct v4l2_subdev subdev;
-	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];
-};
-
-#define VIDIOC_MSM_CSID_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct csic_cfg_data*)
-
-#define VIDIOC_MSM_CSID_RELEASE \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct v4l2_subdev*)
-#endif
-
diff --git a/drivers/media/platform/msm/camera_v1/csi/msm_csiphy.c b/drivers/media/platform/msm/camera_v1/csi/msm_csiphy.c
deleted file mode 100644
index 0c754e9..0000000
--- a/drivers/media/platform/msm/camera_v1/csi/msm_csiphy.c
+++ /dev/null
@@ -1,465 +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/of.h>
-#include <linux/module.h>
-#include <mach/board.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)
-{
-	int rc = 0;
-	int j = 0;
-	uint32_t val = 0;
-	uint8_t lane_cnt = 0;
-	uint16_t lane_mask = 0;
-	void __iomem *csiphybase;
-	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 (csiphy_params->lane_cnt < 1 || csiphy_params->lane_cnt > 4) {
-		pr_err("%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);
-
-	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,
-			 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;
-	}
-	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;
-
-	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);
-	}
-	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)
-{
-	BUG_ON(!chip);
-	chip->ident = V4L2_IDENT_CSIPHY;
-	chip->revision = 0;
-	return 0;
-}
-
-static struct msm_cam_clk_info csiphy_8960_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)
-{
-	int rc = 0;
-	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);
-
-	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;
-	}
-
-#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)
-{
-	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;
-
-	if (!csiphy_dev || !csiphy_dev->ref_count) {
-		pr_err("%s csiphy dev NULL / ref_count ZERO\n", __func__);
-		return 0;
-	}
-
-	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);
-
-#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);
-	switch (cmd) {
-	case VIDIOC_MSM_CSIPHY_CFG:
-		rc = msm_csiphy_cmd(csiphy_dev, arg);
-		break;
-	case VIDIOC_MSM_CSIPHY_RELEASE:
-		rc = msm_csiphy_release(csiphy_dev, arg);
-		break;
-	default:
-		pr_err("%s: command not found\n", __func__);
-	}
-	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 = {
-	.g_chip_ident = &msm_csiphy_subdev_g_chip_ident,
-	.ioctl = &msm_csiphy_subdev_ioctl,
-};
-
-static const struct v4l2_subdev_ops msm_csiphy_subdev_ops = {
-	.core = &msm_csiphy_subdev_core_ops,
-};
-
-static int __devinit csiphy_probe(struct platform_device *pdev)
-{
-	struct csiphy_device *new_csiphy_dev;
-	int rc = 0;
-	struct msm_cam_subdev_info sd_info;
-
-	new_csiphy_dev = kzalloc(sizeof(struct csiphy_device), GFP_KERNEL);
-	if (!new_csiphy_dev) {
-		pr_err("%s: no enough memory\n", __func__);
-		return -ENOMEM;
-	}
-
-	v4l2_subdev_init(&new_csiphy_dev->subdev, &msm_csiphy_subdev_ops);
-	new_csiphy_dev->subdev.internal_ops = &msm_csiphy_internal_ops;
-	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) {
-		pr_err("%s: no mem resource?\n", __func__);
-		rc = -ENODEV;
-		goto csiphy_no_resource;
-	}
-	new_csiphy_dev->irq = platform_get_resource_byname(pdev,
-					IORESOURCE_IRQ, "csiphy");
-	if (!new_csiphy_dev->irq) {
-		pr_err("%s: no irq resource?\n", __func__);
-		rc = -ENODEV;
-		goto csiphy_no_resource;
-	}
-	new_csiphy_dev->io = request_mem_region(new_csiphy_dev->mem->start,
-		resource_size(new_csiphy_dev->mem), pdev->name);
-	if (!new_csiphy_dev->io) {
-		pr_err("%s: no valid mem region\n", __func__);
-		rc = -EBUSY;
-		goto csiphy_no_resource;
-	}
-
-	rc = request_irq(new_csiphy_dev->irq->start, msm_csiphy_irq,
-		IRQF_TRIGGER_RISING, "csiphy", new_csiphy_dev);
-	if (rc < 0) {
-		release_mem_region(new_csiphy_dev->mem->start,
-			resource_size(new_csiphy_dev->mem));
-		pr_err("%s: irq request fail\n", __func__);
-		rc = -EBUSY;
-		goto csiphy_no_resource;
-	}
-	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;
-	return 0;
-
-csiphy_no_resource:
-	mutex_destroy(&new_csiphy_dev->mutex);
-	kfree(new_csiphy_dev);
-	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,
-	},
-};
-
-static int __init msm_csiphy_init_module(void)
-{
-	return platform_driver_register(&csiphy_driver);
-}
-
-static void __exit msm_csiphy_exit_module(void)
-{
-	platform_driver_unregister(&csiphy_driver);
-}
-
-module_init(msm_csiphy_init_module);
-module_exit(msm_csiphy_exit_module);
-MODULE_DESCRIPTION("MSM CSIPHY driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/platform/msm/camera_v1/csi/msm_csiphy.h b/drivers/media/platform/msm/camera_v1/csi/msm_csiphy.h
deleted file mode 100644
index 93c9758..0000000
--- a/drivers/media/platform/msm/camera_v1/csi/msm_csiphy.h
+++ /dev/null
@@ -1,49 +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_CSIPHY_H
-#define MSM_CSIPHY_H
-
-#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;
-	struct v4l2_subdev subdev;
-	struct resource *mem;
-	struct resource *irq;
-	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];
-};
-
-#define VIDIOC_MSM_CSIPHY_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 7, struct csiphy_cfg_data*)
-
-#define VIDIOC_MSM_CSIPHY_RELEASE \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 9, void *)
-#endif
diff --git a/drivers/media/platform/msm/camera_v1/csi/msm_ispif.c b/drivers/media/platform/msm/camera_v1/csi/msm_ispif.c
deleted file mode 100644
index 009a8d0..0000000
--- a/drivers/media/platform/msm/camera_v1/csi/msm_ispif.c
+++ /dev/null
@@ -1,928 +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/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 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)
-{
-	int rc = 0;
-	uint32_t data = (0x1 << STROBED_RST_EN);
-	uint16_t intfnum = 0, mask = intfmask;
-
-	while (mask != 0) {
-		if (!(intfmask & (0x1 << intfnum))) {
-			mask >>= 1;
-			intfnum++;
-			continue;
-		}
-		switch (intfnum) {
-		case PIX0:
-			data |= (0x1 << PIX_0_VFE_RST_STB) |
-				(0x1 << PIX_0_CSID_RST_STB);
-			ispif->pix_sof_count = 0;
-			break;
-
-		case RDI0:
-			data |= (0x1 << RDI_0_VFE_RST_STB) |
-				(0x1 << RDI_0_CSID_RST_STB);
-			break;
-
-		case PIX1:
-			data |= (0x1 << PIX_1_VFE_RST_STB) |
-				(0x1 << PIX_1_CSID_RST_STB);
-			break;
-
-		case RDI1:
-			data |= (0x1 << RDI_1_VFE_RST_STB) |
-				(0x1 << RDI_1_CSID_RST_STB);
-			break;
-
-		case RDI2:
-			data |= (0x1 << RDI_2_VFE_RST_STB) |
-				(0x1 << RDI_2_CSID_RST_STB);
-			break;
-
-		default:
-			rc = -EINVAL;
-			break;
-		}
-		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);
-		rc = wait_for_completion_interruptible(&ispif->reset_complete);
-	}
-	return rc;
-}
-
-static int msm_ispif_reset(struct ispif_device *ispif)
-{
-	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;
-}
-
-static int msm_ispif_subdev_g_chip_ident(struct v4l2_subdev *sd,
-			struct v4l2_dbg_chip_ident *chip)
-{
-	BUG_ON(!chip);
-	chip->ident = V4L2_IDENT_ISPIF;
-	chip->revision = 0;
-	return 0;
-}
-
-static void msm_ispif_sel_csid_core(struct ispif_device *ispif,
-	uint8_t intftype, uint8_t csid, uint8_t vfe_intf)
-{
-	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);
-	}
-	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;
-
-	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));
-	}
-}
-
-static void msm_ispif_enable_intf_cids(struct ispif_device *ispif,
-	uint8_t intftype, uint16_t cid_mask, uint8_t vfe_intf)
-{
-	uint32_t data = 0;
-	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 |= cid_mask;
-		msm_camera_io_w(data, ispif->base +
-			ISPIF_PIX_0_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
-		break;
-
-	case RDI0:
-		data = msm_camera_io_r(ispif->base +
-			ISPIF_RDI_0_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
-		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));
-		break;
-
-	case RDI1:
-		data = msm_camera_io_r(ispif->base +
-			ISPIF_RDI_1_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
-		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));
-		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)
-{
-	uint32_t params_len;
-	struct msm_ispif_params *ispif_params;
-	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);
-	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_camera_io_w(ISPIF_IRQ_STATUS_MASK, ispif->base +
-					ISPIF_IRQ_MASK_ADDR);
-	msm_camera_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 +
-		 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)
-{
-	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));
-		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));
-		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));
-		break;
-
-	default:
-		break;
-	}
-	return mask;
-}
-
-static void msm_ispif_intf_cmd(struct ispif_device *ispif, uint16_t intfmask,
-	uint8_t intf_cmd_mask, uint8_t vfe_intf)
-{
-	uint8_t vc = 0, val = 0;
-	uint16_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;
-			intfnum++;
-			continue;
-		}
-
-		cid_mask = msm_ispif_get_cid_mask(ispif, intfnum, vfe_intf);
-		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));
-			}
-			vc++;
-			cid_mask >>= 4;
-		}
-		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));
-}
-
-static int msm_ispif_abort_intf_transfer(struct ispif_device *ispif,
-	uint16_t intfmask, uint8_t vfe_intf)
-{
-	int rc = 0;
-	uint8_t intf_cmd_mask = 0xAA;
-	uint16_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);
-	while (mask != 0) {
-		if (intfmask & (0x1 << intfnum))
-			ispif->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)
-{
-	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);
-	mutex_unlock(&ispif->mutex);
-	return rc;
-}
-
-static int msm_ispif_stop_intf_transfer(struct ispif_device *ispif,
-	uint16_t intfmask, uint8_t vfe_intf)
-{
-	int rc = 0;
-	uint8_t intf_cmd_mask = 0x00;
-	uint16_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);
-	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))
-					& 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))
-					& 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))
-					& 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));
-		}
-		mask >>= 1;
-		intfnum++;
-	}
-	mutex_unlock(&ispif->mutex);
-	return rc;
-}
-
-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;
-	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);
-		break;
-	case ISPIF_OFF_FRAME_BOUNDARY:
-		rc = msm_ispif_stop_intf_transfer(ispif, intf, vfe_intf);
-		break;
-	case ISPIF_OFF_IMMEDIATELY:
-		rc = msm_ispif_abort_intf_transfer(ispif, intf, vfe_intf);
-		break;
-	default:
-		break;
-	}
-	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;
-
-	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,
-			struct ispif_isr_queue_cmd, list);
-		atomic_sub(1, &ispif_irq_cnt);
-
-		if (!qcmd) {
-			spin_unlock_irqrestore(&ispif_tasklet_lock,
-				flags);
-			return;
-		}
-		list_del(&qcmd->list);
-		spin_unlock_irqrestore(&ispif_tasklet_lock,
-			flags);
-
-		kfree(qcmd);
-	}
-}
-
-static void ispif_process_irq(struct ispif_device *ispif,
-	struct ispif_irq_status *out)
-{
-	unsigned long flags;
-	struct ispif_isr_queue_cmd *qcmd;
-
-	qcmd = kzalloc(sizeof(struct ispif_isr_queue_cmd),
-		GFP_ATOMIC);
-	if (!qcmd) {
-		pr_err("ispif_process_irq: qcmd malloc failed!\n");
-		return;
-	}
-	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", __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) {
-			CDBG("%s: ispif RDI0 irq status", __func__);
-			ispif->rdi0_sof_count++;
-			send_rdi_sof(ispif, RDI_0, ispif->rdi0_sof_count);
-	}
-	if (qcmd->ispifInterruptStatus1 &
-		ISPIF_IRQ_STATUS_RDI1_SOF_MASK) {
-		CDBG("%s: ispif RDI1 irq status", __func__);
-		ispif->rdi1_sof_count++;
-		send_rdi_sof(ispif, RDI_1, ispif->rdi1_sof_count);
-	}
-	if (qcmd->ispifInterruptStatus2 &
-		ISPIF_IRQ_STATUS_RDI2_SOF_MASK) {
-		CDBG("%s: ispif RDI2 irq status", __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);
-	return;
-}
-
-static inline void msm_ispif_read_irq_status(struct ispif_irq_status *out,
-	void *data)
-{
-	uint32_t status0 = 0, status1 = 0, status2 = 0;
-	struct ispif_device *ispif = (struct ispif_device *)data;
-	out->ispifIrqStatus0 = msm_camera_io_r(ispif->base +
-		ISPIF_IRQ_STATUS_ADDR);
-	out->ispifIrqStatus1 = msm_camera_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,
-		ispif->base + ISPIF_IRQ_CLEAR_ADDR);
-	msm_camera_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) {
-		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 (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 +
-		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);
-	return IRQ_HANDLED;
-}
-
-static struct msm_cam_clk_info ispif_8960_clk_info[] = {
-	{"csi_pix_clk", 0},
-	{"csi_rdi_clk", 0},
-	{"csi_pix1_clk", 0},
-	{"csi_rdi1_clk", 0},
-	{"csi_rdi2_clk", 0},
-};
-
-static int msm_ispif_init(struct ispif_device *ispif,
-	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;
-	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,
-			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;
-	return rc;
-}
-
-static void msm_ispif_release(struct ispif_device *ispif)
-{
-	if (ispif->ispif_state != ISPIF_POWER_UP) {
-		pr_err("%s: ispif invalid state %d\n", __func__,
-			ispif->ispif_state);
-		return;
-	}
-
-	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;
-}
-
-static long msm_ispif_cmd(struct v4l2_subdev *sd, void *arg)
-{
-	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);
-		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);
-		break;
-	case ISPIF_RELEASE:
-		msm_ispif_release(ispif);
-		break;
-	default:
-		break;
-	}
-
-	return rc;
-}
-
-static long msm_ispif_subdev_ioctl(struct v4l2_subdev *sd, unsigned int cmd,
-								void *arg)
-{
-	switch (cmd) {
-	case VIDIOC_MSM_ISPIF_CFG:
-		return msm_ispif_cmd(sd, arg);
-	default:
-		return -ENOIOCTLCMD;
-	}
-}
-
-static struct v4l2_subdev_core_ops msm_ispif_subdev_core_ops = {
-	.g_chip_ident = &msm_ispif_subdev_g_chip_ident,
-	.ioctl = &msm_ispif_subdev_ioctl,
-};
-
-static struct v4l2_subdev_video_ops msm_ispif_subdev_video_ops = {
-	.s_stream = &msm_ispif_subdev_video_s_stream,
-};
-
-static const struct v4l2_subdev_ops msm_ispif_subdev_ops = {
-	.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) {
-		pr_err("%s: no enough memory\n", __func__);
-		return -ENOMEM;
-	}
-
-	v4l2_subdev_init(&ispif->subdev, &msm_ispif_subdev_ops);
-	ispif->subdev.internal_ops = &msm_ispif_internal_ops;
-	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) {
-		pr_err("%s: no mem resource?\n", __func__);
-		rc = -ENODEV;
-		goto ispif_no_resource;
-	}
-	ispif->irq = platform_get_resource_byname(pdev,
-					IORESOURCE_IRQ, "ispif");
-	if (!ispif->irq) {
-		pr_err("%s: no irq resource?\n", __func__);
-		rc = -ENODEV;
-		goto ispif_no_resource;
-	}
-	ispif->io = request_mem_region(ispif->mem->start,
-		resource_size(ispif->mem), pdev->name);
-	if (!ispif->io) {
-		pr_err("%s: no valid mem region\n", __func__);
-		rc = -EBUSY;
-		goto ispif_no_resource;
-	}
-	ispif->base = ioremap(ispif->mem->start,
-		resource_size(ispif->mem));
-	if (!ispif->base) {
-		rc = -ENOMEM;
-		goto ispif_no_mem;
-	}
-
-	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;
-	return 0;
-
-ispif_no_mem:
-	release_mem_region(ispif->mem->start,
-		resource_size(ispif->mem));
-ispif_no_resource:
-	mutex_destroy(&ispif->mutex);
-	kfree(ispif);
-	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,
-	},
-};
-
-static int __init msm_ispif_init_module(void)
-{
-	return platform_driver_register(&ispif_driver);
-}
-
-static void __exit msm_ispif_exit_module(void)
-{
-	platform_driver_unregister(&ispif_driver);
-}
-
-module_init(msm_ispif_init_module);
-module_exit(msm_ispif_exit_module);
-MODULE_DESCRIPTION("MSM ISP Interface driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/platform/msm/camera_v1/csi/msm_ispif.h b/drivers/media/platform/msm/camera_v1/csi/msm_ispif.h
deleted file mode 100644
index cb7bd80..0000000
--- a/drivers/media/platform/msm/camera_v1/csi/msm_ispif.h
+++ /dev/null
@@ -1,62 +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_ISPIF_H
-#define MSM_ISPIF_H
-
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <media/v4l2-subdev.h>
-
-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 {
-	struct platform_device *pdev;
-	struct v4l2_subdev subdev;
-	struct resource *mem;
-	struct resource *irq;
-	struct resource *io;
-	void __iomem *base;
-	struct mutex mutex;
-	uint8_t start_ack_pending;
-	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*)
-
-#endif
diff --git a/drivers/media/platform/msm/camera_v1/eeprom/Makefile b/drivers/media/platform/msm/camera_v1/eeprom/Makefile
deleted file mode 100644
index 6474aee..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/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/platform/msm/camera_v1/eeprom/imx074_eeprom.c b/drivers/media/platform/msm/camera_v1/eeprom/imx074_eeprom.c
deleted file mode 100644
index eafa9a8..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/eeprom/imx091_eeprom.c b/drivers/media/platform/msm/camera_v1/eeprom/imx091_eeprom.c
deleted file mode 100644
index 20624ac..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/eeprom/msm_camera_eeprom.c b/drivers/media/platform/msm/camera_v1/eeprom/msm_camera_eeprom.c
deleted file mode 100644
index a1b809f..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/eeprom/msm_camera_eeprom.h b/drivers/media/platform/msm/camera_v1/eeprom/msm_camera_eeprom.h
deleted file mode 100644
index 05b4533..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/flash/Makefile b/drivers/media/platform/msm/camera_v1/flash/Makefile
deleted file mode 100644
index ad1d452..0000000
--- a/drivers/media/platform/msm/camera_v1/flash/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-ccflags-y += -Idrivers/media/platform/msm/camera_v1
-ccflags-y += -Idrivers/media/platform/msm/camera_v1/io
-obj-$(CONFIG_MSM_CAMERA_FLASH) += msm_flash.o
-obj-$(CONFIG_MSM_CAMERA_FLASH_SC628A) += sc628a.o
-obj-$(CONFIG_MSM_CAMERA_FLASH_TPS61310) += tps61310.o
-obj-$(CONFIG_MSM_CAMERA_FLASH_PMIC_FLASH) += pmic8058_flash.o
-obj-$(CONFIG_MSM_CAMERA_FLASH_SGM3141) += sgm3141.o
-obj-$(CONFIG_MSM_CAMERA_FLASH_PMIC8058_PWM) += pmic8058_pwm.o
-obj-$(CONFIG_MSM_CAMERA_LED_TRIGGER_FLASH) += led_trigger_flash.o
diff --git a/drivers/media/platform/msm/camera_v1/flash/led_trigger_flash.c b/drivers/media/platform/msm/camera_v1/flash/led_trigger_flash.c
deleted file mode 100644
index cd34cde..0000000
--- a/drivers/media/platform/msm/camera_v1/flash/led_trigger_flash.c
+++ /dev/null
@@ -1,162 +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/export.h>
-#include "msm_flash.h"
-
-#define FLASH_NAME "camera-led-flash"
-static struct msm_flash_ctrl_t fctrl;
-
-static int msm_camera_led_trigger_flash(struct msm_flash_ctrl_t *fctrl,
-	uint8_t led_state)
-{
-	int rc = 0;
-	CDBG("%s:%d called led_state %d\n", __func__, __LINE__, led_state);
-
-	if (!fctrl->led_trigger[0]) {
-		pr_err("%s:%d failed\n", __func__, __LINE__);
-		return -EINVAL;
-	}
-	switch (led_state) {
-	case MSM_CAMERA_LED_OFF:
-		led_trigger_event(fctrl->led_trigger[0], 0);
-		break;
-
-	case MSM_CAMERA_LED_LOW:
-		led_trigger_event(fctrl->led_trigger[0],
-			fctrl->max_current[0] / 2);
-		break;
-
-	case MSM_CAMERA_LED_HIGH:
-		led_trigger_event(fctrl->led_trigger[0], fctrl->max_current[0]);
-		break;
-
-	case MSM_CAMERA_LED_INIT:
-	case MSM_CAMERA_LED_RELEASE:
-		led_trigger_event(fctrl->led_trigger[0], 0);
-		break;
-
-	default:
-		rc = -EFAULT;
-		break;
-	}
-	CDBG("flash_set_led_state: return %d\n", rc);
-	return rc;
-}
-
-static const struct of_device_id msm_camera_flash_dt_match[] = {
-	{.compatible = "qcom,camera-led-flash"},
-	{}
-};
-
-MODULE_DEVICE_TABLE(of, msm_camera_flash_dt_match);
-
-static struct platform_driver msm_led_trigger_flash_driver = {
-	.driver = {
-		.name = FLASH_NAME,
-		.owner = THIS_MODULE,
-		.of_match_table = msm_camera_flash_dt_match,
-	},
-};
-
-static int32_t msm_led_trigger_flash_probe(struct platform_device *pdev)
-{
-	int32_t rc = 0, i = 0;
-	struct device_node *of_node = pdev->dev.of_node;
-	struct device_node *flash_src_node = NULL;
-	uint32_t count = 0;
-
-	CDBG("%s called\n", __func__);
-
-	if (!of_node) {
-		pr_err("%s of_node NULL\n", __func__);
-		return -EINVAL;
-	}
-
-	fctrl.pdev = pdev;
-
-	rc = of_property_read_u32(of_node, "cell-index", &pdev->id);
-	if (rc < 0) {
-		pr_err("%s:%d failed\n", __func__, __LINE__);
-		return -EINVAL;
-	}
-	CDBG("%s:%d pdev id %d\n", __func__, __LINE__, pdev->id);
-
-	if (of_get_property(of_node, "qcom,flash-source", &count)) {
-		count /= sizeof(uint32_t);
-		CDBG("%s count %d\n", __func__, count);
-		if (count > MAX_LED_TRIGGERS) {
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-			return -EINVAL;
-		}
-		for (i = 0; i < count; i++) {
-			flash_src_node = of_parse_phandle(of_node,
-				"qcom,flash-source", i);
-			if (!flash_src_node) {
-				pr_err("%s:%d flash_src_node NULL\n", __func__,
-					__LINE__);
-				continue;
-			}
-
-			rc = of_property_read_string(flash_src_node,
-				"linux,default-trigger",
-				&fctrl.led_trigger_name[i]);
-			if (rc < 0) {
-				pr_err("%s:%d failed\n", __func__, __LINE__);
-				of_node_put(flash_src_node);
-				continue;
-			}
-
-			CDBG("%s default trigger %s\n", __func__,
-				fctrl.led_trigger_name[i]);
-
-			rc = of_property_read_u32(flash_src_node,
-				"qcom,max-current", &fctrl.max_current[i]);
-			if (rc < 0) {
-				pr_err("%s:%d failed rc %d\n", __func__,
-					__LINE__, rc);
-				of_node_put(flash_src_node);
-				continue;
-			}
-
-			of_node_put(flash_src_node);
-
-			CDBG("%s max_current[%d] %d\n", __func__, i,
-				fctrl.max_current[i]);
-
-			led_trigger_register_simple(fctrl.led_trigger_name[i],
-				&fctrl.led_trigger[i]);
-		}
-	}
-	rc = msm_flash_platform_probe(pdev, &fctrl);
-	return rc;
-}
-
-static int __init msm_flash_add_driver(void)
-{
-	CDBG("%s called\n", __func__);
-	return platform_driver_probe(&msm_led_trigger_flash_driver,
-		msm_led_trigger_flash_probe);
-}
-
-static struct msm_flash_fn_t msm_led_trigger_flash_func_tbl = {
-	.flash_led_config = msm_camera_led_trigger_flash,
-};
-
-static struct msm_flash_ctrl_t fctrl = {
-	.func_tbl = &msm_led_trigger_flash_func_tbl,
-};
-
-module_init(msm_flash_add_driver);
-MODULE_DESCRIPTION("LED TRIGGER FLASH");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/platform/msm/camera_v1/flash/msm_flash.c b/drivers/media/platform/msm/camera_v1/flash/msm_flash.c
deleted file mode 100644
index 6639a4b..0000000
--- a/drivers/media/platform/msm/camera_v1/flash/msm_flash.c
+++ /dev/null
@@ -1,514 +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/kernel.h>
-#include <linux/errno.h>
-#include <linux/hrtimer.h>
-#include <linux/export.h>
-#include <linux/of.h>
-#include <mach/pmic.h>
-#include <mach/camera.h>
-#include <mach/gpio.h>
-#include "msm_flash.h"
-#include "msm.h"
-
-static struct timer_list timer_flash;
-
-enum msm_cam_flash_stat {
-	MSM_CAM_FLASH_OFF,
-	MSM_CAM_FLASH_ON,
-};
-
-static int config_flash_gpio_table(enum msm_cam_flash_stat stat,
-			struct msm_camera_sensor_strobe_flash_data *sfdata)
-{
-	int rc = 0, i = 0;
-	int msm_cam_flash_gpio_tbl[][2] = {
-		{sfdata->flash_trigger, 1},
-		{sfdata->flash_charge, 1},
-		{sfdata->flash_charge_done, 0}
-	};
-
-	if (stat == MSM_CAM_FLASH_ON) {
-		for (i = 0; i < ARRAY_SIZE(msm_cam_flash_gpio_tbl); i++) {
-			rc = gpio_request(msm_cam_flash_gpio_tbl[i][0],
-							  "CAM_FLASH_GPIO");
-			if (unlikely(rc < 0)) {
-				pr_err("%s not able to get gpio\n", __func__);
-				for (i--; i >= 0; i--)
-					gpio_free(msm_cam_flash_gpio_tbl[i][0]);
-				break;
-			}
-			if (msm_cam_flash_gpio_tbl[i][1])
-				gpio_direction_output(
-					msm_cam_flash_gpio_tbl[i][0], 0);
-			else
-				gpio_direction_input(
-					msm_cam_flash_gpio_tbl[i][0]);
-		}
-	} else {
-		for (i = 0; i < ARRAY_SIZE(msm_cam_flash_gpio_tbl); i++) {
-			gpio_direction_input(msm_cam_flash_gpio_tbl[i][0]);
-			gpio_free(msm_cam_flash_gpio_tbl[i][0]);
-		}
-	}
-	return rc;
-}
-
-static int msm_strobe_flash_xenon_charge(int32_t flash_charge,
-		int32_t charge_enable, uint32_t flash_recharge_duration)
-{
-	gpio_set_value_cansleep(flash_charge, charge_enable);
-	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
-		del_timer_sync(&timer_flash);
-	return 0;
-}
-
-static void strobe_flash_xenon_recharge_handler(unsigned long data)
-{
-	unsigned long flags;
-	struct msm_camera_sensor_strobe_flash_data *sfdata =
-		(struct msm_camera_sensor_strobe_flash_data *)data;
-
-	spin_lock_irqsave(&sfdata->timer_lock, flags);
-	msm_strobe_flash_xenon_charge(sfdata->flash_charge, 1,
-		sfdata->flash_recharge_duration);
-	spin_unlock_irqrestore(&sfdata->timer_lock, flags);
-
-	return;
-}
-
-static irqreturn_t strobe_flash_charge_ready_irq(int irq_num, void *data)
-{
-	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;
-}
-
-static int msm_strobe_flash_xenon_init(
-	struct msm_camera_sensor_strobe_flash_data *sfdata)
-{
-	unsigned long flags;
-	int rc = 0;
-
-	spin_lock_irqsave(&sfdata->spin_lock, flags);
-	if (!sfdata->state) {
-
-		rc = config_flash_gpio_table(MSM_CAM_FLASH_ON, sfdata);
-		if (rc < 0) {
-			pr_err("%s: gpio_request failed\n", __func__);
-			goto go_out;
-		}
-		rc = request_irq(sfdata->irq, strobe_flash_charge_ready_irq,
-			IRQF_TRIGGER_RISING, "charge_ready", sfdata);
-		if (rc < 0) {
-			pr_err("%s: request_irq failed %d\n", __func__, rc);
-			goto go_out;
-		}
-
-		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;
-	}
-	sfdata->state++;
-go_out:
-	spin_unlock_irqrestore(&sfdata->spin_lock, flags);
-
-	return rc;
-}
-
-static int msm_strobe_flash_xenon_release
-(struct msm_camera_sensor_strobe_flash_data *sfdata, int32_t final_release)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&sfdata->spin_lock, flags);
-	if (sfdata->state > 0) {
-		if (final_release)
-			sfdata->state = 0;
-		else
-			sfdata->state--;
-
-		if (!sfdata->state) {
-			free_irq(sfdata->irq, sfdata);
-			config_flash_gpio_table(MSM_CAM_FLASH_OFF, sfdata);
-			if (timer_pending(&timer_flash))
-				del_timer_sync(&timer_flash);
-		}
-	}
-	spin_unlock_irqrestore(&sfdata->spin_lock, flags);
-	return 0;
-}
-
-static int msm_strobe_flash_ctrl(
-	struct msm_camera_sensor_strobe_flash_data *sfdata,
-	struct strobe_flash_ctrl_data *strobe_ctrl)
-{
-	int rc = 0;
-	switch (strobe_ctrl->type) {
-	case STROBE_FLASH_CTRL_INIT:
-		if (!sfdata)
-			return -ENODEV;
-		rc = msm_strobe_flash_xenon_init(sfdata);
-		break;
-	case STROBE_FLASH_CTRL_CHARGE:
-		rc = msm_strobe_flash_xenon_charge(sfdata->flash_charge,
-			strobe_ctrl->charge_en,
-			sfdata->flash_recharge_duration);
-		break;
-	case STROBE_FLASH_CTRL_RELEASE:
-		if (sfdata)
-			rc = msm_strobe_flash_xenon_release(sfdata, 0);
-		break;
-	default:
-		pr_err("Invalid Strobe Flash State\n");
-		rc = -EINVAL;
-	}
-	return rc;
-}
-
-int msm_flash_led_init(struct msm_flash_ctrl_t *fctrl)
-{
-	int rc = 0;
-	struct msm_camera_sensor_flash_external *external = NULL;
-	CDBG("%s:%d called\n", __func__, __LINE__);
-	if (!fctrl) {
-		pr_err("%s:%d fctrl NULL\n", __func__, __LINE__);
-		return -EINVAL;
-	}
-	external = &fctrl->flash_data->flash_src->_fsrc.ext_driver_src;
-	if (external->expander_info && !fctrl->expander_client) {
-		struct i2c_adapter *adapter =
-		i2c_get_adapter(external->expander_info->bus_id);
-		if (adapter)
-			fctrl->expander_client = i2c_new_device(adapter,
-				external->expander_info->board_info);
-		if (!fctrl->expander_client || !adapter) {
-			pr_err("fctrl->expander_client is not available\n");
-			rc = -ENOTSUPP;
-			return rc;
-		}
-		i2c_put_adapter(adapter);
-	}
-	rc = msm_camera_init_gpio_table(
-		fctrl->flash_data->flash_src->init_gpio_tbl,
-		fctrl->flash_data->flash_src->init_gpio_tbl_size, 1);
-	if (rc < 0)
-		pr_err("%s:%d failed\n", __func__, __LINE__);
-	return rc;
-}
-
-int msm_flash_led_release(struct msm_flash_ctrl_t *fctrl)
-{
-	struct msm_camera_sensor_flash_external *external = NULL;
-	CDBG("%s:%d called\n", __func__, __LINE__);
-	if (!fctrl) {
-		pr_err("%s:%d fctrl NULL\n", __func__, __LINE__);
-		return -EINVAL;
-	}
-	external = &fctrl->flash_data->flash_src->_fsrc.ext_driver_src;
-	msm_camera_set_gpio_table(
-		fctrl->flash_data->flash_src->set_gpio_tbl,
-		fctrl->flash_data->flash_src->set_gpio_tbl_size, 0);
-	msm_camera_init_gpio_table(
-		fctrl->flash_data->flash_src->init_gpio_tbl,
-		fctrl->flash_data->flash_src->init_gpio_tbl_size, 0);
-	if (external->expander_info && fctrl->expander_client) {
-		i2c_unregister_device(fctrl->expander_client);
-		fctrl->expander_client = NULL;
-	}
-	return 0;
-}
-
-int msm_flash_led_off(struct msm_flash_ctrl_t *fctrl)
-{
-	int rc = 0;
-	struct msm_camera_sensor_flash_external *external = NULL;
-	CDBG("%s:%d called\n", __func__, __LINE__);
-	if (!fctrl) {
-		pr_err("%s:%d fctrl NULL\n", __func__, __LINE__);
-		return -EINVAL;
-	}
-	external = &fctrl->flash_data->flash_src->_fsrc.ext_driver_src;
-	if (fctrl->flash_i2c_client && fctrl->reg_setting) {
-		rc = msm_camera_i2c_write_tbl(
-			fctrl->flash_i2c_client,
-			fctrl->reg_setting->off_setting,
-			fctrl->reg_setting->off_setting_size,
-			fctrl->reg_setting->default_data_type);
-		if (rc < 0)
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-	}
-	msm_camera_set_gpio_table(
-		fctrl->flash_data->flash_src->set_gpio_tbl,
-		fctrl->flash_data->flash_src->set_gpio_tbl_size, 0);
-
-	return rc;
-}
-
-int msm_flash_led_low(struct msm_flash_ctrl_t *fctrl)
-{
-	int rc = 0;
-	struct msm_camera_sensor_flash_external *external = NULL;
-	CDBG("%s:%d called\n", __func__, __LINE__);
-	if (!fctrl) {
-		pr_err("%s:%d fctrl NULL\n", __func__, __LINE__);
-		return -EINVAL;
-	}
-	external = &fctrl->flash_data->flash_src->_fsrc.ext_driver_src;
-	msm_camera_set_gpio_table(
-		fctrl->flash_data->flash_src->set_gpio_tbl,
-		fctrl->flash_data->flash_src->set_gpio_tbl_size, 1);
-	if (fctrl->flash_i2c_client && fctrl->reg_setting) {
-		rc = msm_camera_i2c_write_tbl(
-			fctrl->flash_i2c_client,
-			fctrl->reg_setting->low_setting,
-			fctrl->reg_setting->low_setting_size,
-			fctrl->reg_setting->default_data_type);
-		if (rc < 0)
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-	}
-	return rc;
-}
-
-int msm_flash_led_high(struct msm_flash_ctrl_t *fctrl)
-{
-	int rc = 0;
-	struct msm_camera_sensor_flash_external *external = NULL;
-	CDBG("%s:%d called\n", __func__, __LINE__);
-	if (!fctrl) {
-		pr_err("%s:%d fctrl NULL\n", __func__, __LINE__);
-		return -EINVAL;
-	}
-	external = &fctrl->flash_data->flash_src->_fsrc.ext_driver_src;
-	msm_camera_set_gpio_table(
-		fctrl->flash_data->flash_src->set_gpio_tbl,
-		fctrl->flash_data->flash_src->set_gpio_tbl_size, 1);
-	if (fctrl->flash_i2c_client && fctrl->reg_setting) {
-		rc = msm_camera_i2c_write_tbl(
-			fctrl->flash_i2c_client,
-			fctrl->reg_setting->high_setting,
-			fctrl->reg_setting->high_setting_size,
-			fctrl->reg_setting->default_data_type);
-		if (rc < 0)
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-	}
-	return rc;
-}
-
-int msm_camera_flash_led_config(struct msm_flash_ctrl_t *fctrl,
-	uint8_t led_state)
-{
-	int rc = 0;
-
-	CDBG("%s:%d called\n", __func__, __LINE__);
-	if (!fctrl->func_tbl) {
-		pr_err("%s flash func tbl NULL\n", __func__);
-		return 0;
-	}
-	switch (led_state) {
-	case MSM_CAMERA_LED_INIT:
-		if (fctrl->func_tbl->flash_led_init)
-			rc = fctrl->func_tbl->flash_led_init(fctrl);
-		break;
-
-	case MSM_CAMERA_LED_RELEASE:
-		if (fctrl->func_tbl->flash_led_release)
-			rc = fctrl->func_tbl->
-				flash_led_release(fctrl);
-		break;
-
-	case MSM_CAMERA_LED_OFF:
-		if (fctrl->func_tbl->flash_led_off)
-			rc = fctrl->func_tbl->flash_led_off(fctrl);
-		break;
-
-	case MSM_CAMERA_LED_LOW:
-		if (fctrl->func_tbl->flash_led_low)
-			rc = fctrl->func_tbl->flash_led_low(fctrl);
-		break;
-
-	case MSM_CAMERA_LED_HIGH:
-		if (fctrl->func_tbl->flash_led_high)
-			rc = fctrl->func_tbl->flash_led_high(fctrl);
-		break;
-
-	default:
-		rc = -EFAULT;
-		break;
-	}
-	return rc;
-}
-
-static struct msm_flash_ctrl_t *get_fctrl(struct v4l2_subdev *sd)
-{
-	return container_of(sd, struct msm_flash_ctrl_t, v4l2_sdev);
-}
-
-static long msm_flash_config(struct msm_flash_ctrl_t *fctrl, void __user *argp)
-{
-	long rc = 0;
-	struct flash_ctrl_data flash_info;
-	if (!argp) {
-		pr_err("%s argp NULL\n", __func__);
-		return -EINVAL;
-	}
-	if (copy_from_user(&flash_info, argp, sizeof(flash_info))) {
-		pr_err("%s:%d failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-	switch (flash_info.flashtype) {
-	case LED_FLASH:
-		if (fctrl->func_tbl->flash_led_config)
-			rc = fctrl->func_tbl->flash_led_config(fctrl,
-				flash_info.ctrl_data.led_state);
-		if (rc < 0)
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-		break;
-	case STROBE_FLASH:
-		rc = msm_strobe_flash_ctrl(fctrl->strobe_flash_data,
-			&(flash_info.ctrl_data.strobe_ctrl));
-		break;
-	default:
-		pr_err("Invalid Flash MODE\n");
-		rc = -EINVAL;
-	}
-	return rc;
-}
-
-static long msm_flash_subdev_ioctl(struct v4l2_subdev *sd,
-			unsigned int cmd, void *arg)
-{
-	struct msm_flash_ctrl_t *fctrl = NULL;
-	void __user *argp = (void __user *)arg;
-	if (!sd) {
-		pr_err("%s:%d sd NULL\n", __func__, __LINE__);
-		return -EINVAL;
-	}
-	fctrl = get_fctrl(sd);
-	if (!fctrl) {
-		pr_err("%s:%d fctrl NULL\n", __func__, __LINE__);
-		return -EINVAL;
-	}
-	switch (cmd) {
-	case VIDIOC_MSM_FLASH_LED_DATA_CFG:
-		fctrl->flash_data = (struct msm_camera_sensor_flash_data *)argp;
-		return 0;
-	case VIDIOC_MSM_FLASH_STROBE_DATA_CFG:
-		fctrl->strobe_flash_data =
-			(struct msm_camera_sensor_strobe_flash_data *)argp;
-		return 0;
-	case VIDIOC_MSM_FLASH_CFG:
-		return msm_flash_config(fctrl, argp);
-	default:
-		return -ENOIOCTLCMD;
-	}
-}
-
-static struct v4l2_subdev_core_ops msm_flash_subdev_core_ops = {
-	.ioctl = msm_flash_subdev_ioctl,
-};
-
-static struct v4l2_subdev_ops msm_flash_subdev_ops = {
-	.core = &msm_flash_subdev_core_ops,
-};
-
-int msm_flash_i2c_probe(struct i2c_client *client,
-		const struct i2c_device_id *id)
-{
-	int rc = 0;
-	struct msm_flash_ctrl_t *fctrl = NULL;
-	CDBG("%s:%d called\n", __func__, __LINE__);
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		pr_err("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	fctrl = (struct msm_flash_ctrl_t *)(id->driver_data);
-	if (fctrl->flash_i2c_client)
-		fctrl->flash_i2c_client->client = client;
-
-	/* Assign name for sub device */
-	snprintf(fctrl->v4l2_sdev.name, sizeof(fctrl->v4l2_sdev.name),
-		"%s", id->name);
-
-	/* Initialize sub device */
-	v4l2_i2c_subdev_init(&fctrl->v4l2_sdev, client, &msm_flash_subdev_ops);
-
-	CDBG("%s:%d probe success\n", __func__, __LINE__);
-	return 0;
-
-probe_failure:
-	CDBG("%s:%d probe failed\n", __func__, __LINE__);
-	return rc;
-}
-
-int msm_flash_platform_probe(struct platform_device *pdev, void *data)
-{
-	struct msm_flash_ctrl_t *fctrl = (struct msm_flash_ctrl_t *)data;
-	struct msm_cam_subdev_info sd_info;
-	CDBG("%s:%d called\n", __func__, __LINE__);
-
-	if (!fctrl) {
-		pr_err("%s fctrl NULL\n", __func__);
-		return -EINVAL;
-	}
-
-	/* Initialize sub device */
-	v4l2_subdev_init(&fctrl->v4l2_sdev, &msm_flash_subdev_ops);
-
-	/* Assign name for sub device */
-	snprintf(fctrl->v4l2_sdev.name, sizeof(fctrl->v4l2_sdev.name),
-		"%s", "msm_flash");
-
-	fctrl->pdev = pdev;
-	sd_info.sdev_type = FLASH_DEV;
-	sd_info.sd_index = pdev->id;
-	msm_cam_register_subdev_node(&fctrl->v4l2_sdev, &sd_info);
-
-	CDBG("%s:%d probe success\n", __func__, __LINE__);
-	return 0;
-}
-
-int msm_flash_create_v4l2_subdev(void *data, uint8_t sd_index)
-{
-	struct msm_flash_ctrl_t *fctrl = (struct msm_flash_ctrl_t *)data;
-	struct msm_cam_subdev_info sd_info;
-	CDBG("%s:%d called\n", __func__, __LINE__);
-
-	/* Initialize sub device */
-	v4l2_subdev_init(&fctrl->v4l2_sdev, &msm_flash_subdev_ops);
-
-	/* Assign name for sub device */
-	snprintf(fctrl->v4l2_sdev.name, sizeof(fctrl->v4l2_sdev.name),
-		"%s", "msm_flash");
-
-	sd_info.sdev_type = FLASH_DEV;
-	sd_info.sd_index = sd_index;
-	msm_cam_register_subdev_node(&fctrl->v4l2_sdev, &sd_info);
-
-	CDBG("%s:%d probe success\n", __func__, __LINE__);
-	return 0;
-}
diff --git a/drivers/media/platform/msm/camera_v1/flash/msm_flash.h b/drivers/media/platform/msm/camera_v1/flash/msm_flash.h
deleted file mode 100644
index 2513995..0000000
--- a/drivers/media/platform/msm/camera_v1/flash/msm_flash.h
+++ /dev/null
@@ -1,91 +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 MSM_FLASH_H
-#define MSM_FLASH_H
-
-#include <linux/i2c.h>
-#include <linux/leds.h>
-#include <media/v4l2-subdev.h>
-#include <mach/board.h>
-#include "msm_camera_i2c.h"
-
-#define MAX_LED_TRIGGERS 2
-
-struct msm_flash_ctrl_t;
-
-struct msm_flash_reg_t {
-	enum msm_camera_i2c_data_type default_data_type;
-	struct msm_camera_i2c_reg_conf *init_setting;
-	uint8_t init_setting_size;
-	struct msm_camera_i2c_reg_conf *off_setting;
-	uint8_t off_setting_size;
-	struct msm_camera_i2c_reg_conf *low_setting;
-	uint8_t low_setting_size;
-	struct msm_camera_i2c_reg_conf *high_setting;
-	uint8_t high_setting_size;
-};
-
-struct msm_flash_fn_t {
-	int (*flash_led_config)(struct msm_flash_ctrl_t *, uint8_t);
-	int (*flash_led_init)(struct msm_flash_ctrl_t *);
-	int (*flash_led_release)(struct msm_flash_ctrl_t *);
-	int (*flash_led_off)(struct msm_flash_ctrl_t *);
-	int (*flash_led_low)(struct msm_flash_ctrl_t *);
-	int (*flash_led_high)(struct msm_flash_ctrl_t *);
-};
-
-struct msm_flash_ctrl_t {
-	struct msm_camera_i2c_client *flash_i2c_client;
-	struct platform_device *pdev;
-	struct i2c_client *expander_client;
-	struct v4l2_subdev v4l2_sdev;
-	struct msm_camera_sensor_flash_data *flash_data;
-	struct msm_camera_sensor_strobe_flash_data *strobe_flash_data;
-	struct msm_flash_fn_t *func_tbl;
-	struct msm_flash_reg_t *reg_setting;
-	const char *led_trigger_name[MAX_LED_TRIGGERS];
-	struct led_trigger *led_trigger[MAX_LED_TRIGGERS];
-	uint32_t max_current[MAX_LED_TRIGGERS];
-	void *data;
-};
-
-int msm_flash_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id);
-
-int msm_flash_platform_probe(struct platform_device *pdev, void *data);
-
-int msm_flash_create_v4l2_subdev(void *data, uint8_t sd_index);
-
-int msm_camera_flash_led_config(struct msm_flash_ctrl_t *fctrl,
-	uint8_t led_state);
-
-int msm_flash_led_init(struct msm_flash_ctrl_t *fctrl);
-
-int msm_flash_led_release(struct msm_flash_ctrl_t *fctrl);
-
-int msm_flash_led_off(struct msm_flash_ctrl_t *fctrl);
-
-int msm_flash_led_low(struct msm_flash_ctrl_t *fctrl);
-
-int msm_flash_led_high(struct msm_flash_ctrl_t *fctrl);
-
-#define VIDIOC_MSM_FLASH_LED_DATA_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 20, void __user *)
-
-#define VIDIOC_MSM_FLASH_STROBE_DATA_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 21, void __user *)
-
-#define VIDIOC_MSM_FLASH_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 22, void __user *)
-
-#endif
diff --git a/drivers/media/platform/msm/camera_v1/flash/pmic8058_flash.c b/drivers/media/platform/msm/camera_v1/flash/pmic8058_flash.c
deleted file mode 100644
index 2017bcb..0000000
--- a/drivers/media/platform/msm/camera_v1/flash/pmic8058_flash.c
+++ /dev/null
@@ -1,79 +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/module.h>
-#include <linux/export.h>
-#include "msm_flash.h"
-
-#define SD_INDEX 0
-
-static struct msm_flash_ctrl_t fctrl;
-
-static int msm_camera_pmic_flash(struct msm_flash_ctrl_t *fctrl,
-	uint8_t led_state)
-{
-	int rc = 0;
-	struct msm_camera_sensor_flash_pmic *pmic =
-		&fctrl->flash_data->flash_src->_fsrc.pmic_src;
-
-	switch (led_state) {
-	case MSM_CAMERA_LED_OFF:
-		rc = pmic->pmic_set_current(pmic->led_src_1, 0);
-		if (pmic->num_of_src > 1)
-			rc = pmic->pmic_set_current(pmic->led_src_2, 0);
-		break;
-
-	case MSM_CAMERA_LED_LOW:
-		rc = pmic->pmic_set_current(pmic->led_src_1,
-				pmic->low_current);
-		if (pmic->num_of_src > 1)
-			rc = pmic->pmic_set_current(pmic->led_src_2, 0);
-		break;
-
-	case MSM_CAMERA_LED_HIGH:
-		rc = pmic->pmic_set_current(pmic->led_src_1,
-			pmic->high_current);
-		if (pmic->num_of_src > 1)
-			rc = pmic->pmic_set_current(pmic->led_src_2,
-				pmic->high_current);
-		break;
-
-	case MSM_CAMERA_LED_INIT:
-	case MSM_CAMERA_LED_RELEASE:
-		 break;
-
-	default:
-		rc = -EFAULT;
-		break;
-	}
-	CDBG("flash_set_led_state: return %d\n", rc);
-
-	return rc;
-}
-
-static int __init msm_flash_i2c_add_driver(void)
-{
-	CDBG("%s called\n", __func__);
-	return msm_flash_create_v4l2_subdev(&fctrl, SD_INDEX);
-}
-
-static struct msm_flash_fn_t pmic_flash_func_tbl = {
-	.flash_led_config = msm_camera_pmic_flash,
-};
-
-static struct msm_flash_ctrl_t fctrl = {
-	.func_tbl = &pmic_flash_func_tbl,
-};
-
-module_init(msm_flash_i2c_add_driver);
-MODULE_DESCRIPTION("PMIC FLASH");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/platform/msm/camera_v1/flash/pmic8058_pwm.c b/drivers/media/platform/msm/camera_v1/flash/pmic8058_pwm.c
deleted file mode 100644
index 2215340..0000000
--- a/drivers/media/platform/msm/camera_v1/flash/pmic8058_pwm.c
+++ /dev/null
@@ -1,89 +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/module.h>
-#include <linux/export.h>
-#include <linux/pwm.h>
-
-#include "msm_flash.h"
-#define SD_INDEX 0
-
-static struct msm_flash_ctrl_t fctrl;
-
-static int msm_camera_flash_pwm(struct msm_flash_ctrl_t *fctrl,
-	uint8_t led_state)
-{
-	int rc = 0;
-	struct msm_camera_sensor_flash_pwm *pwm =
-		&fctrl->flash_data->flash_src->_fsrc.pwm_src;
-	int PWM_PERIOD = USEC_PER_SEC / pwm->freq;
-
-	struct pwm_device *flash_pwm = (struct pwm_device *)fctrl->data;
-
-	if (!flash_pwm) {
-		flash_pwm = pwm_request(pwm->channel, "camera-flash");
-		if (flash_pwm == NULL || IS_ERR(flash_pwm)) {
-			pr_err("%s: FAIL pwm_request(): flash_pwm=%p\n",
-			       __func__, flash_pwm);
-			flash_pwm = NULL;
-			return -ENXIO;
-		}
-	}
-
-	switch (led_state) {
-	case MSM_CAMERA_LED_LOW:
-		rc = pwm_config(flash_pwm,
-			(PWM_PERIOD/pwm->max_load)*pwm->low_load,
-			PWM_PERIOD);
-		if (rc >= 0)
-			rc = pwm_enable(flash_pwm);
-		break;
-
-	case MSM_CAMERA_LED_HIGH:
-		rc = pwm_config(flash_pwm,
-			(PWM_PERIOD/pwm->max_load)*pwm->high_load,
-			PWM_PERIOD);
-		if (rc >= 0)
-			rc = pwm_enable(flash_pwm);
-		break;
-
-	case MSM_CAMERA_LED_OFF:
-		pwm_disable(flash_pwm);
-		break;
-	case MSM_CAMERA_LED_INIT:
-	case MSM_CAMERA_LED_RELEASE:
-		break;
-
-	default:
-		rc = -EFAULT;
-		break;
-	}
-	return rc;
-}
-
-static int __init msm_flash_i2c_add_driver(void)
-{
-	CDBG("%s called\n", __func__);
-	return msm_flash_create_v4l2_subdev(&fctrl, SD_INDEX);
-}
-
-static struct msm_flash_fn_t pmic8058_pwm_func_tbl = {
-	.flash_led_config = msm_camera_flash_pwm,
-};
-
-static struct msm_flash_ctrl_t fctrl = {
-	.func_tbl = &pmic8058_pwm_func_tbl,
-};
-
-module_init(msm_flash_i2c_add_driver);
-MODULE_DESCRIPTION("PMIC FLASH");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/platform/msm/camera_v1/flash/sc628a.c b/drivers/media/platform/msm/camera_v1/flash/sc628a.c
deleted file mode 100644
index 58824e1..0000000
--- a/drivers/media/platform/msm/camera_v1/flash/sc628a.c
+++ /dev/null
@@ -1,91 +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/module.h>
-#include <linux/export.h>
-#include "msm_flash.h"
-
-#define FLASH_NAME "sc628a"
-
-static struct msm_flash_ctrl_t fctrl;
-static struct i2c_driver sc628a_i2c_driver;
-
-static struct msm_camera_i2c_reg_conf sc628a_off_setting[] = {
-	{0x02, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf sc628a_low_setting[] = {
-	{0x02, 0x06},
-};
-
-static struct msm_camera_i2c_reg_conf sc628a_high_setting[] = {
-	{0x02, 0x49},
-};
-
-static int __exit msm_flash_i2c_remove(struct i2c_client *client)
-{
-	i2c_del_driver(&sc628a_i2c_driver);
-	return 0;
-}
-
-static const struct i2c_device_id sc628a_i2c_id[] = {
-	{FLASH_NAME, (kernel_ulong_t)&fctrl},
-	{ }
-};
-
-static struct i2c_driver sc628a_i2c_driver = {
-	.id_table = sc628a_i2c_id,
-	.probe  = msm_flash_i2c_probe,
-	.remove = __exit_p(msm_flash_i2c_remove),
-	.driver = {
-		.name = FLASH_NAME,
-	},
-};
-
-static int __init msm_flash_i2c_add_driver(void)
-{
-	CDBG("%s called\n", __func__);
-	return i2c_add_driver(&sc628a_i2c_driver);
-}
-
-static struct msm_camera_i2c_client sc628a_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_BYTE_ADDR,
-};
-
-static struct msm_flash_reg_t sc628a_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.off_setting = sc628a_off_setting,
-	.off_setting_size = ARRAY_SIZE(sc628a_off_setting),
-	.low_setting = sc628a_low_setting,
-	.low_setting_size = ARRAY_SIZE(sc628a_low_setting),
-	.high_setting = sc628a_high_setting,
-	.high_setting_size = ARRAY_SIZE(sc628a_high_setting),
-};
-
-static struct msm_flash_fn_t sc628a_func_tbl = {
-	.flash_led_config = msm_camera_flash_led_config,
-	.flash_led_init = msm_flash_led_init,
-	.flash_led_release = msm_flash_led_release,
-	.flash_led_off = msm_flash_led_off,
-	.flash_led_low = msm_flash_led_low,
-	.flash_led_high = msm_flash_led_high,
-};
-
-static struct msm_flash_ctrl_t fctrl = {
-	.flash_i2c_client = &sc628a_i2c_client,
-	.reg_setting = &sc628a_regs,
-	.func_tbl = &sc628a_func_tbl,
-};
-
-subsys_initcall(msm_flash_i2c_add_driver);
-MODULE_DESCRIPTION("SC628A FLASH");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/platform/msm/camera_v1/flash/sgm3141.c b/drivers/media/platform/msm/camera_v1/flash/sgm3141.c
deleted file mode 100644
index a8f8ca0..0000000
--- a/drivers/media/platform/msm/camera_v1/flash/sgm3141.c
+++ /dev/null
@@ -1,98 +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/module.h>
-#include <linux/export.h>
-#include <mach/gpio.h>
-#include "msm_flash.h"
-
-#define SD_INDEX 0
-
-static struct msm_flash_ctrl_t fctrl;
-
-static int msm_camera_flash_led(struct msm_flash_ctrl_t *fctrl,
-	uint8_t led_state)
-{
-	int rc = 0;
-	struct msm_camera_sensor_flash_external *external =
-		&fctrl->flash_data->flash_src->_fsrc.ext_driver_src;
-
-	CDBG("msm_camera_flash_led: %d\n", led_state);
-	switch (led_state) {
-	case MSM_CAMERA_LED_INIT:
-		rc = gpio_request(external->led_en, "sgm3141");
-		CDBG("MSM_CAMERA_LED_INIT: gpio_req: %d %d\n",
-				external->led_en, rc);
-		if (!rc)
-			gpio_direction_output(external->led_en, 0);
-		else
-			return 0;
-
-		rc = gpio_request(external->led_flash_en, "sgm3141");
-		CDBG("MSM_CAMERA_LED_INIT: gpio_req: %d %d\n",
-				external->led_flash_en, rc);
-		if (!rc)
-			gpio_direction_output(external->led_flash_en, 0);
-
-			break;
-
-	case MSM_CAMERA_LED_RELEASE:
-		CDBG("MSM_CAMERA_LED_RELEASE\n");
-		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);
-		break;
-
-	case MSM_CAMERA_LED_OFF:
-		CDBG("MSM_CAMERA_LED_OFF\n");
-		gpio_set_value_cansleep(external->led_en, 0);
-		gpio_set_value_cansleep(external->led_flash_en, 0);
-		break;
-
-	case MSM_CAMERA_LED_LOW:
-		CDBG("MSM_CAMERA_LED_LOW\n");
-		gpio_set_value_cansleep(external->led_en, 1);
-		gpio_set_value_cansleep(external->led_flash_en, 1);
-		break;
-
-	case MSM_CAMERA_LED_HIGH:
-		CDBG("MSM_CAMERA_LED_HIGH\n");
-		gpio_set_value_cansleep(external->led_en, 1);
-		gpio_set_value_cansleep(external->led_flash_en, 1);
-		break;
-
-	default:
-		rc = -EFAULT;
-		break;
-	}
-
-	return rc;
-}
-
-static int __init msm_flash_i2c_add_driver(void)
-{
-	CDBG("%s called\n", __func__);
-	return msm_flash_create_v4l2_subdev(&fctrl, SD_INDEX);
-}
-
-static struct msm_flash_fn_t sgm3141_func_tbl = {
-	.flash_led_config = msm_camera_flash_led,
-};
-
-static struct msm_flash_ctrl_t fctrl = {
-	.func_tbl = &sgm3141_func_tbl,
-};
-
-module_init(msm_flash_i2c_add_driver);
-MODULE_DESCRIPTION("SGM3141 FLASH");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/platform/msm/camera_v1/flash/tps61310.c b/drivers/media/platform/msm/camera_v1/flash/tps61310.c
deleted file mode 100644
index 63e6955..0000000
--- a/drivers/media/platform/msm/camera_v1/flash/tps61310.c
+++ /dev/null
@@ -1,97 +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/module.h>
-#include <linux/export.h>
-#include "msm_flash.h"
-
-#define FLASH_NAME "tps61310"
-
-static struct msm_flash_ctrl_t fctrl;
-static struct i2c_driver tps61310_i2c_driver;
-
-static struct msm_camera_i2c_reg_conf tps61310_init_setting[] = {
-	{0x01, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf tps61310_off_setting[] = {
-	{0x01, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf tps61310_low_setting[] = {
-	{0x01, 0x86},
-};
-
-static struct msm_camera_i2c_reg_conf tps61310_high_setting[] = {
-	{0x01, 0x8B},
-};
-
-static int __exit msm_flash_i2c_remove(struct i2c_client *client)
-{
-	i2c_del_driver(&tps61310_i2c_driver);
-	return 0;
-}
-
-static const struct i2c_device_id tps61310_i2c_id[] = {
-	{FLASH_NAME, (kernel_ulong_t)&fctrl},
-	{ }
-};
-
-static struct i2c_driver tps61310_i2c_driver = {
-	.id_table = tps61310_i2c_id,
-	.probe  = msm_flash_i2c_probe,
-	.remove = __exit_p(msm_flash_i2c_remove),
-	.driver = {
-		.name = FLASH_NAME,
-	},
-};
-
-static int __init msm_flash_i2c_add_driver(void)
-{
-	CDBG("%s called\n", __func__);
-	return i2c_add_driver(&tps61310_i2c_driver);
-}
-
-static struct msm_camera_i2c_client tps61310_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_BYTE_ADDR,
-};
-
-static struct msm_flash_reg_t tps61310_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.init_setting = tps61310_init_setting,
-	.init_setting_size = ARRAY_SIZE(tps61310_init_setting),
-	.off_setting = tps61310_off_setting,
-	.off_setting_size = ARRAY_SIZE(tps61310_off_setting),
-	.low_setting = tps61310_low_setting,
-	.low_setting_size = ARRAY_SIZE(tps61310_low_setting),
-	.high_setting = tps61310_high_setting,
-	.high_setting_size = ARRAY_SIZE(tps61310_high_setting),
-};
-
-static struct msm_flash_fn_t tps61310_func_tbl = {
-	.flash_led_config = msm_camera_flash_led_config,
-	.flash_led_init = msm_flash_led_init,
-	.flash_led_release = msm_flash_led_release,
-	.flash_led_off = msm_flash_led_off,
-	.flash_led_low = msm_flash_led_low,
-	.flash_led_high = msm_flash_led_high,
-};
-
-static struct msm_flash_ctrl_t fctrl = {
-	.flash_i2c_client = &tps61310_i2c_client,
-	.reg_setting = &tps61310_regs,
-	.func_tbl = &tps61310_func_tbl,
-};
-
-subsys_initcall(msm_flash_i2c_add_driver);
-MODULE_DESCRIPTION("TPS61310 FLASH");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/platform/msm/camera_v1/gemini/Makefile b/drivers/media/platform/msm/camera_v1/gemini/Makefile
deleted file mode 100644
index 6d4166c..0000000
--- a/drivers/media/platform/msm/camera_v1/gemini/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1
-obj-$(CONFIG_MSM_GEMINI) += msm_gemini_dev.o msm_gemini_sync.o msm_gemini_core.o msm_gemini_hw.o msm_gemini_platform.o
diff --git a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_common.h b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_common.h
deleted file mode 100644
index 95223d80..0000000
--- a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_common.h
+++ /dev/null
@@ -1,39 +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 MSM_GEMINI_COMMON_H
-#define MSM_GEMINI_COMMON_H
-
-#define MSM_GEMINI_DEBUG
-#ifdef MSM_GEMINI_DEBUG
-#define GMN_DBG(fmt, args...) pr_debug(fmt, ##args)
-#else
-#define GMN_DBG(fmt, args...) do { } while (0)
-#endif
-
-#define GMN_PR_ERR   pr_err
-
-enum GEMINI_MODE {
-	GEMINI_MODE_DISABLE,
-	GEMINI_MODE_OFFLINE,
-	GEMINI_MODE_REALTIME,
-	GEMINI_MODE_REALTIME_ROTATION
-};
-
-enum GEMINI_ROTATION {
-	GEMINI_ROTATION_0,
-	GEMINI_ROTATION_90,
-	GEMINI_ROTATION_180,
-	GEMINI_ROTATION_270
-};
-
-#endif /* MSM_GEMINI_COMMON_H */
diff --git a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_core.c b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_core.c
deleted file mode 100644
index 9370fc9..0000000
--- a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_core.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/* Copyright (c) 2010-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 <linux/sched.h>
-#include "msm_gemini_hw.h"
-#include "msm_gemini_core.h"
-#include "msm_gemini_platform.h"
-#include "msm_gemini_common.h"
-
-static struct msm_gemini_hw_pingpong fe_pingpong_buf;
-static struct msm_gemini_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_gemini_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_gemini_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) {
-		GMN_DBG("%s: reset ACK failed %d", __func__, rc);
-		return -EBUSY;
-	}
-
-	GMN_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);
-
-	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;
-}
-
-void msm_gemini_core_release(int release_buf)
-{
-	int i = 0;
-	for (i = 0; i < 2; i++) {
-		if (we_pingpong_buf.buf_status[i] && release_buf)
-			msm_gemini_platform_p2v(we_pingpong_buf.buf[i].file,
-					&we_pingpong_buf.buf[i].handle);
-		we_pingpong_buf.buf_status[i] = 0;
-	}
-}
-
-void msm_gemini_core_init(void)
-{
-	init_waitqueue_head(&reset_wait);
-	spin_lock_init(&reset_lock);
-}
-
-int msm_gemini_core_fe_start(void)
-{
-	msm_gemini_hw_fe_start();
-	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__,
-		(int) buf->y_buffer_addr, buf->y_len,
-		(int) buf->cbcr_buffer_addr, buf->cbcr_len);
-	return msm_gemini_hw_pingpong_update(&fe_pingpong_buf, buf);
-}
-
-void *msm_gemini_core_fe_pingpong_irq(int gemini_irq_status, void *context)
-{
-	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;
-	GMN_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_status[we_pingpong_index] = 0;
-	we_pingpong_index = (we_pingpong_index + 1)%2;
-	rc = msm_gemini_hw_pingpong_update(&we_pingpong_buf, buf);
-	return 0;
-}
-
-int msm_gemini_core_we_buf_reset(struct msm_gemini_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_gemini_core_we_pingpong_irq(int gemini_irq_status, void *context)
-{
-	GMN_DBG("%s:%d]\n", __func__, __LINE__);
-
-	return msm_gemini_hw_pingpong_irq(&we_pingpong_buf);
-}
-
-void *msm_gemini_core_framedone_irq(int gemini_irq_status, void *context)
-{
-	struct msm_gemini_hw_buf *buf_p;
-
-	GMN_DBG("%s:%d]\n", __func__, __LINE__);
-
-	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_debug("%s:%d] framedone_len %d\n", __func__, __LINE__,
-			buf_p->framedone_len);
-	}
-
-	return buf_p;
-}
-
-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;
-}
-
-void *msm_gemini_core_err_irq(int gemini_irq_status, void *context)
-{
-	GMN_PR_ERR("%s:%d]\n", __func__, gemini_irq_status);
-	return NULL;
-}
-
-static int (*msm_gemini_irq_handler) (int, void *, void *);
-
-irqreturn_t msm_gemini_core_irq(int irq_num, void *context)
-{
-	void *data = NULL;
-	unsigned long flags;
-	int gemini_irq_status;
-
-	GMN_DBG("%s:%d] irq_num = %d\n", __func__, __LINE__, irq_num);
-
-	spin_lock_irqsave(&reset_lock, flags);
-	reset_done_ack = 1;
-	spin_unlock_irqrestore(&reset_lock, flags);
-	gemini_irq_status = msm_gemini_hw_irq_get_status();
-
-	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,
-			JPEG_IRQ_CLEAR_ALL);
-	} else if (gemini_irq_status & 0x1) {
-		msm_gemini_hw_irq_clear(HWIO_JPEG_IRQ_CLEAR_RMSK,
-			JPEG_IRQ_CLEAR_ALL);
-	} else {
-		msm_gemini_hw_irq_clear(HWIO_JPEG_IRQ_CLEAR_RMSK,
-			gemini_irq_status);
-	}
-
-	if (msm_gemini_hw_irq_is_frame_done(gemini_irq_status)) {
-		data = msm_gemini_core_framedone_irq(gemini_irq_status,
-			context);
-		if (msm_gemini_irq_handler)
-			msm_gemini_irq_handler(
-				MSM_GEMINI_HW_MASK_COMP_FRAMEDONE,
-				context, data);
-	}
-
-	if (msm_gemini_hw_irq_is_fe_pingpong(gemini_irq_status)) {
-		data = msm_gemini_core_fe_pingpong_irq(gemini_irq_status,
-			context);
-		if (msm_gemini_irq_handler)
-			msm_gemini_irq_handler(MSM_GEMINI_HW_MASK_COMP_FE,
-				context, data);
-	}
-
-	if (msm_gemini_hw_irq_is_we_pingpong(gemini_irq_status) &&
-	    !msm_gemini_hw_irq_is_frame_done(gemini_irq_status)) {
-		data = msm_gemini_core_we_pingpong_irq(gemini_irq_status,
-			context);
-		if (msm_gemini_irq_handler)
-			msm_gemini_irq_handler(MSM_GEMINI_HW_MASK_COMP_WE,
-				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)) {
-		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;
-}
-
-void msm_gemini_core_irq_install(int (*irq_handler) (int, void *, void *))
-{
-	msm_gemini_irq_handler = irq_handler;
-}
-
-void msm_gemini_core_irq_remove(void)
-{
-	msm_gemini_irq_handler = NULL;
-}
diff --git a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_core.h b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_core.h
deleted file mode 100644
index 62dd473..0000000
--- a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_core.h
+++ /dev/null
@@ -1,35 +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 MSM_GEMINI_CORE_H
-#define MSM_GEMINI_CORE_H
-
-#include <linux/interrupt.h>
-#include "msm_gemini_hw.h"
-
-#define msm_gemini_core_buf msm_gemini_hw_buf
-
-irqreturn_t msm_gemini_core_irq(int irq_num, void *context);
-
-void msm_gemini_core_irq_install(int (*irq_handler) (int, void *, void *));
-void msm_gemini_core_irq_remove(void);
-
-int msm_gemini_core_fe_buf_update(struct msm_gemini_core_buf *buf);
-int msm_gemini_core_we_buf_update(struct msm_gemini_core_buf *buf);
-int msm_gemini_core_we_buf_reset(struct msm_gemini_hw_buf *buf);
-
-int msm_gemini_core_reset(uint8_t op_mode, void *base, int size);
-int msm_gemini_core_fe_start(void);
-
-void msm_gemini_core_release(int);
-void msm_gemini_core_init(void);
-#endif /* MSM_GEMINI_CORE_H */
diff --git a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_dev.c b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_dev.c
deleted file mode 100644
index 770a28f..0000000
--- a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_dev.c
+++ /dev/null
@@ -1,266 +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/init.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <mach/board.h>
-
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/device.h>
-#include <linux/uaccess.h>
-#include <media/msm_gemini.h>
-#include <media/v4l2-device.h>
-#include <media/v4l2-subdev.h>
-
-#include "msm.h"
-#include "msm_gemini_sync.h"
-#include "msm_gemini_common.h"
-
-#define MSM_GEMINI_NAME "gemini"
-
-static int msm_gemini_open(struct inode *inode, struct file *filp)
-{
-	int rc;
-
-	struct msm_gemini_device *pgmn_dev = container_of(inode->i_cdev,
-		struct msm_gemini_device, cdev);
-	filp->private_data = pgmn_dev;
-
-	GMN_DBG("%s:%d]\n", __func__, __LINE__);
-
-	rc = __msm_gemini_open(pgmn_dev);
-
-	GMN_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_gemini_release(struct inode *inode, struct file *filp)
-{
-	int rc;
-
-	struct msm_gemini_device *pgmn_dev = filp->private_data;
-
-	GMN_DBG(KERN_INFO "%s:%d]\n", __func__, __LINE__);
-
-	rc = __msm_gemini_release(pgmn_dev);
-
-	GMN_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_gemini_ioctl(struct file *filp, unsigned int cmd,
-	unsigned long arg)
-{
-	int rc;
-	struct msm_gemini_device *pgmn_dev = filp->private_data;
-
-	GMN_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_gemini_ioctl(pgmn_dev, cmd, arg);
-
-	GMN_DBG("%s:%d]\n", __func__, __LINE__);
-	return rc;
-}
-
-static const struct file_operations msm_gemini_fops = {
-	.owner	  = THIS_MODULE,
-	.open	   = msm_gemini_open,
-	.release	= msm_gemini_release,
-	.unlocked_ioctl = msm_gemini_ioctl,
-};
-
-static struct class *msm_gemini_class;
-static dev_t msm_gemini_devno;
-struct msm_gemini_device *msm_gemini_device_p;
-
-int msm_gemini_subdev_init(struct v4l2_subdev *gemini_sd)
-{
-	int rc;
-	struct msm_gemini_device *pgmn_dev =
-		(struct msm_gemini_device *)gemini_sd->host_priv;
-
-	GMN_DBG("%s:%d: gemini_sd=0x%x pgmn_dev=0x%x\n",
-		__func__, __LINE__, (uint32_t)gemini_sd, (uint32_t)pgmn_dev);
-	rc = __msm_gemini_open(pgmn_dev);
-	GMN_DBG("%s:%d: rc=%d\n",
-		__func__, __LINE__, rc);
-	return rc;
-}
-
-static long msm_gemini_subdev_ioctl(struct v4l2_subdev *sd,
-	unsigned int cmd, void *arg)
-{
-	long rc;
-	struct msm_gemini_device *pgmn_dev =
-		(struct msm_gemini_device *)sd->host_priv;
-
-	GMN_DBG("%s: cmd=%d\n", __func__, cmd);
-
-	GMN_DBG("%s: pgmn_dev 0x%x", __func__, (uint32_t)pgmn_dev);
-
-	GMN_DBG("%s: Calling __msm_gemini_ioctl\n", __func__);
-
-	rc = __msm_gemini_ioctl(pgmn_dev, cmd, (unsigned long)arg);
-	pr_debug("%s: X\n", __func__);
-	return rc;
-}
-
-void msm_gemini_subdev_release(struct v4l2_subdev *gemini_sd)
-{
-	int rc;
-	struct msm_gemini_device *pgmn_dev =
-		(struct msm_gemini_device *)gemini_sd->host_priv;
-	GMN_DBG("%s:pgmn_dev=0x%x", __func__, (uint32_t)pgmn_dev);
-	rc = __msm_gemini_release(pgmn_dev);
-	GMN_DBG("%s:rc=%d", __func__, rc);
-}
-
-static const struct v4l2_subdev_core_ops msm_gemini_subdev_core_ops = {
-	.ioctl = msm_gemini_subdev_ioctl,
-};
-
-static const struct v4l2_subdev_ops msm_gemini_subdev_ops = {
-	.core = &msm_gemini_subdev_core_ops,
-};
-
-static int msm_gemini_init(struct platform_device *pdev)
-{
-	int rc = -1;
-	struct device *dev;
-
-	GMN_DBG("%s:\n", __func__);
-	msm_gemini_device_p = __msm_gemini_init(pdev);
-	if (msm_gemini_device_p == NULL) {
-		GMN_PR_ERR("%s: initialization failed\n", __func__);
-		goto fail;
-	}
-
-	v4l2_subdev_init(&msm_gemini_device_p->subdev, &msm_gemini_subdev_ops);
-	v4l2_set_subdev_hostdata(&msm_gemini_device_p->subdev,
-		msm_gemini_device_p);
-	pr_debug("%s: msm_gemini_device_p 0x%x", __func__,
-			(uint32_t)msm_gemini_device_p);
-	GMN_DBG("%s:gemini: platform_set_drvdata\n", __func__);
-	platform_set_drvdata(pdev, &msm_gemini_device_p->subdev);
-
-	rc = alloc_chrdev_region(&msm_gemini_devno, 0, 1, MSM_GEMINI_NAME);
-	if (rc < 0) {
-		GMN_PR_ERR("%s: failed to allocate chrdev\n", __func__);
-		goto fail_1;
-	}
-
-	if (!msm_gemini_class) {
-		msm_gemini_class = class_create(THIS_MODULE, MSM_GEMINI_NAME);
-		if (IS_ERR(msm_gemini_class)) {
-			rc = PTR_ERR(msm_gemini_class);
-			GMN_PR_ERR("%s: create device class failed\n",
-				__func__);
-			goto fail_2;
-		}
-	}
-
-	dev = device_create(msm_gemini_class, NULL,
-		MKDEV(MAJOR(msm_gemini_devno), MINOR(msm_gemini_devno)), NULL,
-		"%s%d", MSM_GEMINI_NAME, 0);
-
-	if (IS_ERR(dev)) {
-		GMN_PR_ERR("%s: error creating device\n", __func__);
-		rc = -ENODEV;
-		goto fail_3;
-	}
-
-	cdev_init(&msm_gemini_device_p->cdev, &msm_gemini_fops);
-	msm_gemini_device_p->cdev.owner = THIS_MODULE;
-	msm_gemini_device_p->cdev.ops   =
-		(const struct file_operations *) &msm_gemini_fops;
-	rc = cdev_add(&msm_gemini_device_p->cdev, msm_gemini_devno, 1);
-	if (rc < 0) {
-		GMN_PR_ERR("%s: error adding cdev\n", __func__);
-		rc = -ENODEV;
-		goto fail_4;
-	}
-
-	GMN_DBG("%s %s: success\n", __func__, MSM_GEMINI_NAME);
-
-	return rc;
-
-fail_4:
-	device_destroy(msm_gemini_class, msm_gemini_devno);
-
-fail_3:
-	class_destroy(msm_gemini_class);
-
-fail_2:
-	unregister_chrdev_region(msm_gemini_devno, 1);
-
-fail_1:
-	__msm_gemini_exit(msm_gemini_device_p);
-
-fail:
-	return rc;
-}
-
-static void msm_gemini_exit(void)
-{
-	cdev_del(&msm_gemini_device_p->cdev);
-	device_destroy(msm_gemini_class, msm_gemini_devno);
-	class_destroy(msm_gemini_class);
-	unregister_chrdev_region(msm_gemini_devno, 1);
-
-	__msm_gemini_exit(msm_gemini_device_p);
-}
-
-static int __msm_gemini_probe(struct platform_device *pdev)
-{
-	return msm_gemini_init(pdev);
-}
-
-static int __msm_gemini_remove(struct platform_device *pdev)
-{
-	msm_gemini_exit();
-	return 0;
-}
-
-static struct platform_driver msm_gemini_driver = {
-	.probe  = __msm_gemini_probe,
-	.remove = __msm_gemini_remove,
-	.driver = {
-		.name = MSM_GEMINI_DRV_NAME,
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init msm_gemini_driver_init(void)
-{
-	int rc;
-	rc = platform_driver_register(&msm_gemini_driver);
-	return rc;
-}
-
-static void __exit msm_gemini_driver_exit(void)
-{
-	platform_driver_unregister(&msm_gemini_driver);
-}
-
-MODULE_DESCRIPTION("msm gemini jpeg driver");
-MODULE_VERSION("msm gemini 0.1");
-
-module_init(msm_gemini_driver_init);
-module_exit(msm_gemini_driver_exit);
-
diff --git a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw.c b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw.c
deleted file mode 100644
index de0ed97..0000000
--- a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/* Copyright (c) 2010,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 <linux/delay.h>
-#include "msm_gemini_hw.h"
-#include "msm_gemini_common.h"
-
-#include <linux/io.h>
-
-static void *gemini_region_base;
-static uint32_t gemini_region_size;
-
-int msm_gemini_hw_pingpong_update(struct msm_gemini_hw_pingpong *pingpong_hw,
-	struct msm_gemini_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 {
-		GMN_PR_ERR("%s:%d: pingpong buffer busy\n", __func__, __LINE__);
-		return -1;
-	}
-
-	pingpong_hw->buf[buf_free_index] = *buf;
-	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);
-	}
-	return 0;
-}
-
-void *msm_gemini_hw_pingpong_irq(struct msm_gemini_hw_pingpong *pingpong_hw)
-{
-	struct msm_gemini_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_gemini_hw_pingpong_active_buffer(
-	struct msm_gemini_hw_pingpong *pingpong_hw)
-{
-	struct msm_gemini_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_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} },
-};
-
-int msm_gemini_hw_irq_get_status(void)
-{
-	uint32_t n_irq_status = 0;
-	rmb();
-	n_irq_status = msm_gemini_hw_read(&hw_cmd_irq_get_status[0]);
-	rmb();
-	return n_irq_status;
-}
-
-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} },
-};
-
-long msm_gemini_hw_encode_output_size(void)
-{
-	uint32_t encode_output_size = 0;
-
-	encode_output_size = msm_gemini_hw_read(&hw_cmd_encode_output_size[0]);
-
-	return encode_output_size;
-}
-
-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} },
-};
-
-void msm_gemini_hw_irq_clear(uint32_t mask, uint32_t data)
-{
-	GMN_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_gemini_hw_write(&hw_cmd_irq_clear[0]);
-}
-
-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,
-		HWIO_JPEG_FE_Y_PING_ADDR_RMSK, {0} },
-	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_FE_CBCR_PING_ADDR_ADDR,
-		HWIO_JPEG_FE_CBCR_PING_ADDR_RMSK, {0} },
-	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_FE_CMD_ADDR,
-		HWIO_JPEG_FE_CMD_RMSK, {JPEG_FE_CMD_BUFFERRELOAD} },
-};
-
-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,
-		HWIO_JPEG_FE_Y_PONG_ADDR_RMSK, {0} },
-	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_FE_CBCR_PONG_ADDR_ADDR,
-		HWIO_JPEG_FE_CBCR_PONG_ADDR_RMSK, {0} },
-	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_FE_CMD_ADDR,
-		HWIO_JPEG_FE_CMD_RMSK, {JPEG_FE_CMD_BUFFERRELOAD} },
-};
-
-void msm_gemini_hw_fe_buffer_update(struct msm_gemini_hw_buf *p_input,
-	uint8_t pingpong_index)
-{
-	uint32_t n_reg_val = 0;
-
-	struct msm_gemini_hw_cmd *hw_cmd_p;
-
-	if (pingpong_index == 0) {
-		hw_cmd_p = &hw_cmd_fe_ping_update[0];
-		n_reg_val = ((((p_input->num_of_mcu_rows - 1) <<
-			HWIO_JPEG_FE_BUFFER_CFG_CBCR_MCU_ROWS_SHFT) &
-			HWIO_JPEG_FE_BUFFER_CFG_CBCR_MCU_ROWS_BMSK) |
-			(((p_input->num_of_mcu_rows - 1) <<
-			HWIO_JPEG_FE_BUFFER_CFG_Y_MCU_ROWS_SHFT) &
-			HWIO_JPEG_FE_BUFFER_CFG_Y_MCU_ROWS_BMSK));
-		hw_cmd_p->data = n_reg_val;
-		msm_gemini_hw_write(hw_cmd_p++);
-
-		n_reg_val = ((p_input->y_buffer_addr <<
-			HWIO_JPEG_FE_Y_PING_ADDR_FE_Y_PING_START_ADDR_SHFT) &
-			HWIO_JPEG_FE_Y_PING_ADDR_FE_Y_PING_START_ADDR_BMSK);
-		hw_cmd_p->data = n_reg_val;
-		msm_gemini_hw_write(hw_cmd_p++);
-
-		n_reg_val = ((p_input->cbcr_buffer_addr<<
-		HWIO_JPEG_FE_CBCR_PING_ADDR_FE_CBCR_PING_START_ADDR_SHFT) &
-		HWIO_JPEG_FE_CBCR_PING_ADDR_FE_CBCR_PING_START_ADDR_BMSK);
-		hw_cmd_p->data = n_reg_val;
-		msm_gemini_hw_write(hw_cmd_p++);
-
-		msm_gemini_hw_write(hw_cmd_p);
-	} else if (pingpong_index == 1) {
-		hw_cmd_p = &hw_cmd_fe_pong_update[0];
-		n_reg_val = ((((p_input->num_of_mcu_rows - 1) <<
-			HWIO_JPEG_FE_BUFFER_CFG_CBCR_MCU_ROWS_SHFT) &
-			HWIO_JPEG_FE_BUFFER_CFG_CBCR_MCU_ROWS_BMSK) |
-			(((p_input->num_of_mcu_rows - 1) <<
-			HWIO_JPEG_FE_BUFFER_CFG_Y_MCU_ROWS_SHFT) &
-			HWIO_JPEG_FE_BUFFER_CFG_Y_MCU_ROWS_BMSK));
-		hw_cmd_p->data = n_reg_val;
-		msm_gemini_hw_write(hw_cmd_p++);
-
-		n_reg_val = ((p_input->y_buffer_addr <<
-			HWIO_JPEG_FE_Y_PONG_ADDR_FE_Y_PONG_START_ADDR_SHFT) &
-			HWIO_JPEG_FE_Y_PONG_ADDR_FE_Y_PONG_START_ADDR_BMSK);
-		hw_cmd_p->data = n_reg_val;
-		msm_gemini_hw_write(hw_cmd_p++);
-
-		n_reg_val = ((p_input->cbcr_buffer_addr<<
-		HWIO_JPEG_FE_CBCR_PONG_ADDR_FE_CBCR_PONG_START_ADDR_SHFT) &
-		HWIO_JPEG_FE_CBCR_PONG_ADDR_FE_CBCR_PONG_START_ADDR_BMSK);
-		hw_cmd_p->data = n_reg_val;
-		msm_gemini_hw_write(hw_cmd_p++);
-
-		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} },
-};
-
-void msm_gemini_hw_fe_start(void)
-{
-	msm_gemini_hw_write(&hw_cmd_fe_start[0]);
-
-	return;
-}
-
-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,
-		HWIO_JPEG_WE_Y_UB_CFG_RMSK, {JPEG_WE_YUB_ENCODE} },
-	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_WE_CBCR_THRESHOLD_ADDR,
-		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 }
-};
-
-void msm_gemini_hw_we_buffer_cfg(uint8_t is_realtime)
-{
-	uint32_t              n_reg_val = 0;
-
-	struct msm_gemini_hw_cmd *hw_cmd_p = &hw_cmd_we_buffer_cfg[0];
-
-	n_reg_val = (((GEMINI_WE_Y_THRESHOLD[1][is_realtime] <<
-		HWIO_JPEG_WE_Y_THRESHOLD_WE_DEASSERT_STALL_TH_SHFT) &
-		HWIO_JPEG_WE_Y_THRESHOLD_WE_DEASSERT_STALL_TH_BMSK) |
-		((GEMINI_WE_Y_THRESHOLD[0][is_realtime] <<
-		HWIO_JPEG_WE_Y_THRESHOLD_WE_ASSERT_STALL_TH_SHFT) &
-		HWIO_JPEG_WE_Y_THRESHOLD_WE_ASSERT_STALL_TH_BMSK));
-	hw_cmd_p->data = n_reg_val;
-	msm_gemini_hw_write(hw_cmd_p++);
-
-	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) |
-		((GEMINI_WE_CBCR_THRESHOLD[0][is_realtime] <<
-		HWIO_JPEG_WE_CBCR_THRESHOLD_WE_ASSERT_STALL_TH_SHFT) &
-		HWIO_JPEG_WE_CBCR_THRESHOLD_WE_ASSERT_STALL_TH_BMSK));
-	hw_cmd_p->data = n_reg_val;
-	msm_gemini_hw_write(hw_cmd_p);
-
-	return;
-}
-
-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,
-		HWIO_JPEG_WE_Y_PING_ADDR_RMSK, {0} },
-};
-
-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,
-		HWIO_JPEG_WE_Y_PONG_ADDR_RMSK, {0} },
-};
-
-void msm_gemini_hw_we_buffer_update(struct msm_gemini_hw_buf *p_input,
-	uint8_t pingpong_index)
-{
-	uint32_t n_reg_val = 0;
-
-	struct msm_gemini_hw_cmd *hw_cmd_p;
-
-	pr_debug("%s:%d] pingpong index %d", __func__, __LINE__,
-		pingpong_index);
-	if (pingpong_index == 0) {
-		hw_cmd_p = &hw_cmd_we_ping_update[0];
-
-		n_reg_val = ((p_input->y_len <<
-			HWIO_JPEG_WE_Y_PING_BUFFER_CFG_WE_BUFFER_LENGTH_SHFT) &
-			HWIO_JPEG_WE_Y_PING_BUFFER_CFG_WE_BUFFER_LENGTH_BMSK);
-		hw_cmd_p->data = n_reg_val;
-		msm_gemini_hw_write(hw_cmd_p++);
-
-		n_reg_val = p_input->y_buffer_addr;
-		hw_cmd_p->data = n_reg_val;
-		msm_gemini_hw_write(hw_cmd_p++);
-	} else if (pingpong_index == 1) {
-		hw_cmd_p = &hw_cmd_we_pong_update[0];
-
-		n_reg_val = ((p_input->y_len <<
-			HWIO_JPEG_WE_Y_PONG_BUFFER_CFG_WE_BUFFER_LENGTH_SHFT) &
-			HWIO_JPEG_WE_Y_PONG_BUFFER_CFG_WE_BUFFER_LENGTH_BMSK);
-		hw_cmd_p->data = n_reg_val;
-		msm_gemini_hw_write(hw_cmd_p++);
-
-		n_reg_val = p_input->y_buffer_addr;
-		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,
-		HWIO_JPEG_IRQ_MASK_RMSK, {JPEG_IRQ_CLEAR_ALL} },
-	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_IRQ_MASK_ADDR,
-		HWIO_JPEG_IRQ_MASK_RMSK, {JPEG_IRQ_ALLSOURCES_ENABLE} },
-	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_RESET_CMD_ADDR,
-		HWIO_JPEG_RESET_CMD_RMSK, {JPEG_RESET_DEFAULT} },
-};
-
-void msm_gemini_hw_init(void *base, int size)
-{
-	gemini_region_base = base;
-	gemini_region_size = size;
-}
-
-void msm_gemini_hw_reset(void *base, int size)
-{
-	struct msm_gemini_hw_cmd *hw_cmd_p;
-
-	hw_cmd_p = &hw_cmd_reset[0];
-
-	wmb();
-	msm_gemini_hw_write(hw_cmd_p++);
-	msm_gemini_hw_write(hw_cmd_p++);
-	msm_gemini_hw_write(hw_cmd_p++);
-	msm_gemini_hw_write(hw_cmd_p);
-	wmb();
-
-	return;
-}
-
-uint32_t msm_gemini_hw_read(struct msm_gemini_hw_cmd *hw_cmd_p)
-{
-	uint32_t *paddr;
-	uint32_t data;
-
-	paddr = gemini_region_base + hw_cmd_p->offset;
-
-	data = readl(paddr);
-	data &= hw_cmd_p->mask;
-
-	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, data);
-	return data;
-}
-
-void msm_gemini_hw_write(struct msm_gemini_hw_cmd *hw_cmd_p)
-{
-	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);
-
-	paddr = gemini_region_base + hw_cmd_p->offset;
-
-	if (hw_cmd_p->mask == 0xffffffff) {
-		old_data = 0;
-	} else {
-		old_data = readl(paddr);
-		old_data &= ~hw_cmd_p->mask;
-	}
-
-	new_data = hw_cmd_p->data & hw_cmd_p->mask;
-	new_data |= old_data;
-	writel(new_data, paddr);
-}
-
-int msm_gemini_hw_wait(struct msm_gemini_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_gemini_hw_read(hw_cmd_p);
-	if (data != wait_data) {
-		while (tm) {
-			udelay(m_us);
-			data = msm_gemini_hw_read(hw_cmd_p);
-			if (data == wait_data)
-				break;
-			tm--;
-		}
-	}
-	hw_cmd_p->data = data;
-	return tm;
-}
-
-void msm_gemini_hw_delay(struct msm_gemini_hw_cmd *hw_cmd_p, int m_us)
-{
-	int tm = hw_cmd_p->n;
-	while (tm) {
-		udelay(m_us);
-		tm--;
-	}
-}
-
-int msm_gemini_hw_exec_cmds(struct msm_gemini_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 > gemini_region_size) {
-			GMN_PR_ERR("%s:%d] %d exceed hw region %d\n", __func__,
-				__LINE__, hw_cmd_p->offset, gemini_region_size);
-			return -EFAULT;
-		}
-
-		switch (hw_cmd_p->type) {
-		case MSM_GEMINI_HW_CMD_TYPE_READ:
-			hw_cmd_p->data = msm_gemini_hw_read(hw_cmd_p);
-			is_copy_to_user = 1;
-			break;
-
-		case MSM_GEMINI_HW_CMD_TYPE_WRITE:
-			msm_gemini_hw_write(hw_cmd_p);
-			break;
-
-		case MSM_GEMINI_HW_CMD_TYPE_WRITE_OR:
-			data = msm_gemini_hw_read(hw_cmd_p);
-			hw_cmd_p->data = (hw_cmd_p->data & hw_cmd_p->mask) |
-				data;
-			msm_gemini_hw_write(hw_cmd_p);
-			break;
-
-		case MSM_GEMINI_HW_CMD_TYPE_UWAIT:
-			msm_gemini_hw_wait(hw_cmd_p, 1);
-			break;
-
-		case MSM_GEMINI_HW_CMD_TYPE_MWAIT:
-			msm_gemini_hw_wait(hw_cmd_p, 1000);
-			break;
-
-		case MSM_GEMINI_HW_CMD_TYPE_UDELAY:
-			msm_gemini_hw_delay(hw_cmd_p, 1);
-			break;
-
-		case MSM_GEMINI_HW_CMD_TYPE_MDELAY:
-			msm_gemini_hw_delay(hw_cmd_p, 1000);
-			break;
-
-		default:
-			GMN_PR_ERR("wrong hw command type\n");
-			break;
-		}
-
-		hw_cmd_p++;
-	}
-	return is_copy_to_user;
-}
-
-#ifdef MSM_GMN_DBG_DUMP
-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_info("%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_info("%s\n", line_str);
-			line_str[0] = '\0';
-			p_str = line_str;
-		}
-	}
-	if (line_str[0] != '\0')
-		pr_info("%s\n", line_str);
-}
-#else
-void msm_gemini_io_dump(int size)
-{
-
-}
-#endif
diff --git a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw.h b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw.h
deleted file mode 100644
index 4d08282..0000000
--- a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Copyright (c) 2010-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_GEMINI_HW_H
-#define MSM_GEMINI_HW_H
-
-#include <media/msm_gemini.h>
-#include "msm_gemini_hw_reg.h"
-#include <linux/msm_ion.h>
-#include <mach/iommu_domains.h>
-
-struct msm_gemini_hw_buf {
-	struct msm_gemini_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_gemini_hw_pingpong {
-	uint8_t is_fe; /* 1: fe; 0: we */
-	struct  msm_gemini_hw_buf buf[2];
-	int     buf_status[2];
-	int     buf_active_index;
-};
-
-int msm_gemini_hw_pingpong_update(struct msm_gemini_hw_pingpong *pingpong_hw,
-	struct msm_gemini_hw_buf *buf);
-void *msm_gemini_hw_pingpong_irq(struct msm_gemini_hw_pingpong *pingpong_hw);
-void *msm_gemini_hw_pingpong_active_buffer(struct msm_gemini_hw_pingpong
-	*pingpong_hw);
-
-void msm_gemini_hw_irq_clear(uint32_t, uint32_t);
-int msm_gemini_hw_irq_get_status(void);
-long msm_gemini_hw_encode_output_size(void);
-#define MSM_GEMINI_HW_MASK_COMP_FRAMEDONE \
-		MSM_GEMINI_HW_IRQ_STATUS_FRAMEDONE_MASK
-#define MSM_GEMINI_HW_MASK_COMP_FE \
-		MSM_GEMINI_HW_IRQ_STATUS_FE_RD_DONE_MASK
-#define MSM_GEMINI_HW_MASK_COMP_WE \
-		(MSM_GEMINI_HW_IRQ_STATUS_WE_Y_PINGPONG_MASK | \
-		 MSM_GEMINI_HW_IRQ_STATUS_WE_CBCR_PINGPONG_MASK)
-#define MSM_GEMINI_HW_MASK_COMP_RESET_ACK \
-		MSM_GEMINI_HW_IRQ_STATUS_RESET_ACK_MASK
-#define MSM_GEMINI_HW_MASK_COMP_ERR \
-		(MSM_GEMINI_HW_IRQ_STATUS_FE_RTOVF_MASK | \
-		MSM_GEMINI_HW_IRQ_STATUS_FE_VFE_OVERFLOW_MASK | \
-		MSM_GEMINI_HW_IRQ_STATUS_WE_Y_BUFFER_OVERFLOW_MASK | \
-		MSM_GEMINI_HW_IRQ_STATUS_WE_CBCR_BUFFER_OVERFLOW_MASK | \
-		MSM_GEMINI_HW_IRQ_STATUS_WE_CH0_DATAFIFO_OVERFLOW_MASK | \
-		MSM_GEMINI_HW_IRQ_STATUS_WE_CH1_DATAFIFO_OVERFLOW_MASK | \
-		MSM_GEMINI_HW_IRQ_STATUS_BUS_ERROR_MASK | \
-		MSM_GEMINI_HW_IRQ_STATUS_VIOLATION_MASK)
-
-#define msm_gemini_hw_irq_is_frame_done(gemini_irq_status) \
-	(gemini_irq_status & MSM_GEMINI_HW_MASK_COMP_FRAMEDONE)
-#define msm_gemini_hw_irq_is_fe_pingpong(gemini_irq_status) \
-	(gemini_irq_status & MSM_GEMINI_HW_MASK_COMP_FE)
-#define msm_gemini_hw_irq_is_we_pingpong(gemini_irq_status) \
-	(gemini_irq_status & MSM_GEMINI_HW_MASK_COMP_WE)
-#define msm_gemini_hw_irq_is_reset_ack(gemini_irq_status) \
-	(gemini_irq_status & MSM_GEMINI_HW_MASK_COMP_RESET_ACK)
-#define msm_gemini_hw_irq_is_err(gemini_irq_status) \
-	(gemini_irq_status & MSM_GEMINI_HW_MASK_COMP_ERR)
-
-void msm_gemini_hw_fe_buffer_update(struct msm_gemini_hw_buf *p_input,
-	uint8_t pingpong_index);
-void msm_gemini_hw_we_buffer_update(struct msm_gemini_hw_buf *p_input,
-	uint8_t pingpong_index);
-
-void msm_gemini_hw_we_buffer_cfg(uint8_t is_realtime);
-
-void msm_gemini_hw_fe_start(void);
-void msm_gemini_hw_clk_cfg(void);
-
-void msm_gemini_hw_reset(void *base, int size);
-void msm_gemini_hw_irq_cfg(void);
-void msm_gemini_hw_init(void *base, int size);
-
-uint32_t msm_gemini_hw_read(struct msm_gemini_hw_cmd *hw_cmd_p);
-void msm_gemini_hw_write(struct msm_gemini_hw_cmd *hw_cmd_p);
-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_io_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 */
-
-#endif /* MSM_GEMINI_HW_H */
diff --git a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw_reg.h b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw_reg.h
deleted file mode 100644
index 2fe6038..0000000
--- a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw_reg.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/* Copyright (c) 2010, 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_GEMINI_HW_REG_H
-#define MSM_GEMINI_HW_REG_H
-
-#define GEMINI_REG_BASE 0
-
-#define MSM_GEMINI_HW_IRQ_MASK_ADDR 0x00000014
-#define MSM_GEMINI_HW_IRQ_MASK_RMSK 0xffffffff
-#define MSM_GEMINI_HW_IRQ_MASK_SHFT 0
-#define MSM_GEMINI_HW_IRQ_DISABLE 0
-#define MSM_GEMINI_HW_IRQ_ENABLE 0xffffffff
-
-#define MSM_GEMINI_HW_IRQ_CLEAR_ADDR 0x00000018
-#define MSM_GEMINI_HW_IRQ_CLEAR_RMSK 0xffffffff
-#define MSM_GEMINI_HW_IRQ_CLEAR_SHFT 0
-#define MSM_GEMINI_HW_IRQ_CLEAR  0xffffffff
-
-#define MSM_GEMINI_HW_IRQ_STATUS_FRAMEDONE_MASK 0x00000001
-#define MSM_GEMINI_HW_IRQ_STATUS_FRAMEDONE_SHIFT 0x00000000
-
-#define MSM_GEMINI_HW_IRQ_STATUS_FE_RD_DONE_MASK 0x00000002
-#define MSM_GEMINI_HW_IRQ_STATUS_FE_RD_DONE_SHIFT 0x00000001
-
-#define MSM_GEMINI_HW_IRQ_STATUS_FE_RTOVF_MASK 0x00000004
-#define MSM_GEMINI_HW_IRQ_STATUS_FE_RTOVF_SHIFT 0x00000002
-
-#define MSM_GEMINI_HW_IRQ_STATUS_FE_VFE_OVERFLOW_MASK 0x00000008
-#define MSM_GEMINI_HW_IRQ_STATUS_FE_VFE_OVERFLOW_SHIFT 0x00000003
-
-#define MSM_GEMINI_HW_IRQ_STATUS_WE_Y_PINGPONG_MASK 0x00000010
-#define MSM_GEMINI_HW_IRQ_STATUS_WE_Y_PINGPONG_SHIFT 0x00000004
-
-#define MSM_GEMINI_HW_IRQ_STATUS_WE_CBCR_PINGPONG_MASK 0x00000020
-#define MSM_GEMINI_HW_IRQ_STATUS_WE_CBCR_PINGPONG_SHIFT 0x00000005
-
-#define MSM_GEMINI_HW_IRQ_STATUS_WE_Y_BUFFER_OVERFLOW_MASK 0x00000040
-#define MSM_GEMINI_HW_IRQ_STATUS_WE_Y_BUFFER_OVERFLOW_SHIFT 0x00000006
-
-#define MSM_GEMINI_HW_IRQ_STATUS_WE_CBCR_BUFFER_OVERFLOW_MASK 0x00000080
-#define MSM_GEMINI_HW_IRQ_STATUS_WE_CBCR_BUFFER_OVERFLOW_SHIFT 0x00000007
-
-#define MSM_GEMINI_HW_IRQ_STATUS_WE_CH0_DATAFIFO_OVERFLOW_MASK 0x00000100
-#define MSM_GEMINI_HW_IRQ_STATUS_WE_CH0_DATAFIFO_OVERFLOW_SHIFT 0x00000008
-
-#define MSM_GEMINI_HW_IRQ_STATUS_WE_CH1_DATAFIFO_OVERFLOW_MASK 0x00000200
-#define MSM_GEMINI_HW_IRQ_STATUS_WE_CH1_DATAFIFO_OVERFLOW_SHIFT 0x00000009
-
-#define MSM_GEMINI_HW_IRQ_STATUS_RESET_ACK_MASK 0x00000400
-#define MSM_GEMINI_HW_IRQ_STATUS_RESET_ACK_SHIFT 0x0000000a
-
-#define MSM_GEMINI_HW_IRQ_STATUS_BUS_ERROR_MASK 0x00000800
-#define MSM_GEMINI_HW_IRQ_STATUS_BUS_ERROR_SHIFT 0x0000000b
-
-#define MSM_GEMINI_HW_IRQ_STATUS_VIOLATION_MASK 0x00001000
-#define MSM_GEMINI_HW_IRQ_STATUS_VIOLATION_SHIFT 0x0000000c
-
-#define JPEG_BUS_CMD_HALT_REQ 0x00000001
-
-#define JPEG_REALTIME_CMD_STOP_FB 0x00000000
-#define JPEG_REALTIME_CMD_STOP_IM 0x00000003
-#define JPEG_REALTIME_CMD_START 0x00000001
-
-#define JPEG_OFFLINE_CMD_START 0x00000003
-
-#define JPEG_DMI_CFG_DISABLE 0x00000000
-#define JPEG_DMI_ADDR_START 0x00000000
-
-#define JPEG_FE_CMD_BUFFERRELOAD 0x00000001
-
-#define JPEG_WE_YUB_ENCODE 0x01ff0000
-
-#define JPEG_RESET_DEFAULT 0x0004ffff /* cfff? */
-
-#define JPEG_IRQ_DISABLE_ALL 0x00000000
-#define JPEG_IRQ_CLEAR_ALL 0xffffffff
-#define JPEG_IRQ_ALLSOURCES_ENABLE 0xffffffff
-
-#define HWIO_JPEG_FE_BUFFER_CFG_ADDR (GEMINI_REG_BASE + 0x00000080)
-#define HWIO_JPEG_FE_BUFFER_CFG_RMSK 0x1fff1fff
-
-#define HWIO_JPEG_FE_Y_PING_ADDR_ADDR (GEMINI_REG_BASE + 0x00000084)
-#define HWIO_JPEG_FE_Y_PING_ADDR_RMSK 0xffffffff
-
-#define HWIO_JPEG_FE_Y_PONG_ADDR_ADDR (GEMINI_REG_BASE + 0x00000088)
-#define HWIO_JPEG_FE_Y_PONG_ADDR_RMSK 0xffffffff
-
-#define HWIO_JPEG_FE_CBCR_PING_ADDR_ADDR (GEMINI_REG_BASE + 0x0000008c)
-#define HWIO_JPEG_FE_CBCR_PING_ADDR_RMSK 0xffffffff
-
-#define HWIO_JPEG_FE_CBCR_PONG_ADDR_ADDR (GEMINI_REG_BASE + 0x00000090)
-#define HWIO_JPEG_FE_CBCR_PONG_ADDR_RMSK 0xffffffff
-
-#define HWIO_JPEG_FE_CMD_ADDR (GEMINI_REG_BASE + 0x00000094)
-#define HWIO_JPEG_FE_CMD_RMSK 0x3
-
-#define HWIO_JPEG_FE_BUFFER_CFG_CBCR_MCU_ROWS_BMSK 0x1fff0000
-#define HWIO_JPEG_FE_BUFFER_CFG_CBCR_MCU_ROWS_SHFT 0x10
-#define HWIO_JPEG_FE_BUFFER_CFG_Y_MCU_ROWS_BMSK 0x1fff
-#define HWIO_JPEG_FE_BUFFER_CFG_Y_MCU_ROWS_SHFT 0
-
-#define HWIO_JPEG_FE_Y_PING_ADDR_FE_Y_PING_START_ADDR_BMSK 0xffffffff
-#define HWIO_JPEG_FE_Y_PING_ADDR_FE_Y_PING_START_ADDR_SHFT 0
-
-#define HWIO_JPEG_FE_CBCR_PING_ADDR_FE_CBCR_PING_START_ADDR_BMSK 0xffffffff
-#define HWIO_JPEG_FE_CBCR_PING_ADDR_FE_CBCR_PING_START_ADDR_SHFT 0
-
-#define HWIO_JPEG_FE_Y_PONG_ADDR_FE_Y_PONG_START_ADDR_BMSK 0xffffffff
-#define HWIO_JPEG_FE_Y_PONG_ADDR_FE_Y_PONG_START_ADDR_SHFT 0
-
-#define HWIO_JPEG_FE_CBCR_PONG_ADDR_FE_CBCR_PONG_START_ADDR_BMSK 0xffffffff
-#define HWIO_JPEG_FE_CBCR_PONG_ADDR_FE_CBCR_PONG_START_ADDR_SHFT 0
-
-#define HWIO_JPEG_WE_Y_THRESHOLD_ADDR (GEMINI_REG_BASE + 0x000000c0)
-#define HWIO_JPEG_WE_Y_THRESHOLD_RMSK 0x1ff01ff
-
-#define HWIO_JPEG_WE_CBCR_THRESHOLD_ADDR (GEMINI_REG_BASE      + 0x000000c4)
-#define HWIO_JPEG_WE_CBCR_THRESHOLD_RMSK 0x1ff01ff
-
-#define HWIO_JPEG_WE_Y_UB_CFG_ADDR (GEMINI_REG_BASE + 0x000000e8)
-#define HWIO_JPEG_WE_Y_UB_CFG_RMSK 0x1ff01ff
-
-#define HWIO_JPEG_WE_Y_THRESHOLD_WE_DEASSERT_STALL_TH_BMSK 0x1ff0000
-#define HWIO_JPEG_WE_Y_THRESHOLD_WE_DEASSERT_STALL_TH_SHFT 0x10
-#define HWIO_JPEG_WE_Y_THRESHOLD_WE_ASSERT_STALL_TH_BMSK 0x1ff
-#define HWIO_JPEG_WE_Y_THRESHOLD_WE_ASSERT_STALL_TH_SHFT 0
-
-#define HWIO_JPEG_WE_CBCR_THRESHOLD_WE_DEASSERT_STALL_TH_BMSK 0x1ff0000
-#define HWIO_JPEG_WE_CBCR_THRESHOLD_WE_DEASSERT_STALL_TH_SHFT 0x10
-#define HWIO_JPEG_WE_CBCR_THRESHOLD_WE_ASSERT_STALL_TH_BMSK 0x1ff
-#define HWIO_JPEG_WE_CBCR_THRESHOLD_WE_ASSERT_STALL_TH_SHFT 0
-
-#define HWIO_JPEG_WE_Y_PING_BUFFER_CFG_ADDR (GEMINI_REG_BASE + 0x000000c8)
-#define HWIO_JPEG_WE_Y_PING_BUFFER_CFG_RMSK 0x7fffff
-
-#define HWIO_JPEG_WE_Y_PING_ADDR_ADDR (GEMINI_REG_BASE + 0x000000d8)
-#define HWIO_JPEG_WE_Y_PING_ADDR_RMSK 0xfffffff8
-
-#define HWIO_JPEG_WE_Y_PONG_BUFFER_CFG_ADDR (GEMINI_REG_BASE + 0x000000cc)
-#define HWIO_JPEG_WE_Y_PONG_BUFFER_CFG_RMSK 0x7fffff
-
-#define HWIO_JPEG_WE_Y_PONG_ADDR_ADDR (GEMINI_REG_BASE + 0x000000dc)
-#define HWIO_JPEG_WE_Y_PONG_ADDR_RMSK 0xfffffff8
-
-#define HWIO_JPEG_WE_Y_PING_BUFFER_CFG_WE_BUFFER_LENGTH_BMSK 0x7fffff
-#define HWIO_JPEG_WE_Y_PING_BUFFER_CFG_WE_BUFFER_LENGTH_SHFT 0
-
-#define HWIO_JPEG_WE_Y_PONG_BUFFER_CFG_WE_BUFFER_LENGTH_BMSK 0x7fffff
-#define HWIO_JPEG_WE_Y_PONG_BUFFER_CFG_WE_BUFFER_LENGTH_SHFT 0
-
-#define HWIO_JPEG_IRQ_MASK_ADDR (GEMINI_REG_BASE + 0x00000014)
-#define HWIO_JPEG_IRQ_MASK_RMSK 0xffffffff
-
-#define HWIO_JPEG_IRQ_CLEAR_ADDR (GEMINI_REG_BASE + 0x00000018)
-#define HWIO_JPEG_IRQ_CLEAR_RMSK 0xffffffff
-
-#define HWIO_JPEG_RESET_CMD_ADDR (GEMINI_REG_BASE + 0x00000004)
-#define HWIO_JPEG_RESET_CMD_RMSK 0xe004ffff
-
-#define HWIO_JPEG_IRQ_STATUS_ADDR (GEMINI_REG_BASE + 0x0000001c)
-#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
-
-#endif /* MSM_GEMINI_HW_REG_H */
diff --git a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_platform.c b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_platform.c
deleted file mode 100644
index f0882f7..0000000
--- a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_platform.c
+++ /dev/null
@@ -1,250 +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/module.h>
-#include <linux/pm_qos.h>
-#include <linux/clk.h>
-#include <mach/clk.h>
-#include <linux/io.h>
-
-#include <mach/camera.h>
-#include <mach/iommu_domains.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;
-
-void msm_gemini_platform_p2v(struct file  *file,
-				struct ion_handle **ionhandle)
-{
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	ion_unmap_iommu(gemini_client, *ionhandle, CAMERA_DOMAIN, GEN_POOL);
-	ion_free(gemini_client, *ionhandle);
-	*ionhandle = NULL;
-#endif
-}
-
-uint32_t msm_gemini_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(gemini_client, fd);
-	if (IS_ERR_OR_NULL(*ionhandle))
-		return 0;
-
-	rc = ion_map_iommu(gemini_client, *ionhandle, CAMERA_DOMAIN, GEN_POOL,
-			SZ_4K, 0, &paddr, (unsigned long *)&size, 0, 0);
-#else
-	rc = 0;
-	paddr = 0;
-	size = 0;
-#endif
-	if (rc < 0) {
-		GMN_PR_ERR("%s: get_pmem_file fd %d error %d\n", __func__, fd,
-			rc);
-		goto error1;
-	}
-
-	/* validate user input */
-	if (len > size) {
-		GMN_PR_ERR("%s: invalid offset + len\n", __func__);
-		goto error1;
-	}
-
-	return paddr;
-error1:
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	ion_free(gemini_client, *ionhandle);
-#endif
-	return 0;
-}
-
-static struct msm_cam_clk_info gemini_8x_clk_info[] = {
-	{"core_clk", 228571000},
-	{"iface_clk", -1},
-};
-
-static struct msm_cam_clk_info gemini_7x_clk_info[] = {
-	{"core_clk", 153600000},
-	{"iface_clk", -1},
-};
-
-static struct msm_cam_clk_info gemini_imem_clk_info[] = {
-	{"mem_clk", -1},
-};
-
-int msm_gemini_platform_init(struct platform_device *pdev,
-	struct resource **mem,
-	void **base,
-	int *irq,
-	irqreturn_t (*handler) (int, void *),
-	void *context)
-{
-	int rc = -1;
-	int gemini_irq;
-	struct resource *gemini_mem, *gemini_io, *gemini_irq_res;
-	void *gemini_base;
-	struct msm_gemini_device *pgmn_dev =
-		(struct msm_gemini_device *) context;
-
-	gemini_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!gemini_mem) {
-		GMN_PR_ERR("%s: no mem resource?\n", __func__);
-		return -ENODEV;
-	}
-
-	gemini_irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!gemini_irq_res) {
-		GMN_PR_ERR("no irq resource?\n");
-		return -ENODEV;
-	}
-	gemini_irq = gemini_irq_res->start;
-
-	gemini_io = request_mem_region(gemini_mem->start,
-		resource_size(gemini_mem), pdev->name);
-	if (!gemini_io) {
-		GMN_PR_ERR("%s: region already claimed\n", __func__);
-		return -EBUSY;
-	}
-
-	gemini_base = ioremap(gemini_mem->start, resource_size(gemini_mem));
-	if (!gemini_base) {
-		rc = -ENOMEM;
-		GMN_PR_ERR("%s: ioremap failed\n", __func__);
-		goto fail1;
-	}
-
-	pgmn_dev->hw_version = GEMINI_8X60;
-	rc = msm_cam_clk_enable(&pgmn_dev->pdev->dev, gemini_8x_clk_info,
-	 pgmn_dev->gemini_clk, ARRAY_SIZE(gemini_8x_clk_info), 1);
-	if (rc < 0) {
-		pgmn_dev->hw_version = GEMINI_7X;
-		rc = msm_cam_clk_enable(&pgmn_dev->pdev->dev,
-			gemini_7x_clk_info, pgmn_dev->gemini_clk,
-			ARRAY_SIZE(gemini_7x_clk_info), 1);
-		if (rc < 0) {
-			GMN_PR_ERR("%s: clk failed rc = %d\n", __func__, rc);
-			goto fail2;
-		}
-	} else {
-		rc = msm_cam_clk_enable(&pgmn_dev->pdev->dev,
-				gemini_imem_clk_info, &pgmn_dev->gemini_clk[2],
-				ARRAY_SIZE(gemini_imem_clk_info), 1);
-		if (!rc)
-			pgmn_dev->hw_version = GEMINI_8960;
-	}
-
-	if (pgmn_dev->hw_version != GEMINI_7X) {
-		if (pgmn_dev->gemini_fs == NULL) {
-			pgmn_dev->gemini_fs =
-				regulator_get(&pgmn_dev->pdev->dev, "vdd");
-			if (IS_ERR(pgmn_dev->gemini_fs)) {
-				pr_err("%s: Regulator FS_ijpeg get failed %ld\n",
-					__func__, PTR_ERR(pgmn_dev->gemini_fs));
-				pgmn_dev->gemini_fs = NULL;
-				goto gemini_fs_failed;
-			} else if (regulator_enable(pgmn_dev->gemini_fs)) {
-				pr_err("%s: Regulator FS_ijpeg enable failed\n",
-								__func__);
-				regulator_put(pgmn_dev->gemini_fs);
-				pgmn_dev->gemini_fs = NULL;
-				goto gemini_fs_failed;
-			}
-		}
-	}
-
-	msm_gemini_hw_init(gemini_base, resource_size(gemini_mem));
-	rc = request_irq(gemini_irq, handler, IRQF_TRIGGER_RISING, "gemini",
-		context);
-	if (rc) {
-		GMN_PR_ERR("%s: request_irq failed, %d\n", __func__,
-			gemini_irq);
-		goto fail3;
-	}
-
-	*mem  = gemini_mem;
-	*base = gemini_base;
-	*irq  = gemini_irq;
-
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	gemini_client = msm_ion_client_create(-1, "camera/gemini");
-#endif
-	GMN_DBG("%s:%d] success\n", __func__, __LINE__);
-
-	return rc;
-
-fail3:
-	if (pgmn_dev->hw_version != GEMINI_7X) {
-		regulator_disable(pgmn_dev->gemini_fs);
-		regulator_put(pgmn_dev->gemini_fs);
-		pgmn_dev->gemini_fs = NULL;
-	}
-gemini_fs_failed:
-	if (pgmn_dev->hw_version == GEMINI_8960)
-		msm_cam_clk_enable(&pgmn_dev->pdev->dev, gemini_imem_clk_info,
-		 &pgmn_dev->gemini_clk[2], ARRAY_SIZE(gemini_imem_clk_info), 0);
-	if (pgmn_dev->hw_version != GEMINI_7X)
-		msm_cam_clk_enable(&pgmn_dev->pdev->dev, gemini_8x_clk_info,
-		pgmn_dev->gemini_clk, ARRAY_SIZE(gemini_8x_clk_info), 0);
-	else
-		msm_cam_clk_enable(&pgmn_dev->pdev->dev, gemini_7x_clk_info,
-		pgmn_dev->gemini_clk, ARRAY_SIZE(gemini_7x_clk_info), 0);
-fail2:
-	iounmap(gemini_base);
-fail1:
-	release_mem_region(gemini_mem->start, resource_size(gemini_mem));
-	GMN_DBG("%s:%d] fail\n", __func__, __LINE__);
-	return rc;
-}
-
-int msm_gemini_platform_release(struct resource *mem, void *base, int irq,
-	void *context)
-{
-	int result = 0;
-	struct msm_gemini_device *pgmn_dev =
-		(struct msm_gemini_device *) context;
-
-	free_irq(irq, context);
-
-	if (pgmn_dev->hw_version != GEMINI_7X) {
-		regulator_disable(pgmn_dev->gemini_fs);
-		regulator_put(pgmn_dev->gemini_fs);
-		pgmn_dev->gemini_fs = NULL;
-	}
-
-	if (pgmn_dev->hw_version == GEMINI_8960)
-		msm_cam_clk_enable(&pgmn_dev->pdev->dev, gemini_imem_clk_info,
-		 &pgmn_dev->gemini_clk[2], ARRAY_SIZE(gemini_imem_clk_info), 0);
-	if (pgmn_dev->hw_version != GEMINI_7X)
-		msm_cam_clk_enable(&pgmn_dev->pdev->dev, gemini_8x_clk_info,
-		pgmn_dev->gemini_clk, ARRAY_SIZE(gemini_8x_clk_info), 0);
-	else
-		msm_cam_clk_enable(&pgmn_dev->pdev->dev, gemini_7x_clk_info,
-		pgmn_dev->gemini_clk, ARRAY_SIZE(gemini_7x_clk_info), 0);
-
-	iounmap(base);
-	release_mem_region(mem->start, resource_size(mem));
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	ion_client_destroy(gemini_client);
-#endif
-	GMN_DBG("%s:%d] success\n", __func__, __LINE__);
-	return result;
-}
-
diff --git a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_platform.h b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_platform.h
deleted file mode 100644
index f6291dc..0000000
--- a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_platform.h
+++ /dev/null
@@ -1,37 +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_GEMINI_PLATFORM_H
-#define MSM_GEMINI_PLATFORM_H
-
-#include <linux/interrupt.h>
-#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,
-				struct ion_handle **ionhandle);
-
-int msm_gemini_platform_clk_enable(void);
-int msm_gemini_platform_clk_disable(void);
-
-int msm_gemini_platform_init(struct platform_device *pdev,
-	struct resource **mem,
-	void **base,
-	int *irq,
-	irqreturn_t (*handler) (int, void *),
-	void *context);
-int msm_gemini_platform_release(struct resource *mem, void *base, int irq,
-	void *context);
-
-#endif /* MSM_GEMINI_PLATFORM_H */
diff --git a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_sync.c b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_sync.c
deleted file mode 100644
index 0796b8d..0000000
--- a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_sync.c
+++ /dev/null
@@ -1,1084 +0,0 @@
-/* Copyright (c) 2010-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 <linux/sched.h>
-#include <linux/list.h>
-#include <linux/uaccess.h>
-#include <linux/slab.h>
-#include <media/msm_gemini.h>
-#include <mach/msm_bus.h>
-#include <mach/msm_bus_board.h>
-#include "msm_gemini_sync.h"
-#include "msm_gemini_core.h"
-#include "msm_gemini_platform.h"
-#include "msm_gemini_common.h"
-
-#define UINT32_MAX (0xFFFFFFFFU)
-
-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);
-	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_gemini_q_out(struct msm_gemini_q *q_p)
-{
-	unsigned long flags;
-	struct msm_gemini_q_entry *q_entry_p = NULL;
-	void *data = NULL;
-
-	GMN_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_gemini_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 {
-		GMN_DBG("%s:%d] %s no entry\n", __func__, __LINE__,
-			q_p->name);
-	}
-
-	return data;
-}
-
-inline int msm_gemini_q_in(struct msm_gemini_q *q_p, void *data)
-{
-	unsigned long flags;
-
-	struct msm_gemini_q_entry *q_entry_p;
-
-	GMN_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-
-	q_entry_p = kmalloc(sizeof(struct msm_gemini_q_entry), GFP_ATOMIC);
-	if (!q_entry_p) {
-		GMN_PR_ERR("%s: no mem\n", __func__);
-		return -1;
-	}
-	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_gemini_q_in_buf(struct msm_gemini_q *q_p,
-	struct msm_gemini_core_buf *buf)
-{
-	struct msm_gemini_core_buf *buf_p;
-
-	GMN_DBG("%s:%d]\n", __func__, __LINE__);
-	buf_p = kmalloc(sizeof(struct msm_gemini_core_buf), GFP_ATOMIC);
-	if (!buf_p) {
-		GMN_PR_ERR("%s: no mem\n", __func__);
-		return -1;
-	}
-
-	memcpy(buf_p, buf, sizeof(struct msm_gemini_core_buf));
-
-	msm_gemini_q_in(q_p, buf_p);
-	return 0;
-}
-
-inline int msm_gemini_q_wait(struct msm_gemini_q *q_p)
-{
-	int tm = MAX_SCHEDULE_TIMEOUT; /* 500ms */
-	int rc;
-
-	GMN_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));
-	GMN_DBG("%s:%d] %s wait done\n", __func__, __LINE__, q_p->name);
-	if (list_empty_careful(&q_p->q)) {
-		if (rc == 0) {
-			rc = -ETIMEDOUT;
-			GMN_PR_ERR("%s:%d] %s timeout\n", __func__, __LINE__,
-				q_p->name);
-		} else if (q_p->unblck) {
-			GMN_DBG("%s:%d] %s unblock is true\n", __func__,
-				__LINE__, q_p->name);
-			q_p->unblck = 0;
-			rc = -ECANCELED;
-		} else if (rc < 0) {
-			GMN_PR_ERR("%s:%d] %s rc %d\n", __func__, __LINE__,
-				q_p->name, rc);
-		}
-	}
-	return rc;
-}
-
-inline int msm_gemini_q_wakeup(struct msm_gemini_q *q_p)
-{
-	GMN_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-	wake_up(&q_p->wait);
-	return 0;
-}
-
-inline int msm_gemini_q_unblock(struct msm_gemini_q *q_p)
-{
-	GMN_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-	q_p->unblck = 1;
-	wake_up(&q_p->wait);
-	return 0;
-}
-
-inline void msm_gemini_outbuf_q_cleanup(struct msm_gemini_q *q_p)
-{
-	struct msm_gemini_core_buf *buf_p;
-	GMN_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-	do {
-		buf_p = msm_gemini_q_out(q_p);
-		if (buf_p) {
-			msm_gemini_platform_p2v(buf_p->file,
-				&buf_p->handle);
-			GMN_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-			kfree(buf_p);
-		}
-	} while (buf_p);
-	q_p->unblck = 0;
-}
-
-inline void msm_gemini_q_cleanup(struct msm_gemini_q *q_p)
-{
-	void *data;
-	GMN_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-	do {
-		data = msm_gemini_q_out(q_p);
-		if (data) {
-			GMN_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-			kfree(data);
-		}
-	} while (data);
-	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;
-
-	pr_debug("%s:%d] buf_in %p", __func__, __LINE__, buf_in);
-
-	if (buf_in) {
-		buf_in->vbuf.framedone_len = buf_in->framedone_len;
-		buf_in->vbuf.type = MSM_GEMINI_EVT_FRAMEDONE;
-		GMN_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_gemini_q_in_buf(&pgmn_dev->evt_q, buf_in);
-	} else {
-		GMN_PR_ERR("%s:%d] no output return buffer\n",
-			__func__, __LINE__);
-		rc = -1;
-	}
-
-	if (buf_in)
-		rc = msm_gemini_q_wakeup(&pgmn_dev->evt_q);
-
-	return rc;
-}
-
-int msm_gemini_evt_get(struct msm_gemini_device *pgmn_dev,
-	void __user *to)
-{
-	struct msm_gemini_core_buf *buf_p;
-	struct msm_gemini_ctrl_cmd ctrl_cmd;
-
-	GMN_DBG("%s:%d] Enter\n", __func__, __LINE__);
-
-	msm_gemini_q_wait(&pgmn_dev->evt_q);
-	buf_p = msm_gemini_q_out(&pgmn_dev->evt_q);
-
-	if (!buf_p) {
-		GMN_DBG("%s:%d] no buffer\n", __func__, __LINE__);
-		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;
-	}
-
-	return 0;
-}
-
-int msm_gemini_evt_get_unblock(struct msm_gemini_device *pgmn_dev)
-{
-	GMN_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	msm_gemini_q_unblock(&pgmn_dev->evt_q);
-	return 0;
-}
-
-void msm_gemini_reset_ack_irq(struct msm_gemini_device *pgmn_dev)
-{
-	GMN_DBG("%s:%d]\n", __func__, __LINE__);
-}
-
-void msm_gemini_err_irq(struct msm_gemini_device *pgmn_dev,
-	int event)
-{
-	int rc = 0;
-	struct msm_gemini_core_buf buf;
-
-	GMN_PR_ERR("%s:%d] error: %d\n", __func__, __LINE__, event);
-
-	buf.vbuf.type = MSM_GEMINI_EVT_ERR;
-	rc = msm_gemini_q_in_buf(&pgmn_dev->evt_q, &buf);
-	if (!rc)
-		rc = msm_gemini_q_wakeup(&pgmn_dev->evt_q);
-
-	if (!rc)
-		GMN_PR_ERR("%s:%d] err err\n", __func__, __LINE__);
-
-	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_debug("%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_debug("%s:%d] framedone %d", __func__, __LINE__, frame_done);
-	if (!pgmn_dev->out_buf_set) {
-		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) {
-			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)
-{
-	int rc = 0;
-	struct msm_gemini_core_buf *buf_out;
-
-	pr_debug("%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);
-
-	if (buf_in) {
-		pr_debug("%s:%d] 0x%08x %d\n", __func__, __LINE__,
-			(int) buf_in->y_buffer_addr, buf_in->y_len);
-		rc = msm_gemini_q_in_buf(&pgmn_dev->output_rtn_q, buf_in);
-	} else {
-		pr_debug("%s:%d] no output return buffer\n", __func__,
-			__LINE__);
-		rc = -1;
-		return rc;
-	}
-
-	buf_out = msm_gemini_q_out(&pgmn_dev->output_buf_q);
-
-	if (buf_out) {
-		rc = msm_gemini_core_we_buf_update(buf_out);
-		kfree(buf_out);
-	} else {
-		msm_gemini_core_we_buf_reset(buf_in);
-		pr_debug("%s:%d] no output buffer\n", __func__, __LINE__);
-		rc = -2;
-	}
-
-	if (buf_in)
-		rc = msm_gemini_q_wakeup(&pgmn_dev->output_rtn_q);
-
-	return rc;
-}
-
-int msm_gemini_output_get(struct msm_gemini_device *pgmn_dev, void __user *to)
-{
-	struct msm_gemini_core_buf *buf_p;
-	struct msm_gemini_buf buf_cmd;
-
-	GMN_DBG("%s:%d] Enter\n", __func__, __LINE__);
-
-	msm_gemini_q_wait(&pgmn_dev->output_rtn_q);
-	buf_p = msm_gemini_q_out(&pgmn_dev->output_rtn_q);
-
-	if (!buf_p) {
-		GMN_DBG("%s:%d] no output buffer return\n",
-			__func__, __LINE__);
-		return -EAGAIN;
-	}
-
-	buf_cmd = buf_p->vbuf;
-	msm_gemini_platform_p2v(buf_p->file, &buf_p->handle);
-	kfree(buf_p);
-
-	GMN_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))) {
-		GMN_PR_ERR("%s:%d]", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	return 0;
-}
-
-int msm_gemini_output_get_unblock(struct msm_gemini_device *pgmn_dev)
-{
-	GMN_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	msm_gemini_q_unblock(&pgmn_dev->output_rtn_q);
-	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) {
-		pr_err("%s:%d] outbuffer buffer already provided",
-			__func__, __LINE__);
-		return -EINVAL;
-	}
-
-	if (copy_from_user(&buf_cmd, arg, sizeof(struct msm_gemini_buf))) {
-		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) {
-		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)
-{
-	struct msm_gemini_buf buf_cmd;
-	struct msm_gemini_core_buf *buf_p;
-
-	GMN_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	if (copy_from_user(&buf_cmd, arg, sizeof(struct msm_gemini_buf))) {
-		GMN_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	buf_p = kmalloc(sizeof(struct msm_gemini_core_buf), GFP_ATOMIC);
-	if (!buf_p) {
-		GMN_PR_ERR("%s:%d] no mem\n", __func__, __LINE__);
-		return -1;
-	}
-
-	GMN_DBG("%s:%d] 0x%08x %d\n", __func__, __LINE__, (int) buf_cmd.vaddr,
-		buf_cmd.y_len);
-
-	buf_p->y_buffer_addr = msm_gemini_platform_v2p(buf_cmd.fd,
-		buf_cmd.y_len, &buf_p->file, &buf_p->handle);
-	if (!buf_p->y_buffer_addr) {
-		GMN_PR_ERR("%s:%d] v2p wrong\n", __func__, __LINE__);
-		kfree(buf_p);
-		return -1;
-	}
-	buf_p->y_len = buf_cmd.y_len;
-	buf_p->vbuf = buf_cmd;
-
-	msm_gemini_q_in(&pgmn_dev->output_buf_q, buf_p);
-	return 0;
-}
-
-/*************** input queue ****************/
-
-int msm_gemini_fe_pingpong_irq(struct msm_gemini_device *pgmn_dev,
-	struct msm_gemini_core_buf *buf_in)
-{
-	struct msm_gemini_core_buf *buf_out;
-	int rc = 0;
-
-	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);
-		rc = msm_gemini_q_in_buf(&pgmn_dev->input_rtn_q, buf_in);
-	} else {
-		GMN_DBG("%s:%d] no input return buffer\n", __func__,
-			__LINE__);
-		rc = -1;
-	}
-
-	buf_out = msm_gemini_q_out(&pgmn_dev->input_buf_q);
-
-	if (buf_out) {
-		rc = msm_gemini_core_fe_buf_update(buf_out);
-		kfree(buf_out);
-		msm_gemini_core_fe_start();
-	} else {
-		GMN_DBG("%s:%d] no input buffer\n", __func__, __LINE__);
-		rc = -2;
-	}
-
-	if (buf_in)
-		rc = msm_gemini_q_wakeup(&pgmn_dev->input_rtn_q);
-
-	return rc;
-}
-
-int msm_gemini_input_get(struct msm_gemini_device *pgmn_dev, void __user * to)
-{
-	struct msm_gemini_core_buf *buf_p;
-	struct msm_gemini_buf buf_cmd;
-
-	GMN_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	msm_gemini_q_wait(&pgmn_dev->input_rtn_q);
-	buf_p = msm_gemini_q_out(&pgmn_dev->input_rtn_q);
-
-	if (!buf_p) {
-		GMN_DBG("%s:%d] no input buffer return\n",
-			__func__, __LINE__);
-		return -EAGAIN;
-	}
-
-	buf_cmd = buf_p->vbuf;
-	if (pgmn_dev->op_mode == MSM_GEMINI_MODE_OFFLINE_ENCODE ||
-		pgmn_dev->op_mode == MSM_GEMINI_MODE_OFFLINE_ROTATION) {
-		msm_gemini_platform_p2v(buf_p->file, &buf_p->handle);
-	}
-	kfree(buf_p);
-
-	GMN_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))) {
-		GMN_PR_ERR("%s:%d]\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	return 0;
-}
-
-int msm_gemini_input_get_unblock(struct msm_gemini_device *pgmn_dev)
-{
-	GMN_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	msm_gemini_q_unblock(&pgmn_dev->input_rtn_q);
-	return 0;
-}
-
-int msm_gemini_input_buf_enqueue(struct msm_gemini_device *pgmn_dev,
-	void __user *arg)
-{
-	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__);
-		return -EFAULT;
-	}
-
-	buf_p = kmalloc(sizeof(struct msm_gemini_core_buf), GFP_ATOMIC);
-	if (!buf_p) {
-		GMN_PR_ERR("%s:%d] no mem\n", __func__, __LINE__);
-		return -1;
-	}
-
-	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(
-			(unsigned long)buf_cmd.y_off, CAMERA_DOMAIN, GEN_POOL,
-			((buf_cmd.y_len + buf_cmd.cbcr_len + 4095) & (~4095)),
-			SZ_4K, IOMMU_WRITE | IOMMU_READ,
-			(unsigned long *)&buf_p->y_buffer_addr);
-		if (rc < 0) {
-			pr_err("%s iommu mapping failed with error %d\n",
-				 __func__, rc);
-			kfree(buf_p);
-			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_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;
-	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,
-		buf_p->cbcr_len);
-
-	if (!buf_p->y_buffer_addr || !buf_p->cbcr_buffer_addr) {
-		GMN_PR_ERR("%s:%d] v2p wrong\n", __func__, __LINE__);
-		kfree(buf_p);
-		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);
-
-	return 0;
-}
-
-int msm_gemini_irq(int event, void *context, void *data)
-{
-	struct msm_gemini_device *pgmn_dev =
-		(struct msm_gemini_device *) context;
-
-	switch (event) {
-	case MSM_GEMINI_HW_MASK_COMP_FRAMEDONE:
-		msm_gemini_framedone_irq(pgmn_dev, data);
-		msm_gemini_we_pingpong_irq(pgmn_dev, data);
-		break;
-
-	case MSM_GEMINI_HW_MASK_COMP_FE:
-		msm_gemini_fe_pingpong_irq(pgmn_dev, data);
-		break;
-
-	case MSM_GEMINI_HW_MASK_COMP_WE:
-		msm_gemini_we_pingpong_irq(pgmn_dev, data);
-		break;
-
-	case MSM_GEMINI_HW_MASK_COMP_RESET_ACK:
-		msm_gemini_reset_ack_irq(pgmn_dev);
-		break;
-
-	case MSM_GEMINI_HW_MASK_COMP_ERR:
-	default:
-		msm_gemini_err_irq(pgmn_dev, event);
-		break;
-	}
-
-	return 0;
-}
-
-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;
-	}
-	pgmn_dev->open_count++;
-	mutex_unlock(&pgmn_dev->lock);
-
-	msm_gemini_core_irq_install(msm_gemini_irq);
-	rc = msm_gemini_platform_init(pgmn_dev->pdev,
-		&pgmn_dev->mem, &pgmn_dev->base,
-		&pgmn_dev->irq, msm_gemini_core_irq, pgmn_dev);
-	if (rc) {
-		GMN_PR_ERR("%s:%d] platform_init fail %d\n", __func__,
-			__LINE__, rc);
-		return rc;
-	}
-
-	GMN_DBG("%s:%d] platform resources - mem %p, base %p, irq %d\n",
-		__func__, __LINE__,
-		pgmn_dev->mem, pgmn_dev->base, pgmn_dev->irq);
-
-	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_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;
-
-	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;
-}
-
-int __msm_gemini_release(struct msm_gemini_device *pgmn_dev)
-{
-	GMN_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	mutex_lock(&pgmn_dev->lock);
-	if (!pgmn_dev->open_count) {
-		GMN_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);
-
-	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);
-	}
-	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__);
-
-	msm_gemini_platform_release(pgmn_dev->mem, pgmn_dev->base,
-		pgmn_dev->irq, pgmn_dev);
-
-	return 0;
-}
-
-int msm_gemini_ioctl_hw_cmd(struct msm_gemini_device *pgmn_dev,
-	void * __user arg)
-{
-	struct msm_gemini_hw_cmd hw_cmd;
-	int is_copy_to_user;
-
-	if (copy_from_user(&hw_cmd, arg, sizeof(struct msm_gemini_hw_cmd))) {
-		GMN_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	is_copy_to_user = msm_gemini_hw_exec_cmds(&hw_cmd, 1);
-	GMN_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))) {
-			GMN_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-			return -EFAULT;
-		}
-	}
-
-	return 0;
-}
-
-int msm_gemini_ioctl_hw_cmds(struct msm_gemini_device *pgmn_dev,
-	void * __user arg)
-{
-	int is_copy_to_user;
-	uint32_t len;
-	uint32_t m;
-	struct msm_gemini_hw_cmds *hw_cmds_p;
-	struct msm_gemini_hw_cmd *hw_cmd_p;
-
-	if (copy_from_user(&m, arg, sizeof(m))) {
-		GMN_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	if ((m == 0) || (m > ((UINT32_MAX - sizeof(struct msm_gemini_hw_cmds)) /
-		sizeof(struct msm_gemini_hw_cmd)))) {
-		GMN_PR_ERR("%s:%d] m_cmds out of range\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	len = sizeof(struct msm_gemini_hw_cmds) +
-		sizeof(struct msm_gemini_hw_cmd) * (m - 1);
-	hw_cmds_p = kmalloc(len, GFP_KERNEL);
-	if (!hw_cmds_p) {
-		GMN_PR_ERR("%s:%d] no mem %d\n", __func__, __LINE__, len);
-		return -EFAULT;
-	}
-
-	if (copy_from_user(hw_cmds_p, arg, len)) {
-		GMN_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		kfree(hw_cmds_p);
-		return -EFAULT;
-	}
-
-	hw_cmd_p = (struct msm_gemini_hw_cmd *) &(hw_cmds_p->hw_cmd);
-
-	is_copy_to_user = msm_gemini_hw_exec_cmds(hw_cmd_p, m);
-
-	if (is_copy_to_user >= 0) {
-		if (copy_to_user(arg, hw_cmds_p, len)) {
-			GMN_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-			kfree(hw_cmds_p);
-			return -EFAULT;
-		}
-	}
-	kfree(hw_cmds_p);
-	return 0;
-}
-
-int msm_gemini_start(struct msm_gemini_device *pgmn_dev, void * __user arg)
-{
-	struct msm_gemini_core_buf *buf_out;
-	struct msm_gemini_core_buf *buf_out_free[2] = {NULL, NULL};
-	int i, rc;
-
-	GMN_DBG("%s:%d] Enter\n", __func__, __LINE__);
-
-	release_buf = 1;
-	for (i = 0; i < 2; i++) {
-		buf_out = msm_gemini_q_out(&pgmn_dev->input_buf_q);
-
-		if (buf_out) {
-			msm_gemini_core_fe_buf_update(buf_out);
-			kfree(buf_out);
-		} else {
-			GMN_DBG("%s:%d] no input buffer\n", __func__, __LINE__);
-			break;
-		}
-	}
-
-	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);
-
-			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;
-			}
-		}
-		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);
-	}
-
-	rc = msm_gemini_ioctl_hw_cmds(pgmn_dev, arg);
-	GMN_DBG("%s:%d]\n", __func__, __LINE__);
-	return rc;
-}
-
-int msm_gemini_ioctl_reset(struct msm_gemini_device *pgmn_dev,
-	void * __user arg)
-{
-	int rc;
-	struct msm_gemini_ctrl_cmd ctrl_cmd;
-
-	GMN_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	if (copy_from_user(&ctrl_cmd, arg, sizeof(ctrl_cmd))) {
-		GMN_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	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;
-}
-
-long __msm_gemini_ioctl(struct msm_gemini_device *pgmn_dev,
-	unsigned int cmd, unsigned long arg)
-{
-	int rc = 0;
-	switch (cmd) {
-	case MSM_GMN_IOCTL_GET_HW_VERSION:
-		GMN_DBG("%s:%d] VERSION 1\n", __func__, __LINE__);
-		rc = msm_gemini_ioctl_hw_cmd(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_GMN_IOCTL_RESET:
-		rc = msm_gemini_ioctl_reset(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_GMN_IOCTL_STOP:
-		rc = msm_gemini_ioctl_hw_cmds(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_GMN_IOCTL_START:
-		rc = msm_gemini_start(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_GMN_IOCTL_INPUT_BUF_ENQUEUE:
-		rc = msm_gemini_input_buf_enqueue(pgmn_dev,
-			(void __user *) arg);
-		break;
-
-	case MSM_GMN_IOCTL_INPUT_GET:
-		rc = msm_gemini_input_get(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_GMN_IOCTL_INPUT_GET_UNBLOCK:
-		rc = msm_gemini_input_get_unblock(pgmn_dev);
-		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);
-		break;
-
-	case MSM_GMN_IOCTL_OUTPUT_GET:
-		rc = msm_gemini_output_get(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_GMN_IOCTL_OUTPUT_GET_UNBLOCK:
-		rc = msm_gemini_output_get_unblock(pgmn_dev);
-		break;
-
-	case MSM_GMN_IOCTL_EVT_GET:
-		rc = msm_gemini_evt_get(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_GMN_IOCTL_EVT_GET_UNBLOCK:
-		rc = msm_gemini_evt_get_unblock(pgmn_dev);
-		break;
-
-	case MSM_GMN_IOCTL_HW_CMD:
-		rc = msm_gemini_ioctl_hw_cmd(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_GMN_IOCTL_HW_CMDS:
-		rc = msm_gemini_ioctl_hw_cmds(pgmn_dev, (void __user *) 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));
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-
-struct msm_gemini_device *__msm_gemini_init(struct platform_device *pdev)
-{
-	struct msm_gemini_device *pgmn_dev;
-
-	pgmn_dev = kzalloc(sizeof(struct msm_gemini_device), GFP_ATOMIC);
-	if (!pgmn_dev) {
-		GMN_PR_ERR("%s:%d]no mem\n", __func__, __LINE__);
-		return NULL;
-	}
-
-	mutex_init(&pgmn_dev->lock);
-
-	pgmn_dev->pdev = pdev;
-
-	msm_gemini_q_init("evt_q", &pgmn_dev->evt_q);
-	msm_gemini_q_init("output_rtn_q", &pgmn_dev->output_rtn_q);
-	msm_gemini_q_init("output_buf_q", &pgmn_dev->output_buf_q);
-	msm_gemini_q_init("input_rtn_q", &pgmn_dev->input_rtn_q);
-	msm_gemini_q_init("input_buf_q", &pgmn_dev->input_buf_q);
-
-	return pgmn_dev;
-}
-
-int __msm_gemini_exit(struct msm_gemini_device *pgmn_dev)
-{
-	mutex_destroy(&pgmn_dev->lock);
-	kfree(pgmn_dev);
-	return 0;
-}
-
diff --git a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_sync.h b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_sync.h
deleted file mode 100644
index 88e9615..0000000
--- a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_sync.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copyright (c) 2010,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_GEMINI_SYNC_H
-#define MSM_GEMINI_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_gemini_core.h"
-
-#define GEMINI_7X 0x1
-#define GEMINI_8X60 (0x1 << 1)
-#define GEMINI_8960 (0x1 << 2)
-
-struct msm_gemini_q {
-	char const	*name;
-	struct list_head  q;
-	spinlock_t	lck;
-	wait_queue_head_t wait;
-	int	       unblck;
-};
-
-struct msm_gemini_q_entry {
-	struct list_head list;
-	void   *data;
-};
-
-struct msm_gemini_device {
-	struct platform_device *pdev;
-	struct resource        *mem;
-	int                     irq;
-	void                   *base;
-	struct clk *gemini_clk[3];
-	struct regulator *gemini_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_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;
-};
-
-int __msm_gemini_open(struct msm_gemini_device *pgmn_dev);
-int __msm_gemini_release(struct msm_gemini_device *pgmn_dev);
-
-long __msm_gemini_ioctl(struct msm_gemini_device *pgmn_dev,
-	unsigned int cmd, unsigned long arg);
-
-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 */
diff --git a/drivers/media/platform/msm/camera_v1/imx072.c b/drivers/media/platform/msm/camera_v1/imx072.c
deleted file mode 100644
index 29d2118..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/imx072.h b/drivers/media/platform/msm/camera_v1/imx072.h
deleted file mode 100644
index 95f688c..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/imx072_reg.c b/drivers/media/platform/msm/camera_v1/imx072_reg.c
deleted file mode 100644
index fc07e0f..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/imx074.c b/drivers/media/platform/msm/camera_v1/imx074.c
deleted file mode 100644
index 511c7db..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/imx074.h b/drivers/media/platform/msm/camera_v1/imx074.h
deleted file mode 100644
index 9468cb0..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/imx074_reg.c b/drivers/media/platform/msm/camera_v1/imx074_reg.c
deleted file mode 100644
index a9d19f2..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/io/Makefile b/drivers/media/platform/msm/camera_v1/io/Makefile
deleted file mode 100644
index 9ec119c..0000000
--- a/drivers/media/platform/msm/camera_v1/io/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-
-ccflags-y += -Idrivers/media/platform/msm/camera_v1 -Idrivers/media/platform/msm/camera_v1/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
diff --git a/drivers/media/platform/msm/camera_v1/io/msm_camera_i2c.c b/drivers/media/platform/msm/camera_v1/io/msm_camera_i2c.c
deleted file mode 100644
index bc826aa..0000000
--- a/drivers/media/platform/msm/camera_v1/io/msm_camera_i2c.c
+++ /dev/null
@@ -1,606 +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/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)
-{
-	int32_t rc = 0;
-	uint16_t saddr = dev_client->client->addr >> 1;
-	struct i2c_msg msgs[] = {
-		{
-			.addr  = saddr,
-			.flags = 0,
-			.len   = dev_client->addr_type,
-			.buf   = rxdata,
-		},
-		{
-			.addr  = saddr,
-			.flags = I2C_M_RD,
-			.len   = data_length,
-			.buf   = rxdata,
-		},
-	};
-	rc = i2c_transfer(dev_client->client->adapter, msgs, 2);
-	if (rc < 0)
-		S_I2C_DBG("msm_camera_i2c_rxdata failed 0x%x\n", saddr);
-	return rc;
-}
-
-int32_t msm_camera_i2c_txdata(struct msm_camera_i2c_client *dev_client,
-				unsigned char *txdata, int length)
-{
-	int32_t rc = 0;
-	uint16_t saddr = dev_client->client->addr >> 1;
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = length,
-			.buf = txdata,
-		 },
-	};
-	rc = i2c_transfer(dev_client->client->adapter, msg, 1);
-	if (rc < 0)
-		S_I2C_DBG("msm_camera_i2c_txdata faild 0x%x\n", saddr);
-	return 0;
-}
-
-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)
-{
-	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
-		&& data_type != MSM_CAMERA_I2C_WORD_DATA))
-		return rc;
-
-	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__);
-	}
-	return rc;
-}
-
-int32_t msm_camera_i2c_write_seq(struct msm_camera_i2c_client *client,
-	uint16_t addr, uint8_t *data, uint16_t num_byte)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[client->addr_type+num_byte];
-	uint8_t len = 0, i = 0;
-
-	if ((client->addr_type != MSM_CAMERA_I2C_BYTE_ADDR
-		&& client->addr_type != MSM_CAMERA_I2C_WORD_ADDR)
-		|| num_byte == 0)
-		return rc;
-
-	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__);
-	}
-	return rc;
-}
-
-int32_t msm_camera_i2c_set_mask(struct msm_camera_i2c_client *client,
-	uint16_t addr, uint16_t mask,
-	enum msm_camera_i2c_data_type data_type, uint16_t set_mask)
-{
-	int32_t rc;
-	uint16_t reg_data;
-
-	rc = msm_camera_i2c_read(client, addr, &reg_data, data_type);
-	if (rc < 0) {
-		S_I2C_DBG("%s read fail\n", __func__);
-		return rc;
-	}
-	S_I2C_DBG("%s addr: 0x%x data: 0x%x setmask: 0x%x\n",
-			__func__, addr, reg_data, mask);
-
-	if (set_mask)
-		reg_data |= mask;
-	else
-		reg_data &= ~mask;
-	S_I2C_DBG("%s write: 0x%x\n", __func__, reg_data);
-
-	rc = msm_camera_i2c_write(client, addr, reg_data, data_type);
-	if (rc < 0)
-		S_I2C_DBG("%s write fail\n", __func__);
-
-	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)
-{
-	int32_t rc;
-	uint16_t reg_data;
-	CDBG("%s\n", __func__);
-	if (mask == -1)
-		return 0;
-	if (mask == 0)
-		rc = msm_camera_i2c_write(client, addr, data, data_type);
-	else{
-		rc = msm_camera_i2c_read(client, addr, &reg_data, data_type);
-		if (rc < 0) {
-			CDBG("%s read fail\n", __func__);
-			return rc;
-		}
-		reg_data  = reg_data & mask;
-		reg_data  = (reg_data | (data & (~mask)));
-		rc = msm_camera_i2c_write(client, addr, reg_data, data_type);
-		if (rc < 0)
-			CDBG("%s write fail\n", __func__);
-	}
-	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)
-{
-	int32_t rc = -EIO;
-	uint16_t reg_data = 0;
-	int data_len = 0;
-	switch (data_type) {
-	case MSM_CAMERA_I2C_BYTE_DATA:
-	case MSM_CAMERA_I2C_WORD_DATA:
-		data_len = data_type;
-		break;
-	case MSM_CAMERA_I2C_SET_BYTE_MASK:
-	case MSM_CAMERA_I2C_UNSET_BYTE_MASK:
-		data_len = MSM_CAMERA_I2C_BYTE_DATA;
-		break;
-	case MSM_CAMERA_I2C_SET_WORD_MASK:
-	case MSM_CAMERA_I2C_UNSET_WORD_MASK:
-		data_len = MSM_CAMERA_I2C_WORD_DATA;
-		break;
-	default:
-		pr_err("%s: Unsupport data type: %d\n", __func__, data_type);
-		break;
-	}
-
-	rc = msm_camera_i2c_read(client,
-		addr, &reg_data, data_len);
-	if (rc < 0)
-		return rc;
-
-	rc = 0;
-	switch (data_type) {
-	case MSM_CAMERA_I2C_BYTE_DATA:
-	case MSM_CAMERA_I2C_WORD_DATA:
-		if (data == reg_data)
-			return rc;
-		break;
-	case MSM_CAMERA_I2C_SET_BYTE_MASK:
-	case MSM_CAMERA_I2C_SET_WORD_MASK:
-		if ((reg_data & data) == data)
-			return rc;
-		break;
-	case MSM_CAMERA_I2C_UNSET_BYTE_MASK:
-	case MSM_CAMERA_I2C_UNSET_WORD_MASK:
-		if (!(reg_data & data))
-			return rc;
-		break;
-	default:
-		pr_err("%s: Unsupport data type: %d\n", __func__, data_type);
-		break;
-	}
-
-	S_I2C_DBG("%s: Register and data does not match\n", __func__);
-	rc = 1;
-	return rc;
-}
-
-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 rc = -EIO;
-	int i;
-	S_I2C_DBG("%s: addr: 0x%x data: 0x%x dt: %d\n",
-		__func__, addr, data, data_type);
-
-	for (i = 0; i < 20; i++) {
-		rc = msm_camera_i2c_compare(client,
-			addr, data, data_type);
-		if (rc == 0 || rc < 0)
-			break;
-		usleep_range(10000, 11000);
-	}
-	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)
-{
-	int i;
-	int32_t rc = -EFAULT;
-
-	if (!client || !reg_tbl)
-		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;
-
-	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++;
-	}
-	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;
-}
-
-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,
-	enum msm_camera_i2c_data_type data_type)
-{
-	int i;
-	int32_t rc = -EFAULT;
-	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->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)
-			break;
-		reg_conf_tbl++;
-	}
-	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)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[client->addr_type+data_type];
-
-	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;
-
-	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 (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\n", __func__, addr, *data);
-	return rc;
-}
-
-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 rc = -EFAULT;
-	unsigned char buf[client->addr_type+num_byte];
-	int i;
-
-	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;
-		}
-	}
-
-	S_I2C_DBG("%s addr = 0x%x", __func__, addr);
-	for (i = 0; i < num_byte; i++) {
-		data[i] = buf[i];
-		S_I2C_DBG("Byte %d: 0x%x\n", i, buf[i]);
-		S_I2C_DBG("Data: 0x%x\n", data[i]);
-	}
-	return rc;
-}
-
-int32_t msm_sensor_write_conf_array(struct msm_camera_i2c_client *client,
-			struct msm_camera_i2c_conf_array *array, uint16_t index)
-{
-	int32_t rc;
-
-	rc = msm_camera_i2c_write_tbl(client,
-		(struct msm_camera_i2c_reg_conf *) array[index].conf,
-		array[index].size, array[index].data_type);
-	if (array[index].delay > 20)
-		msleep(array[index].delay);
-	else
-		usleep_range(array[index].delay*1000,
-					(array[index].delay+1)*1000);
-	return rc;
-}
-
-int32_t msm_sensor_write_enum_conf_array(struct msm_camera_i2c_client *client,
-			struct msm_camera_i2c_enum_conf_array *conf,
-			uint16_t enum_val)
-{
-	int32_t rc = -1, i;
-	for (i = 0; i < conf->num_enum; i++) {
-		if (conf->conf_enum[i] == enum_val)
-			break;
-		if (conf->conf_enum[i] > enum_val)
-			break;
-	}
-	if (i == conf->num_enum)
-		i = conf->num_enum - 1;
-
-	if (i >= conf->num_index)
-		return rc;
-	rc = msm_sensor_write_all_conf_array(client,
-		&conf->conf[i*conf->num_conf], conf->num_conf);
-
-	if (conf->delay > 20)
-		msleep(conf->delay);
-	else
-		usleep_range(conf->delay*1000,
-					(conf->delay+1)*1000);
-	return rc;
-}
-
-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 rc = 0, i;
-	for (i = 0; i < size; i++) {
-		rc = msm_sensor_write_conf_array(client, array, i);
-		if (rc < 0)
-			break;
-	}
-	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/platform/msm/camera_v1/io/msm_camera_i2c.h b/drivers/media/platform/msm/camera_v1/io/msm_camera_i2c.h
deleted file mode 100644
index ce42607..0000000
--- a/drivers/media/platform/msm/camera_v1/io/msm_camera_i2c.h
+++ /dev/null
@@ -1,115 +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_I2C_H
-#define MSM_CAMERA_I2C_H
-
-#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
-
-#if CONFIG_MSM_CAMERA_I2C_DBG
-#define S_I2C_DBG(fmt, args...) printk(fmt, ##args)
-#else
-#define S_I2C_DBG(fmt, args...) CDBG(fmt, ##args)
-#endif
-
-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 {
-	uint16_t reg_addr;
-	uint16_t reg_data;
-	uint16_t delay;
-};
-
-struct msm_camera_i2c_conf_array {
-	struct msm_camera_i2c_reg_conf *conf;
-	uint16_t size;
-	uint16_t delay;
-	enum msm_camera_i2c_data_type data_type;
-};
-
-struct msm_camera_i2c_enum_conf_array {
-	struct msm_camera_i2c_conf_array *conf;
-	int *conf_enum;
-	uint16_t num_enum;
-	uint16_t num_index;
-	uint16_t num_conf;
-	uint16_t delay;
-	enum msm_camera_i2c_data_type data_type;
-};
-
-int32_t msm_camera_i2c_rxdata(struct msm_camera_i2c_client *client,
-	unsigned char *rxdata, int data_length);
-
-int32_t msm_camera_i2c_txdata(struct msm_camera_i2c_client *client,
-	unsigned char *txdata, int length);
-
-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(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_seq(struct msm_camera_i2c_client *client,
-	uint16_t addr, uint8_t *data, uint16_t num_byte);
-
-int32_t msm_camera_i2c_set_mask(struct msm_camera_i2c_client *client,
-	uint16_t addr, uint16_t mask,
-	enum msm_camera_i2c_data_type data_type, uint16_t flag);
-
-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);
-
-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_write_tbl(struct msm_camera_i2c_client *client,
-	struct msm_camera_i2c_reg_conf *reg_conf_tbl, uint16_t size,
-	enum msm_camera_i2c_data_type data_type);
-
-int32_t msm_sensor_write_conf_array(struct msm_camera_i2c_client *client,
-	struct msm_camera_i2c_conf_array *array, uint16_t index);
-
-int32_t msm_sensor_write_enum_conf_array(struct msm_camera_i2c_client *client,
-	struct msm_camera_i2c_enum_conf_array *conf, uint16_t enum_val);
-
-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/platform/msm/camera_v1/io/msm_camera_i2c_mux.c b/drivers/media/platform/msm/camera_v1/io/msm_camera_i2c_mux.c
deleted file mode 100644
index b24a91a..0000000
--- a/drivers/media/platform/msm/camera_v1/io/msm_camera_i2c_mux.c
+++ /dev/null
@@ -1,187 +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/module.h>
-#include <mach/board.h>
-#include <mach/camera.h>
-#include "msm.h"
-#include "msm_camera_i2c_mux.h"
-
-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);
-	if (*mode == MODE_DUAL) {
-		msm_camera_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);
-		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);
-		CDBG("the camio mode config right value is %d\n", val);
-	}
-	return 0;
-}
-
-static int msm_i2c_mux_init(struct i2c_mux_device *mux_device)
-{
-	int rc = 0, val = 0;
-	if (mux_device->use_count == 0) {
-		mux_device->ctl_base = ioremap(mux_device->ctl_mem->start,
-			resource_size(mux_device->ctl_mem));
-		if (!mux_device->ctl_base) {
-			rc = -ENOMEM;
-			return rc;
-		}
-		mux_device->rw_base = ioremap(mux_device->rw_mem->start,
-			resource_size(mux_device->rw_mem));
-		if (!mux_device->rw_base) {
-			rc = -ENOMEM;
-			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);
-	}
-	mux_device->use_count++;
-	return 0;
-};
-
-static int msm_i2c_mux_release(struct i2c_mux_device *mux_device)
-{
-	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);
-		iounmap(mux_device->rw_base);
-		iounmap(mux_device->ctl_base);
-	}
-	return 0;
-}
-
-static long msm_i2c_mux_subdev_ioctl(struct v4l2_subdev *sd,
-			unsigned int cmd, void *arg)
-{
-	struct i2c_mux_device *mux_device;
-	int rc = 0;
-	mux_device = v4l2_get_subdevdata(sd);
-	if (mux_device == NULL) {
-		rc = -ENOMEM;
-		return rc;
-	}
-	mutex_lock(&mux_device->mutex);
-	switch (cmd) {
-	case VIDIOC_MSM_I2C_MUX_CFG:
-		rc = msm_i2c_mux_config(mux_device, (uint8_t *) arg);
-		break;
-	case VIDIOC_MSM_I2C_MUX_INIT:
-		rc = msm_i2c_mux_init(mux_device);
-		break;
-	case VIDIOC_MSM_I2C_MUX_RELEASE:
-		rc = msm_i2c_mux_release(mux_device);
-		break;
-	default:
-		rc = -ENOIOCTLCMD;
-	}
-	mutex_unlock(&mux_device->mutex);
-	return rc;
-}
-
-static struct v4l2_subdev_core_ops msm_i2c_mux_subdev_core_ops = {
-	.ioctl = &msm_i2c_mux_subdev_ioctl,
-};
-
-static const struct v4l2_subdev_ops msm_i2c_mux_subdev_ops = {
-	.core = &msm_i2c_mux_subdev_core_ops,
-};
-
-static int __devinit i2c_mux_probe(struct platform_device *pdev)
-{
-	struct i2c_mux_device *mux_device;
-	int rc = 0;
-	CDBG("%s: device id = %d\n", __func__, pdev->id);
-	mux_device = kzalloc(sizeof(struct i2c_mux_device), GFP_KERNEL);
-	if (!mux_device) {
-		pr_err("%s: no enough memory\n", __func__);
-		return -ENOMEM;
-	}
-
-	v4l2_subdev_init(&mux_device->subdev, &msm_i2c_mux_subdev_ops);
-	v4l2_set_subdevdata(&mux_device->subdev, mux_device);
-	platform_set_drvdata(pdev, &mux_device->subdev);
-	mutex_init(&mux_device->mutex);
-
-	mux_device->ctl_mem = platform_get_resource_byname(pdev,
-					IORESOURCE_MEM, "i2c_mux_ctl");
-	if (!mux_device->ctl_mem) {
-		pr_err("%s: no mem resource?\n", __func__);
-		rc = -ENODEV;
-		goto i2c_mux_no_resource;
-	}
-	mux_device->ctl_io = request_mem_region(mux_device->ctl_mem->start,
-		resource_size(mux_device->ctl_mem), pdev->name);
-	if (!mux_device->ctl_io) {
-		pr_err("%s: no valid mem region\n", __func__);
-		rc = -EBUSY;
-		goto i2c_mux_no_resource;
-	}
-	mux_device->rw_mem = platform_get_resource_byname(pdev,
-					IORESOURCE_MEM, "i2c_mux_rw");
-	if (!mux_device->rw_mem) {
-		pr_err("%s: no mem resource?\n", __func__);
-		rc = -ENODEV;
-		goto i2c_mux_no_resource;
-	}
-	mux_device->rw_io = request_mem_region(mux_device->rw_mem->start,
-		resource_size(mux_device->rw_mem), pdev->name);
-	if (!mux_device->rw_io) {
-		pr_err("%s: no valid mem region\n", __func__);
-		rc = -EBUSY;
-		goto i2c_mux_no_resource;
-	}
-	mux_device->pdev = pdev;
-	return 0;
-
-i2c_mux_no_resource:
-	mutex_destroy(&mux_device->mutex);
-	kfree(mux_device);
-	return 0;
-}
-
-static struct platform_driver i2c_mux_driver = {
-	.probe = i2c_mux_probe,
-	.driver = {
-		.name = MSM_I2C_MUX_DRV_NAME,
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init msm_camera_i2c_mux_init_module(void)
-{
-	return platform_driver_register(&i2c_mux_driver);
-}
-
-static void __exit msm_camera_i2c_mux_exit_module(void)
-{
-	platform_driver_unregister(&i2c_mux_driver);
-}
-
-module_init(msm_camera_i2c_mux_init_module);
-module_exit(msm_camera_i2c_mux_exit_module);
-MODULE_DESCRIPTION("MSM Camera I2C mux driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/platform/msm/camera_v1/io/msm_camera_i2c_mux.h b/drivers/media/platform/msm/camera_v1/io/msm_camera_i2c_mux.h
deleted file mode 100644
index 30f908b..0000000
--- a/drivers/media/platform/msm/camera_v1/io/msm_camera_i2c_mux.h
+++ /dev/null
@@ -1,46 +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_I2C_MUX_H
-#define MSM_I2C_MUX_H
-
-#include <linux/io.h>
-#include <media/v4l2-subdev.h>
-
-struct i2c_mux_device {
-	struct platform_device *pdev;
-	struct v4l2_subdev subdev;
-	struct resource *ctl_mem;
-	struct resource *ctl_io;
-	void __iomem *ctl_base;
-	struct resource *rw_mem;
-	struct resource *rw_io;
-	void __iomem *rw_base;
-	struct mutex mutex;
-	unsigned use_count;
-};
-
-struct i2c_mux_cfg_params {
-	struct v4l2_subdev *subdev;
-	void *parms;
-};
-
-#define VIDIOC_MSM_I2C_MUX_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 13, struct i2c_mux_cfg_params)
-
-#define VIDIOC_MSM_I2C_MUX_INIT \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 14, struct v4l2_subdev*)
-
-#define VIDIOC_MSM_I2C_MUX_RELEASE \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 15, struct v4l2_subdev*)
-
-#endif
diff --git a/drivers/media/platform/msm/camera_v1/io/msm_camera_io_util.c b/drivers/media/platform/msm/camera_v1/io/msm_camera_io_util.c
deleted file mode 100644
index 1e0a013..0000000
--- a/drivers/media/platform/msm/camera_v1/io/msm_camera_io_util.c
+++ /dev/null
@@ -1,535 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundataion. All rights reserved.
- *
- * This 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;
-			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;
-		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__);
-	}
-}
-
-int msm_camera_init_gpio_table(struct gpio *gpio_tbl, uint8_t gpio_tbl_size,
-	int gpio_en)
-{
-	int rc = 0;
-
-	if (gpio_en) {
-		rc = gpio_request_array(gpio_tbl, gpio_tbl_size);
-		if (rc < 0) {
-			pr_err("%s:%d failed\n" , __func__, __LINE__);
-			return rc;
-		}
-	} else {
-		gpio_free_array(gpio_tbl, gpio_tbl_size);
-	}
-	return rc;
-}
-
-int msm_camera_set_gpio_table(struct msm_gpio_set_tbl *gpio_tbl,
-	uint8_t gpio_tbl_size, int gpio_en)
-{
-	int rc = 0, i;
-
-	if (gpio_en) {
-		for (i = 0; i < gpio_tbl_size; i++) {
-			gpio_set_value_cansleep(gpio_tbl[i].gpio,
-				gpio_tbl[i].flags);
-			usleep_range(gpio_tbl[i].delay,
-				gpio_tbl[i].delay + 1000);
-		}
-	} else {
-		for (i = gpio_tbl_size - 1; i >= 0; i--) {
-			if (gpio_tbl[i].flags)
-				gpio_set_value_cansleep(gpio_tbl[i].gpio,
-					GPIOF_OUT_INIT_LOW);
-		}
-	}
-	return rc;
-}
diff --git a/drivers/media/platform/msm/camera_v1/io/msm_io7x.c b/drivers/media/platform/msm/camera_v1/io/msm_io7x.c
deleted file mode 100644
index ebdaeb1..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/io/msm_io8x.c b/drivers/media/platform/msm/camera_v1/io/msm_io8x.c
deleted file mode 100644
index dba93a0..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/io/msm_io_7x27a.c b/drivers/media/platform/msm/camera_v1/io/msm_io_7x27a.c
deleted file mode 100644
index 6e70d37..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/io/msm_io_7x27a_v4l2.c b/drivers/media/platform/msm/camera_v1/io/msm_io_7x27a_v4l2.c
deleted file mode 100644
index 6d2a11d..0000000
--- a/drivers/media/platform/msm/camera_v1/io/msm_io_7x27a_v4l2.c
+++ /dev/null
@@ -1,218 +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();
-		update_axi_qos(MSM_AXI_QOS_PREVIEW);
-		axi_allocate(AXI_FLOW_VIEWFINDER_HI);
-		break;
-	case S_PREVIEW:
-		break;
-	case S_VIDEO:
-		break;
-	case S_CAPTURE:
-		break;
-	case S_DEFAULT:
-		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/platform/msm/camera_v1/io/msm_io_8960.c b/drivers/media/platform/msm/camera_v1/io/msm_io_8960.c
deleted file mode 100644
index 6dc4fa4..0000000
--- a/drivers/media/platform/msm/camera_v1/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_ADV_VIDEO:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 7);
-			CDBG("%s: S_ADV_VIDEO 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/platform/msm/camera_v1/io/msm_io_8x60.c b/drivers/media/platform/msm/camera_v1/io/msm_io_8x60.c
deleted file mode 100644
index 6896538..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/io/msm_io_vfe31.c b/drivers/media/platform/msm/camera_v1/io/msm_io_vfe31.c
deleted file mode 100644
index 1cd2782..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/io/msm_io_vfe31_v4l2.c b/drivers/media/platform/msm/camera_v1/io/msm_io_vfe31_v4l2.c
deleted file mode 100644
index acf87e4..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mercury/Makefile b/drivers/media/platform/msm/camera_v1/mercury/Makefile
deleted file mode 100644
index bc9c950..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1
-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/platform/msm/camera_v1/mercury/msm_mercury_common.h b/drivers/media/platform/msm/camera_v1/mercury/msm_mercury_common.h
deleted file mode 100644
index 8ce7f7e..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mercury/msm_mercury_core.c b/drivers/media/platform/msm/camera_v1/mercury/msm_mercury_core.c
deleted file mode 100644
index b0630f0..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mercury/msm_mercury_core.h b/drivers/media/platform/msm/camera_v1/mercury/msm_mercury_core.h
deleted file mode 100644
index 7237e7b..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mercury/msm_mercury_dev.c b/drivers/media/platform/msm/camera_v1/mercury/msm_mercury_dev.c
deleted file mode 100644
index b245bfd..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mercury/msm_mercury_hw.c b/drivers/media/platform/msm/camera_v1/mercury/msm_mercury_hw.c
deleted file mode 100644
index 244c038..0000000
--- a/drivers/media/platform/msm/camera_v1/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, int 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/platform/msm/camera_v1/mercury/msm_mercury_hw.h b/drivers/media/platform/msm/camera_v1/mercury/msm_mercury_hw.h
deleted file mode 100644
index 54fc818..0000000
--- a/drivers/media/platform/msm/camera_v1/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, int 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/platform/msm/camera_v1/mercury/msm_mercury_hw_reg.h b/drivers/media/platform/msm/camera_v1/mercury/msm_mercury_hw_reg.h
deleted file mode 100644
index 015bf49..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mercury/msm_mercury_macros.h b/drivers/media/platform/msm/camera_v1/mercury/msm_mercury_macros.h
deleted file mode 100644
index 0ab07cd..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mercury/msm_mercury_platform.c b/drivers/media/platform/msm/camera_v1/mercury/msm_mercury_platform.c
deleted file mode 100644
index cda36d9..0000000
--- a/drivers/media/platform/msm/camera_v1/mercury/msm_mercury_platform.c
+++ /dev/null
@@ -1,186 +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 <mach/clk.h>
-#include <mach/camera.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;
-#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);
-	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/platform/msm/camera_v1/mercury/msm_mercury_platform.h b/drivers/media/platform/msm/camera_v1/mercury/msm_mercury_platform.h
deleted file mode 100644
index dfdea3c..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mercury/msm_mercury_sync.c b/drivers/media/platform/msm/camera_v1/mercury/msm_mercury_sync.c
deleted file mode 100644
index e6483c1..0000000
--- a/drivers/media/platform/msm/camera_v1/mercury/msm_mercury_sync.c
+++ /dev/null
@@ -1,615 +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 <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__);
-	memset(&ctrl_cmd, 0, sizeof(ctrl_cmd));
-	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/platform/msm/camera_v1/mercury/msm_mercury_sync.h b/drivers/media/platform/msm/camera_v1/mercury/msm_mercury_sync.h
deleted file mode 100644
index a44092f..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/msm.c b/drivers/media/platform/msm/camera_v1/msm.c
deleted file mode 100644
index ef1edae..0000000
--- a/drivers/media/platform/msm/camera_v1/msm.c
+++ /dev/null
@@ -1,1590 +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/workqueue.h>
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/list.h>
-#include <linux/ioctl.h>
-#include <linux/spinlock.h>
-#include <linux/proc_fs.h>
-#include "msm.h"
-#include "msm_cam_server.h"
-#include "msm_sensor.h"
-#include "msm_actuator.h"
-#include "msm_camera_eeprom.h"
-
-#define MSM_MAX_CAMERA_SENSORS 5
-
-#ifdef CONFIG_MSM_CAMERA_DEBUG
-#define D(fmt, args...) pr_debug("msm: " fmt, ##args)
-#else
-#define D(fmt, args...) do {} while (0)
-#endif
-
-static unsigned msm_camera_v4l2_nr = -1;
-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 void msm_cam_v4l2_subdev_notify(struct v4l2_subdev *sd,
-				unsigned int notification, void *arg)
-{
-	struct msm_cam_v4l2_device *pcam;
-	struct msm_cam_media_controller *pmctl;
-
-	if (sd == NULL)
-		return;
-
-	pcam = to_pcam(sd->v4l2_dev);
-
-	if (pcam == NULL)
-		return;
-
-	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
-	if (pmctl == NULL)
-		return;
-}
-
-/*
- *
- * implementation of v4l2_ioctl_ops
- *
- */
-static int msm_camera_v4l2_querycap(struct file *f, void *pctx,
-				struct v4l2_capability *pcaps)
-{
-
-	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;
-}
-
-static int msm_camera_v4l2_queryctrl(struct file *f, void *pctx,
-				struct v4l2_queryctrl *pqctrl)
-{
-	int rc = 0;
-	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_q_ctrl(pcam, pqctrl);
-	mutex_unlock(&pcam->vid_lock);
-	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)
-{
-	int rc = 0;
-	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_g_ctrl(pcam, c);
-	mutex_unlock(&pcam->vid_lock);
-
-	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)
-{
-	int rc = 0;
-	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);
-
-	D("%s\n", __func__);
-
-	WARN_ON(pctx != f->private_data);
-	mutex_lock(&pcam->vid_lock);
-	switch (ctrl->id) {
-	case MSM_V4L2_PID_MMAP_INST:
-		D("%s: mmap_inst=(0x%p, %d)\n",
-			 __func__, pcam_inst, pcam_inst->my_index);
-		pcam_inst->is_mem_map_inst = 1;
-		break;
-	default:
-		if (ctrl->id == MSM_V4L2_PID_CAM_MODE)
-			pcam->op_mode = ctrl->value;
-		rc = msm_server_s_ctrl(pcam, ctrl);
-		break;
-	}
-	mutex_unlock(&pcam->vid_lock);
-
-	return rc;
-}
-
-static int msm_camera_v4l2_reqbufs(struct file *f, void *pctx,
-				struct v4l2_requestbuffers *pb)
-{
-	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__);
-			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);
-		mutex_unlock(&pcam_inst->inst_lock);
-		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++) {
-			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;
-		}
-	} 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);
-		if (!pcam_inst->buf_offset) {
-			pr_err("%s out of memory ", __func__);
-			mutex_unlock(&pcam_inst->inst_lock);
-			return -ENOMEM;
-		}
-		for (i = 0; i < pb->count; i++) {
-			pcam_inst->buf_offset[i] =
-				kzalloc(sizeof(struct msm_cam_buf_offset) *
-				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--) {
-					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);
-				return -ENOMEM;
-			}
-		}
-	}
-	pcam_inst->buf_count = pb->count;
-	mutex_unlock(&pcam_inst->inst_lock);
-	return rc;
-}
-
-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;
-	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);
-	rc = vb2_querybuf(&pcam_inst->vid_bufq, pb);
-	mutex_unlock(&pcam_inst->inst_lock);
-	return rc;
-}
-
-static int msm_camera_v4l2_qbuf(struct file *f, void *pctx,
-					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);
-
-	D("%s Inst=%p, mode=%d, idx=%d\n", __func__, pcam_inst,
-		pcam_inst->image_mode, pb->index);
-	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__);
-		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__);
-			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",
-				__func__, i, pb->m.planes[i].reserved[0],
-				pb->m.planes[i].data_offset);
-			pcam_inst->buf_offset[pb->index][i].data_offset =
-				pb->m.planes[i].data_offset;
-			pcam_inst->buf_offset[pb->index][i].addr_offset =
-				pb->m.planes[i].reserved[0];
-		}
-	} else {
-		D("%s stored reserved info %d\n", __func__, pb->reserved);
-		pcam_inst->buf_offset[pb->index][0].addr_offset = pb->reserved;
-	}
-
-	rc = vb2_qbuf(&pcam_inst->vid_bufq, pb);
-	D("%s, videobuf_qbuf mode %d and idx %d returns %d\n", __func__,
-		pcam_inst->image_mode, pb->index, rc);
-	mutex_unlock(&pcam_inst->inst_lock);
-	return rc;
-}
-
-static int msm_camera_v4l2_dqbuf(struct file *f, void *pctx,
-					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);
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	mutex_lock(&pcam_inst->inst_lock);
-	if (0 == pcam_inst->streamon) {
-		mutex_unlock(&pcam_inst->inst_lock);
-		return -EACCES;
-	}
-	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 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;
-	}
-
-	mutex_unlock(&pcam_inst->inst_lock);
-	return rc;
-}
-
-static int msm_camera_v4l2_streamon(struct file *f, void *pctx,
-					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,
-		struct msm_cam_v4l2_dev_inst, eventHandle);
-
-	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__);
-		mutex_unlock(&pcam_inst->inst_lock);
-		mutex_unlock(&pcam->vid_lock);
-		return -EINVAL;
-	}
-
-	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);
-	mutex_unlock(&pcam->vid_lock);
-	D("%s rc = %d\n", __func__, rc);
-	return rc;
-}
-
-static int msm_camera_v4l2_streamoff(struct file *f, void *pctx,
-					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,
-		struct msm_cam_v4l2_dev_inst, eventHandle);
-
-	D("%s Inst %p\n", __func__, pcam_inst);
-	WARN_ON(pctx != f->private_data);
-
-	if ((buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) &&
-		(buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE)) {
-		pr_err("%s Invalid buffer type ", __func__);
-		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)
-		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 */
-	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;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-	if ((pfmtdesc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) &&
-		(pfmtdesc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE))
-		return -EINVAL;
-
-	if (pfmtdesc->index >= pcam->num_fmts)
-		return -EINVAL;
-
-	isp_fmt = &pcam->usr_fmts[pfmtdesc->index];
-
-	if (isp_fmt->name)
-		strlcpy(pfmtdesc->description, isp_fmt->name,
-						sizeof(pfmtdesc->description));
-
-	pfmtdesc->pixelformat = isp_fmt->fourcc;
-
-	D("%s: [%d] 0x%x, %s\n", __func__, pfmtdesc->index,
-		isp_fmt->fourcc, isp_fmt->name);
-	return 0;
-}
-
-static int msm_camera_v4l2_g_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);
-	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);
-
-	if (pfmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
-		return -EINVAL;
-
-	rc = msm_server_get_fmt(pcam, pcam_inst->my_index, pfmt);
-	D("%s: current_fmt->fourcc: 0x%08x, rc = %d\n", __func__,
-				pfmt->fmt.pix.pixelformat, rc);
-	return rc;
-}
-
-static int msm_camera_v4l2_g_fmt_cap_mplane(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);
-	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);
-
-	if (pfmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
-		return -EINVAL;
-
-	rc = msm_server_get_fmt_mplane(pcam, pcam_inst->my_index, pfmt);
-	D("%s: current_fmt->fourcc: 0x%08x, rc = %d\n", __func__,
-					pfmt->fmt.pix_mp.pixelformat, rc);
-	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;
-}
-
-static int msm_camera_v4l2_try_fmt_cap_mplane(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_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_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);
-
-	mutex_lock(&pcam->vid_lock);
-
-	rc = msm_server_set_fmt(pcam, pcam_inst->my_index, pfmt);
-	if (rc < 0) {
-		pr_err("%s: msm_server_set_fmt Error: %d\n",
-				__func__, rc);
-	}
-	mutex_unlock(&pcam->vid_lock);
-
-	return rc;
-}
-
-static int msm_camera_v4l2_s_fmt_cap_mplane(struct file *f, void *pctx,
-				struct v4l2_format *pfmt)
-{
-	int rc;
-	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);
-
-	D("%s Inst %p\n", __func__, pcam_inst);
-	WARN_ON(pctx != f->private_data);
-
-	mutex_lock(&pcam->vid_lock);
-	rc = msm_server_set_fmt_mplane(pcam, pcam_inst->my_index, pfmt);
-	mutex_unlock(&pcam->vid_lock);
-
-	return rc;
-}
-static int msm_camera_v4l2_g_jpegcomp(struct file *f, void *pctx,
-				struct v4l2_jpegcompression *pcomp)
-{
-	int rc = -EINVAL;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	return rc;
-}
-
-static int msm_camera_v4l2_s_jpegcomp(struct file *f, void *pctx,
-				struct v4l2_jpegcompression *pcomp)
-{
-	int rc = -EINVAL;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	return rc;
-}
-
-
-static int msm_camera_v4l2_g_crop(struct file *f, void *pctx,
-					struct v4l2_crop *crop)
-{
-	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);
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	mutex_lock(&pcam->vid_lock);
-	rc = msm_server_get_crop(pcam, pcam_inst->my_index, crop);
-	mutex_unlock(&pcam->vid_lock);
-	return rc;
-}
-
-static int msm_camera_v4l2_s_crop(struct file *f, void *pctx,
-					struct v4l2_crop *a)
-{
-	int rc = -EINVAL;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	return rc;
-}
-
-/* Stream type-dependent parameter ioctls */
-static int msm_camera_v4l2_g_parm(struct file *f, void *pctx,
-				struct v4l2_streamparm *a)
-{
-	int rc = -EINVAL;
-	return rc;
-}
-static int msm_vidbuf_get_path(u32 extendedmode)
-{
-	switch (extendedmode) {
-	case MSM_V4L2_EXT_CAPTURE_MODE_THUMBNAIL:
-		return OUTPUT_TYPE_T;
-	case MSM_V4L2_EXT_CAPTURE_MODE_MAIN:
-		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_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:
-		return OUTPUT_TYPE_P;
-	}
-}
-
-static int msm_camera_v4l2_s_parm(struct file *f, void *pctx,
-				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->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__,
-		pcam_inst->path, rc);
-	return rc;
-}
-
-static int msm_camera_v4l2_subscribe_event(struct v4l2_fh *fh,
-			struct v4l2_event_subscription *sub)
-{
-	int rc = 0;
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	pcam_inst =
-		(struct msm_cam_v4l2_dev_inst *)container_of(fh,
-		struct msm_cam_v4l2_dev_inst, eventHandle);
-
-	D("%s:fh = 0x%x, type = 0x%x\n", __func__, (u32)fh, sub->type);
-	if (pcam_inst->my_index != 0)
-		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, 30);
-	if (rc < 0)
-		D("%s: failed for evtType = 0x%x, rc = %d\n",
-						__func__, sub->type, rc);
-	return rc;
-}
-
-static int msm_camera_v4l2_unsubscribe_event(struct v4l2_fh *fh,
-			struct v4l2_event_subscription *sub)
-{
-	int rc = 0;
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	pcam_inst =
-		(struct msm_cam_v4l2_dev_inst *)container_of(fh,
-		struct msm_cam_v4l2_dev_inst, eventHandle);
-
-	D("%s: fh = 0x%x\n", __func__, (u32)fh);
-	if (pcam_inst->my_index != 0)
-		return -EINVAL;
-
-	rc = v4l2_event_unsubscribe(fh, sub);
-	D("%s: rc = %d\n", __func__, rc);
-	return rc;
-}
-
-static long msm_camera_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;
-	struct msm_cam_v4l2_device *pcam  = video_drvdata(file);
-	D("%s: cmd %d\n", __func__, _IOC_NR(cmd));
-
-	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);
-			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;
-	}
-	default:
-		pr_err("%s Unsupported ioctl cmd %d ", __func__, cmd);
-		break;
-	}
-	return rc;
-}
-
-/* v4l2_ioctl_ops */
-static const struct v4l2_ioctl_ops g_msm_ioctl_ops = {
-	.vidioc_querycap = msm_camera_v4l2_querycap,
-
-	.vidioc_s_crop = msm_camera_v4l2_s_crop,
-	.vidioc_g_crop = msm_camera_v4l2_g_crop,
-
-	.vidioc_queryctrl = msm_camera_v4l2_queryctrl,
-	.vidioc_g_ctrl = msm_camera_v4l2_g_ctrl,
-	.vidioc_s_ctrl = msm_camera_v4l2_s_ctrl,
-
-	.vidioc_reqbufs = msm_camera_v4l2_reqbufs,
-	.vidioc_querybuf = msm_camera_v4l2_querybuf,
-	.vidioc_qbuf = msm_camera_v4l2_qbuf,
-	.vidioc_dqbuf = msm_camera_v4l2_dqbuf,
-
-	.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,
-	.vidioc_try_fmt_vid_cap_mplane = msm_camera_v4l2_try_fmt_cap_mplane,
-	.vidioc_g_fmt_vid_cap = msm_camera_v4l2_g_fmt_cap,
-	.vidioc_g_fmt_vid_cap_mplane = msm_camera_v4l2_g_fmt_cap_mplane,
-	.vidioc_s_fmt_vid_cap = msm_camera_v4l2_s_fmt_cap,
-	.vidioc_s_fmt_vid_cap_mplane = msm_camera_v4l2_s_fmt_cap_mplane,
-
-	.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_open(struct file *f)
-{
-	int i, 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;
-
-	D("%s\n", __func__);
-
-	if (!pcam) {
-		pr_err("%s NULL pointer passed in!\n", __func__);
-		return rc;
-	}
-	if (!msm_server_get_usecount()) {
-		pr_err("%s: error, daemon not yet started.", __func__);
-		return -EINVAL;
-	}
-	mutex_lock(&pcam->vid_lock);
-	for (i = 0; i < MSM_DEV_INST_MAX; i++) {
-		if (pcam->dev_inst[i] == NULL)
-			break;
-	}
-
-	/* if no instance is available, return error */
-	if (i == MSM_DEV_INST_MAX) {
-		mutex_unlock(&pcam->vid_lock);
-		return rc;
-	}
-	pcam_inst = kzalloc(sizeof(struct msm_cam_v4l2_dev_inst), GFP_KERNEL);
-	if (!pcam_inst) {
-		mutex_unlock(&pcam->vid_lock);
-		return rc;
-	}
-	mutex_init(&pcam_inst->inst_lock);
-	pcam_inst->sensor_pxlcode = pcam->usr_fmts[0].pxlcode;
-	pcam_inst->my_index = i;
-	pcam_inst->pcam = pcam;
-	pcam->dev_inst[i] = pcam_inst;
-
-	D("%s index %d nodeid %d count %d\n", __func__,
-			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);
-	if (pcam->use_count == 1) {
-		server_q_idx = msm_find_free_queue();
-		if (server_q_idx < 0)
-			return server_q_idx;
-		rc = msm_server_begin_session(pcam, server_q_idx);
-		if (rc < 0) {
-			pr_err("%s error starting server session ", __func__);
-			goto msm_cam_server_begin_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_begin_session_failed;
-		}
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-		pmctl->client = msm_ion_client_create(-1, "camera");
-		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,
-			pcam->pvdev);
-		mutex_init(&pcam->event_lock);
-		msm_queue_init(&pcam->eventData_q, "eventData");
-	}
-	pcam_inst->vbqueue_initialized = 0;
-	rc = 0;
-
-	f->private_data = &pcam_inst->eventHandle;
-
-	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) {
-			pr_err("%s: msm_send_open_server failed %d\n",
-				__func__, rc);
-			goto msm_send_open_server_failed;
-		}
-	}
-	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);
-mctl_open_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_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) {
-		pcam->dev_inst[i] = NULL;
-		pcam->use_count = 0;
-	}
-	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;
-}
-
-static int msm_addr_remap(struct msm_cam_v4l2_dev_inst *pcam_inst,
-				struct vm_area_struct *vma)
-{
-	int phyaddr;
-	int retval;
-	unsigned long size;
-	int rc = 0;
-	struct msm_cam_media_controller *mctl;
-
-	mctl = msm_cam_server_get_mctl(pcam_inst->pcam->mctl_handle);
-	if (!mctl) {
-		pr_err("%s: invalid mctl pointer", __func__);
-		return -EFAULT;
-	}
-
-	rc = msm_pmem_region_get_phy_addr(&mctl->stats_info.pmem_stats_list,
-			&pcam_inst->mem_map,
-			&phyaddr);
-	if (rc) {
-		pr_err("%s: cannot map vaddr", __func__);
-		return -EFAULT;
-	}
-	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:mmap: remap failed with error %d. ",
-			   __func__, retval);
-		memset(&pcam_inst->mem_map, 0, sizeof(pcam_inst->mem_map));
-		return -ENOMEM;
-	}
-	D("%s:mmap: phy_addr=0x%x: %08lx-%08lx, pgoff %08lx\n",
-		   __func__, (uint32_t)phyaddr,
-		   vma->vm_start, vma->vm_end, vma->vm_pgoff);
-	memset(&pcam_inst->mem_map, 0, sizeof(pcam_inst->mem_map));
-	return 0;
-}
-
-static int msm_mmap(struct file *f, struct vm_area_struct *vma)
-{
-	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("mmap called, vma=0x%08lx\n", (unsigned long)vma);
-
-	if (pcam_inst->is_mem_map_inst &&
-		pcam_inst->mem_map.cookie) {
-		rc = msm_addr_remap(pcam_inst, vma);
-		D("%s: msm_addr_remap ret=%d\n", __func__, rc);
-		return rc;
-	} else
-		rc = vb2_mmap(&pcam_inst->vid_bufq, vma);
-	D("vma start=0x%08lx, size=%ld, ret=%d\n",
-		(unsigned long)vma->vm_start,
-		(unsigned long)vma->vm_end - (unsigned long)vma->vm_start,
-		rc);
-
-	return rc;
-}
-
-void msm_release_ion_client(struct kref *ref)
-{
-	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);
-}
-
-static int msm_close(struct file *f)
-{
-	int rc = 0;
-	struct msm_cam_v4l2_device *pcam;
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	struct msm_cam_media_controller *pmctl;
-	pcam_inst = container_of(f->private_data,
-		struct msm_cam_v4l2_dev_inst, eventHandle);
-	pcam = pcam_inst->pcam;
-	if (!pcam) {
-		pr_err("%s NULL pointer of camera device!\n", __func__);
-		return -EINVAL;
-	}
-
-	pmctl = msm_cam_server_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*/
-	}
-
-	pcam_inst->streamon = 0;
-	pcam->use_count--;
-	pcam->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);
-	D("%s index %d nodeid %d count %d\n", __func__, pcam_inst->my_index,
-		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);
-	}
-
-	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) {
-			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);
-
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-		kref_put(&pmctl->refcount, msm_release_ion_client);
-#endif
-		rc = msm_server_end_session(pcam);
-		if (rc < 0)
-			pr_err("msm_server_end_session fails %d\n", rc);
-	}
-	mutex_unlock(&pcam->vid_lock);
-	return rc;
-}
-
-static unsigned int msm_poll(struct file *f, struct poll_table_struct *wait)
-{
-	int rc = 0;
-	struct msm_cam_v4l2_device *pcam;
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	pcam_inst = container_of(f->private_data,
-		struct msm_cam_v4l2_dev_inst, eventHandle);
-	pcam = pcam_inst->pcam;
-	D("%s\n", __func__);
-	if (!pcam) {
-		pr_err("%s NULL pointer of camera device!\n", __func__);
-		return -EINVAL;
-	}
-	if (pcam_inst->my_index == 0) {
-		poll_wait(f, &(pcam_inst->eventHandle.wait), wait);
-		if (v4l2_event_pending(&pcam_inst->eventHandle))
-			rc |= POLLPRI;
-	} else {
-		if (!pcam_inst->vid_bufq.streaming) {
-			D("%s vid_bufq.streaming is off, inst=0x%x\n",
-			__func__, (u32)pcam_inst);
-			return -EINVAL;
-		}
-		rc |= vb2_poll(&pcam_inst->vid_bufq, f, wait);
-	}
-	D("%s returns, rc  = 0x%x\n", __func__, rc);
-	return rc;
-}
-
-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))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	v4l2_ev = evt_payload.evt;
-	v4l2_ev.id = 0;
-	pcam = mctl->pcam_ptr;
-	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:
-	return rc;
-}
-
-
-static struct v4l2_file_operations g_msm_fops = {
-	.owner   = THIS_MODULE,
-	.open	= msm_open,
-	.poll	= msm_poll,
-	.mmap	= msm_mmap,
-	.release = msm_close,
-	.ioctl   = video_ioctl2,
-};
-
-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;
-	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;
-	}
-
-	rc = v4l2_device_register(pcam->v4l2_dev.dev, &pcam->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;
-	}
-
-	strlcpy(pcam->media_dev.model, QCAMERA_NAME,
-			sizeof(pcam->media_dev.model));
-	rc = media_device_register(&pcam->media_dev);
-	pvdev->v4l2_dev = &pcam->v4l2_dev;
-	pcam->v4l2_dev.mdev = &pcam->media_dev;
-
-	/* 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->ioctl_ops = &g_msm_ioctl_ops;
-	pvdev->minor	 = -1;
-	pvdev->vfl_type  = VFL_TYPE_GRABBER;
-
-	media_entity_init(&pvdev->entity, 0, NULL, 0);
-	pvdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L;
-	pvdev->entity.group_id = QCAMERA_VNODE_GROUP_ID;
-
-	/* register v4l2 video device to kernel as /dev/videoXX */
-	D("video_register_device\n");
-	rc = video_register_device(pvdev,
-					VFL_TYPE_GRABBER,
-					msm_camera_v4l2_nr);
-	if (rc) {
-		pr_err("%s: video_register_device failed\n", __func__);
-		goto reg_fail;
-	}
-	pvdev->entity.name = video_device_node_name(pvdev);
-	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;
-
-reg_fail:
-	video_device_release(pvdev);
-	v4l2_device_unregister(&pcam->v4l2_dev);
-	pcam->v4l2_dev.dev = NULL;
-	return rc;
-}
-
-static struct v4l2_subdev *msm_actuator_probe(
-	struct msm_actuator_info *actuator_info)
-{
-	struct v4l2_subdev *act_sdev;
-	struct i2c_adapter *adapter = NULL;
-	struct msm_actuator_ctrl_t *actrl;
-	void *act_client = NULL;
-
-	D("%s called\n", __func__);
-
-	if (!actuator_info || !actuator_info->board_info)
-		goto probe_fail;
-
-	adapter = i2c_get_adapter(actuator_info->bus_id);
-	if (!adapter)
-		goto probe_fail;
-
-	act_client = i2c_new_device(adapter, actuator_info->board_info);
-	if (!act_client)
-		goto device_fail;
-
-	act_sdev = (struct v4l2_subdev *)i2c_get_clientdata(act_client);
-	if (act_sdev == NULL)
-		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;
-		}
-	}
-
-	i2c_put_adapter(adapter);
-	return act_sdev;
-
-client_fail:
-	i2c_unregister_device(act_client);
-device_fail:
-	i2c_put_adapter(adapter);
-	adapter = NULL;
-probe_fail:
-	return NULL;
-}
-
-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;
-
-	i2c_put_adapter(adapter);
-	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;
-}
-
-static struct v4l2_subdev *msm_flash_probe(
-	struct msm_camera_sensor_flash_data *flash_info)
-{
-	struct v4l2_subdev *flash_sdev = NULL;
-	struct i2c_adapter *adapter = NULL;
-	void *flash_client = NULL;
-
-	D("%s called\n", __func__);
-
-	if (!flash_info || !flash_info->board_info)
-		goto probe_fail;
-
-	adapter = i2c_get_adapter(flash_info->bus_id);
-	if (!adapter)
-		goto probe_fail;
-
-	flash_client = i2c_new_device(adapter, flash_info->board_info);
-	if (!flash_client)
-		goto device_fail;
-
-	flash_sdev = (struct v4l2_subdev *)i2c_get_clientdata(flash_client);
-	if (flash_sdev == NULL)
-		goto client_fail;
-
-	i2c_put_adapter(adapter);
-	return flash_sdev;
-
-client_fail:
-	pr_err("%s client_fail\n", __func__);
-	i2c_unregister_device(flash_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;
-
-	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",
-			__func__);
-		return -ENOMEM;
-	}
-
-	pcam->sensor_sdev = sensor_sd;
-	s_ctrl = get_sctrl(sensor_sd);
-	sdata = (struct msm_camera_sensor_info *) s_ctrl->sensordata;
-
-	pcam->act_sdev = msm_actuator_probe(sdata->actuator_info);
-	pcam->eeprom_sdev = msm_eeprom_probe(sdata->eeprom_info);
-	pcam->flash_sdev = msm_flash_probe(sdata->flash_data);
-
-	D("%s: pcam =0x%p\n", __func__, pcam);
-
-	pcam->sdata = sdata;
-
-	/* init the user count and lock*/
-	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;
-
-	rc  = msm_cam_dev_init(pcam);
-	if (rc < 0)
-		goto failure;
-
-	rc = msm_setup_mctl_node(pcam);
-	if (rc < 0) {
-		pr_err("%s:failed to create mctl device: %d\n",
-			 __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);
-	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 (rc < 0) {
-			D("%s actuator sub device register failed\n",
-			  __func__);
-			goto failure;
-		}
-	}
-
-	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;
-		}
-	}
-
-	if (pcam->flash_sdev) {
-		rc = v4l2_device_register_subdev(&pcam->v4l2_dev,
-			pcam->flash_sdev);
-		if (rc < 0) {
-			D("%s flash sub device register failed\n", __func__);
-			goto failure;
-		}
-	}
-
-	pcam->vnode_id = vnode_count++;
-	return rc;
-
-failure:
-	kzfree(pcam);
-	return rc;
-}
-EXPORT_SYMBOL(msm_sensor_register);
-
diff --git a/drivers/media/platform/msm/camera_v1/msm.h b/drivers/media/platform/msm/camera_v1/msm.h
deleted file mode 100644
index 1198f17..0000000
--- a/drivers/media/platform/msm/camera_v1/msm.h
+++ /dev/null
@@ -1,746 +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_H
-#define _MSM_H
-
-#ifdef __KERNEL__
-
-/* Header files */
-#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>
-#include <media/v4l2-fh.h>
-#include <media/v4l2-event.h>
-#include <media/v4l2-mediabus.h>
-#include <media/videobuf2-dma-contig.h>
-#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>
-
-#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", \
-				__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"
-#define MSM_ISPIF_DRV_NAME "msm_ispif"
-#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_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
-#define MAX_NUM_FLASH_DEV 4
-
-/* msm queue management APIs*/
-
-#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);  \
-		list_del_init(&qcmd->member);	 \
-	}			 \
-	spin_unlock_irqrestore(&__q->lock, flags);  \
-	qcmd;			 \
-})
-
-#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)) {	 \
-		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);	\
-} while (0)
-
-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);
-}
-
-struct isp_msg_stats {
-	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;
-};
-
-struct isp_msg_event {
-	uint32_t msg_id;
-	uint32_t sof_count;
-};
-
-struct isp_msg_output {
-	uint8_t   output_id;
-	struct msm_free_buf buf;
-	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_VFE_IRQ,
-	NOTIFY_AXI_IRQ,
-	NOTIFY_GESTURE_EVT, /* arg = v4l2_event */
-	NOTIFY_GESTURE_CAM_EVT, /* arg = int */
-	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
-};
-
-struct msm_cam_v4l2_device;
-struct msm_cam_v4l2_dev_inst;
-#define MSM_MAX_IMG_MODE                MSM_V4L2_EXT_CAPTURE_MODE_MAX
-
-enum msm_buffer_state {
-	MSM_BUFFER_STATE_UNUSED,
-	MSM_BUFFER_STATE_INITIALIZED,
-	MSM_BUFFER_STATE_PREPARED,
-	MSM_BUFFER_STATE_QUEUED,
-	MSM_BUFFER_STATE_RESERVED,
-	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;
-	enum msm_buffer_state state;
-	int active;
-};
-
-struct msm_isp_color_fmt {
-	char *name;
-	int depth;
-	int bitsperpxl;
-	u32 fourcc;
-	enum v4l2_mbus_pixelcode pxlcode;
-	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_mctl_pp_frame_cmd pp_frame_cmd;
-	struct msm_cam_media_controller *p_mctl;
-};
-
-struct msm_mctl_pp_ctrl {
-	int pp_msg_type;
-	struct msm_mctl_pp_frame_info *pp_frame_info;
-
-};
-struct msm_mctl_pp_info {
-	spinlock_t lock;
-	uint32_t cnt;
-	uint32_t pp_key;
-	uint32_t cur_frame_id[MSM_MAX_IMG_MODE];
-	struct msm_free_buf div_frame[MSM_MAX_IMG_MODE];
-	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 {
-
-	int (*mctl_open)(struct msm_cam_media_controller *p_mctl,
-					 const char *const apps_id);
-	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_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);
-
-	/* 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 *flash_sdev;/*flash sub device*/
-
-	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*/
-	struct mutex lock;
-	struct wake_lock wake_lock; /*avoid low power mode when active*/
-	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 ion_client *client;
-	struct kref refcount;
-
-	/*pcam ptr*/
-	struct msm_cam_v4l2_device *pcam_ptr;
-
-	/*sensor info*/
-	struct msm_camera_sensor_info *sdata;
-
-	/*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;
-};
-
-struct msm_isp_buf_info {
-	int type;
-	unsigned long buffer;
-	int fd;
-};
-struct msm_cam_buf_offset {
-	uint32_t addr_offset;
-	uint32_t data_offset;
-};
-
-#define MSM_DEV_INST_MAX                    24
-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 path;
-	int buf_count;
-	/* buffer offsets, if any */
-	struct msm_cam_buf_offset **buf_offset;
-	struct v4l2_crop crop;
-	int streamon;
-	struct msm_mem_map_info mem_map;
-	int is_mem_map_inst;
-	struct img_plane_info plane_info;
-	int vbqueue_initialized;
-	struct mutex inst_lock;
-	uint32_t inst_handle;
-};
-
-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];
-	struct msm_cam_v4l2_dev_inst *dev_inst_map[MSM_MAX_IMG_MODE];
-	struct mutex dev_lock;
-	int active;
-	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*/
-
-	/* 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 *flash_sdev; /* flash sub device */
-	struct msm_camera_sensor_info *sdata;
-
-	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;
-	struct msm_device_queue eventData_q;
-	uint8_t *ctrl_data;
-	uint32_t evt_id;
-};
-
-struct msm_cam_server_mctl_inst {
-	struct msm_cam_media_controller mctl;
-	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*/
-	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 *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;
-	struct v4l2_subdev *flash_device[MAX_NUM_FLASH_DEV];
-
-	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;
-};
-
-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_sensor_register(struct v4l2_subdev *);
-int msm_isp_init_module(int g_num_config_nodes);
-
-int msm_mctl_init(struct msm_cam_v4l2_device *pcam);
-int msm_mctl_free(struct msm_cam_v4l2_device *pcam);
-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 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 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);
-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*/
-int msm_register_pmem(struct hlist_head *ptype, void __user *arg,
-	struct ion_client *client, int domain_num);
-int msm_pmem_table_del(struct hlist_head *ptype, void __user *arg,
-	struct ion_client *client, int domain_num);
-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);
-unsigned long msm_pmem_stats_vtop_lookup(
-	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);
-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_gemini_subdev_init(struct v4l2_subdev *gemini_sd);
-void msm_vpe_subdev_release(struct v4l2_subdev *sd);
-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 msm_mctl_pp_ioctl(struct msm_cam_media_controller *p_mctl,
-	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);
-int msm_mctl_img_mode_to_inst_index(struct msm_cam_media_controller *pmctl,
-	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);
-void msm_mctl_gettimeofday(struct timeval *tv);
-int msm_mctl_check_pp(struct msm_cam_media_controller *p_mctl,
-	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,
-	uint32_t frame_id, int pp_type);
-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,
-	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_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);
-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 msm_mctl_pp_mctl_divert_done(struct msm_cam_media_controller *p_mctl,
-	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,
-	uint8_t csiphy_core_index, uint8_t csid_core_index);
-int msm_mctl_find_flash_subdev(struct msm_cam_media_controller *p_mctl,
-	uint8_t index);
-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 */
diff --git a/drivers/media/platform/msm/camera_v1/msm_axi_qos.c b/drivers/media/platform/msm/camera_v1/msm_axi_qos.c
deleted file mode 100644
index ac484d3..0000000
--- a/drivers/media/platform/msm/camera_v1/msm_axi_qos.c
+++ /dev/null
@@ -1,50 +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/clk.h>
-#include <mach/camera.h>
-#define MSM_AXI_QOS_NAME "msm_camera"
-
-static struct clk *ebi1_clk;
-
-int add_axi_qos(void)
-{
-	ebi1_clk = clk_get(NULL, "ebi1_vfe_clk");
-	if (IS_ERR(ebi1_clk))
-		ebi1_clk = NULL;
-	else {
-		clk_prepare(ebi1_clk);
-		clk_enable(ebi1_clk);
-	}
-
-	return 0;
-}
-
-int update_axi_qos(uint32_t rate)
-{
-	if (!ebi1_clk)
-		return 0;
-
-	return clk_set_rate(ebi1_clk, rate * 1000);
-}
-
-void release_axi_qos(void)
-{
-	if (!ebi1_clk)
-		return;
-
-	clk_disable(ebi1_clk);
-	clk_unprepare(ebi1_clk);
-	clk_put(ebi1_clk);
-	ebi1_clk = NULL;
-}
diff --git a/drivers/media/platform/msm/camera_v1/msm_camera.c b/drivers/media/platform/msm/camera_v1/msm_camera.c
deleted file mode 100644
index 213ccc7..0000000
--- a/drivers/media/platform/msm/camera_v1/msm_camera.c
+++ /dev/null
@@ -1,4052 +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/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);
-#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);
-#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);
-#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);
-#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);
-#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_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);
-#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);
-#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/platform/msm/camera_v1/msm_camirq_router.c b/drivers/media/platform/msm/camera_v1/msm_camirq_router.c
deleted file mode 100644
index 37dd6c2..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/msm_camirq_router.h b/drivers/media/platform/msm/camera_v1/msm_camirq_router.h
deleted file mode 100644
index 3ea3cec..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/msm_gesture.c b/drivers/media/platform/msm/camera_v1/msm_gesture.c
deleted file mode 100644
index 3ab041e..0000000
--- a/drivers/media/platform/msm/camera_v1/msm_gesture.c
+++ /dev/null
@@ -1,501 +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 <media/v4l2-subdev.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)
-#else
-#define D(fmt, args...) do {} while (0)
-#endif
-
-struct msm_gesture_ctrl {
-	int queue_id;
-	atomic_t active;
-	struct v4l2_ctrl_handler ctrl_handler;
-	int num_ctrls;
-	struct v4l2_fh *p_eventHandle;
-	struct v4l2_subdev *sd;
-	struct msm_ges_evt event;
-	int camera_opened;
-};
-
-static struct msm_gesture_ctrl g_gesture_ctrl;
-
-int msm_gesture_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
-	struct v4l2_event_subscription *sub)
-{
-	D("%s\n", __func__);
-	if (sub->type == V4L2_EVENT_ALL)
-		sub->type = MSM_GES_APP_NOTIFY_EVENT;
-	return v4l2_event_subscribe(fh, sub, 30);
-}
-
-static int msm_gesture_send_ctrl(struct msm_gesture_ctrl *p_gesture_ctrl,
-	int type, void *value, int length, uint32_t timeout)
-{
-	int rc = 0;
-	struct msm_ctrl_cmd ctrlcmd;
-	D("%s qid %d\n", __func__, p_gesture_ctrl->queue_id);
-	ctrlcmd.type = type;
-	ctrlcmd.timeout_ms = timeout;
-	ctrlcmd.length = length;
-	ctrlcmd.value = value;
-	ctrlcmd.vnode_id = 0;
-	ctrlcmd.queue_idx = p_gesture_ctrl->queue_id;
-	ctrlcmd.config_ident = 0;
-
-	rc = msm_server_send_ctrl(&ctrlcmd, MSM_GES_RESP_V4L2);
-	return rc;
-}
-
-static int msm_gesture_proc_ctrl_cmd(struct msm_gesture_ctrl *p_gesture_ctrl,
-	struct v4l2_control *ctrl)
-{
-	int rc = 0;
-	struct msm_ctrl_cmd *tmp_cmd = NULL;
-	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;
-
-	/* 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);
-	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);
-	return rc;
-}
-
-static int msm_gesture_s_ctrl(struct v4l2_subdev *sd,
-	struct v4l2_control *ctrl)
-{
-	int rc = 0;
-	struct msm_gesture_ctrl *p_gesture_ctrl = &g_gesture_ctrl;
-	D("%s ctrl->id %d\n", __func__, ctrl->id);
-	rc = msm_gesture_proc_ctrl_cmd(p_gesture_ctrl, ctrl);
-	if (rc != 0) {
-		pr_err("%s set ctrl failed %d\n", __func__, rc);
-		return -EINVAL;
-	}
-	return rc;
-}
-
-static int msm_gesture_s_ctrl_ops(struct v4l2_ctrl *ctrl)
-{
-	int rc = 0;
-	struct v4l2_control control;
-	struct msm_gesture_ctrl *p_gesture_ctrl = &g_gesture_ctrl;
-	control.id = ctrl->id;
-	control.value = ctrl->val;
-	D("%s ctrl->id 0x%x\n", __func__, ctrl->id);
-	rc = msm_gesture_proc_ctrl_cmd(p_gesture_ctrl, &control);
-	if (rc != 0) {
-		pr_err("%s proc ctrl failed %d\n", __func__, rc);
-		return -EINVAL;
-	}
-	return rc;
-}
-
-static int msm_gesture_s_ctrl_ext(struct v4l2_subdev *sd,
-	struct v4l2_ext_controls *ctrls)
-{
-	int rc = 0;
-	struct v4l2_control control;
-	struct msm_gesture_ctrl *p_gesture_ctrl = &g_gesture_ctrl;
-	if ((ctrls->count < 1) || (NULL == ctrls->controls)) {
-		pr_err("%s invalid ctrl failed\n", __func__);
-		return -EINVAL;
-	}
-	control.id = ctrls->controls->id;
-	control.value = ctrls->controls->value;
-	D("%s ctrl->id %d\n", __func__, control.id);
-	rc = msm_gesture_proc_ctrl_cmd(p_gesture_ctrl, &control);
-	if (rc != 0) {
-		pr_err("%s proc ctrl failed %d\n", __func__, rc);
-		return -EINVAL;
-	}
-	return rc;
-}
-
-static int msm_gesture_handle_event(struct v4l2_subdev *sd,
-	struct msm_gesture_ctrl *p_gesture_ctrl, void* arg)
-{
-	int rc = 0;
-	struct v4l2_event *evt = (struct v4l2_event *)arg;
-	struct msm_ges_evt *p_ges_evt = NULL;
-	D("%s: Received gesture evt 0x%x ", __func__, evt->type);
-	p_gesture_ctrl->event.evt_len = 0;
-	p_gesture_ctrl->event.evt_data = NULL;
-
-	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 (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;
-			} 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);
-	}
-	D("%s: exit rc %d ", __func__, rc);
-	return rc;
-}
-
-static int msm_gesture_get_evt_payload(struct v4l2_subdev *sd,
-	struct msm_gesture_ctrl *p_gesture_ctrl, void* arg)
-{
-	int rc = 0;
-	struct msm_ges_evt *p_ges_evt = (struct msm_ges_evt *)arg;
-	D("%s: enter ", __func__);
-	if (NULL != p_gesture_ctrl->event.evt_data) {
-		D("%s: event data %p len %d", __func__,
-			p_gesture_ctrl->event.evt_data,
-			p_gesture_ctrl->event.evt_len);
-
-		if (copy_to_user((void __user *)p_ges_evt->evt_data,
-			p_gesture_ctrl->event.evt_data,
-			p_gesture_ctrl->event.evt_len)) {
-			pr_err("%s: copy_to_user failed.\n", __func__);
-			rc = -EFAULT;
-		} else {
-			D("%s: copied the event", __func__);
-			p_ges_evt->evt_len = p_gesture_ctrl->event.evt_len;
-		}
-	}
-	D("%s: exit rc %d ", __func__, rc);
-	return rc;
-}
-
-static int msm_gesture_handle_cam_event(struct v4l2_subdev *sd,
-	struct msm_gesture_ctrl *p_gesture_ctrl, int cam_evt)
-{
-	int rc = 0;
-	D("%s: cam_evt %d ", __func__, cam_evt);
-
-	if ((cam_evt != MSM_V4L2_GES_CAM_OPEN)
-		&& (cam_evt != MSM_V4L2_GES_CAM_CLOSE)) {
-		pr_err("%s: error invalid event %d ", __func__, cam_evt);
-		return -EINVAL;
-	}
-
-	p_gesture_ctrl->camera_opened =
-		(cam_evt == MSM_V4L2_GES_CAM_OPEN);
-
-	if (atomic_read(&p_gesture_ctrl->active) == 0) {
-		D("%s gesture not active\n", __func__);
-		return 0;
-	}
-
-	rc = msm_gesture_send_ctrl(p_gesture_ctrl, cam_evt, NULL,
-		0, 2000);
-	if (rc != 0) {
-		pr_err("%s gesture ctrl failed %d\n", __func__, rc);
-		rc = -EINVAL;
-	}
-	D("%s exit rc %d\n", __func__, rc);
-	return rc;
-}
-
-long msm_gesture_ioctl(struct v4l2_subdev *sd,
-	 unsigned int cmd, void *arg)
-{
-	int rc = 0;
-	struct msm_gesture_ctrl *p_gesture_ctrl = &g_gesture_ctrl;
-	D("%s\n", __func__);
-	switch (cmd) {
-	case MSM_GES_IOCTL_CTRL_COMMAND: {
-		struct v4l2_control *ctrl = (struct v4l2_control *)arg;
-		D("%s MSM_GES_IOCTL_CTRL_COMMAND arg %p size %d\n", __func__,
-			arg, sizeof(ctrl));
-		rc = msm_gesture_s_ctrl(sd, ctrl);
-		break;
-	}
-	case VIDIOC_MSM_GESTURE_EVT: {
-		rc = msm_gesture_handle_event(sd, p_gesture_ctrl, arg);
-		break;
-	}
-	case VIDIOC_MSM_GESTURE_CAM_EVT: {
-		int cam_evt = *((int *)arg);
-		rc = msm_gesture_handle_cam_event(sd, p_gesture_ctrl, cam_evt);
-		break;
-	}
-	case MSM_GES_GET_EVT_PAYLOAD: {
-		rc = msm_gesture_get_evt_payload(sd, p_gesture_ctrl, arg);
-		break;
-	}
-	default:
-		pr_err("%s: Invalid ioctl %d", __func__, cmd);
-		break;
-	}
-	D("%s exit rc %d\n", __func__, rc);
-	return rc;
-}
-
-static const struct v4l2_ctrl_ops msm_gesture_ctrl_ops = {
-	.s_ctrl = msm_gesture_s_ctrl_ops,
-};
-
-static const struct v4l2_ctrl_config msm_gesture_ctrl_filter = {
-	.ops = &msm_gesture_ctrl_ops,
-	.id = MSM_GESTURE_CID_CTRL_CMD,
-	.name = "Gesture ctrl",
-	.type = V4L2_CTRL_TYPE_INTEGER,
-	.flags = V4L2_CTRL_FLAG_SLIDER,
-	.max = 0x7fffffff,
-	.step = 1,
-	.min = 0x80000000,
-};
-
-static int msm_gesture_init_ctrl(struct v4l2_subdev *sd,
-	struct msm_gesture_ctrl *p_gesture_ctrl)
-{
-	int rc = 0;
-	p_gesture_ctrl->num_ctrls = 1;
-	p_gesture_ctrl->ctrl_handler.error = 0;
-	v4l2_ctrl_handler_init(&p_gesture_ctrl->ctrl_handler,
-		p_gesture_ctrl->num_ctrls);
-	v4l2_ctrl_new_custom(&p_gesture_ctrl->ctrl_handler,
-		&msm_gesture_ctrl_filter, p_gesture_ctrl);
-	if (p_gesture_ctrl->ctrl_handler.error) {
-		int err = p_gesture_ctrl->ctrl_handler.error;
-		D("%s: error adding control %d", __func__, err);
-		p_gesture_ctrl->ctrl_handler.error = 0;
-	}
-	sd->ctrl_handler = &p_gesture_ctrl->ctrl_handler;
-	return rc;
-}
-
-static int msm_gesture_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
-{
-	int rc = 0, rc_err = 0;
-	struct msm_gesture_ctrl *p_gesture_ctrl = &g_gesture_ctrl;
-	D("%s\n", __func__);
-	if (atomic_read(&p_gesture_ctrl->active) != 0) {
-		pr_err("%s already opened\n", __func__);
-		return -EINVAL;
-	}
-	memset(&p_gesture_ctrl->event, 0x0, sizeof(struct msm_ges_evt));
-	rc = msm_server_open_client(&p_gesture_ctrl->queue_id);
-	if (rc != 0) {
-		pr_err("%s open failed %d\n", __func__, rc);
-		rc = -EINVAL;
-		goto err;
-	}
-
-	rc = msm_gesture_init_ctrl(sd, p_gesture_ctrl);
-	if (rc != 0) {
-		pr_err("%s init ctrl failed %d\n", __func__, rc);
-		rc = -EINVAL;
-		goto err;
-	}
-
-	rc = msm_gesture_send_ctrl(p_gesture_ctrl, MSM_V4L2_GES_OPEN, NULL,
-		0, 10000);
-	if (rc != 0) {
-		pr_err("%s gesture ctrl failed %d\n", __func__, rc);
-		rc = -EINVAL;
-		goto err;
-	}
-
-	atomic_inc(&p_gesture_ctrl->active);
-
-	return rc;
-
-err:
-	rc_err = msm_server_close_client(p_gesture_ctrl->queue_id);
-	if (rc_err != 0)
-		pr_err("%s failed %d\n", __func__, rc);
-	return rc;
-}
-
-static int msm_gesture_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
-{
-	int rc = 0;
-	struct msm_gesture_ctrl *p_gesture_ctrl = &g_gesture_ctrl;
-	D("%s\n", __func__);
-	if (atomic_read(&p_gesture_ctrl->active) == 0) {
-		pr_err("%s already closed\n", __func__);
-		return -EINVAL;
-	}
-
-	rc = msm_gesture_send_ctrl(p_gesture_ctrl, MSM_V4L2_GES_CLOSE, NULL,
-		0, 10000);
-	if (rc != 0)
-		pr_err("%s gesture ctrl failed %d\n", __func__, rc);
-
-	rc = msm_server_close_client(p_gesture_ctrl->queue_id);
-	if (rc != 0)
-		pr_err("%s failed %d\n", __func__, rc);
-
-	v4l2_ctrl_handler_free(&p_gesture_ctrl->ctrl_handler);
-	kfree(p_gesture_ctrl->event.evt_data);
-
-	atomic_dec(&p_gesture_ctrl->active);
-	g_gesture_ctrl.queue_id = -1;
-	return 0;
-}
-
-static struct v4l2_subdev_core_ops msm_gesture_core_ops = {
-	.s_ctrl = msm_gesture_s_ctrl,
-	.s_ext_ctrls = msm_gesture_s_ctrl_ext,
-	.ioctl = msm_gesture_ioctl,
-	.subscribe_event = msm_gesture_subscribe_event,
-};
-
-static struct v4l2_subdev_video_ops msm_gesture_video_ops;
-
-static struct v4l2_subdev_ops msm_gesture_subdev_ops = {
-	.core = &msm_gesture_core_ops,
-	.video  = &msm_gesture_video_ops,
-};
-
-static const struct v4l2_subdev_internal_ops msm_gesture_internal_ops = {
-	.open = msm_gesture_open,
-	.close = msm_gesture_close,
-};
-
-static int msm_gesture_node_register(void)
-{
-	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__);
-		return -ENOMEM;
-	};
-
-	v4l2_subdev_init(gesture_subdev, &msm_gesture_subdev_ops);
-	gesture_subdev->internal_ops = &msm_gesture_internal_ops;
-	gesture_subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	snprintf(gesture_subdev->name,
-			 sizeof(gesture_subdev->name), "gesture");
-
-	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 */
-	gesture_subdev->flags |= V4L2_SUBDEV_FL_HAS_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);
-
-	gesture_subdev->entity.revision = gesture_subdev->devnode->num;
-
-	atomic_set(&p_gesture_ctrl->active, 0);
-	p_gesture_ctrl->queue_id = -1;
-	p_gesture_ctrl->event.evt_data = NULL;
-	p_gesture_ctrl->event.evt_len = 0;
-	return 0;
-}
-
-static int __init msm_gesture_init_module(void)
-{
-	return msm_gesture_node_register();
-}
-
-module_init(msm_gesture_init_module);
-MODULE_DESCRIPTION("MSM Gesture driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/platform/msm/camera_v1/msm_isp.c b/drivers/media/platform/msm/camera_v1/msm_isp.c
deleted file mode 100644
index 59290ec..0000000
--- a/drivers/media/platform/msm/camera_v1/msm_isp.c
+++ /dev/null
@@ -1,767 +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/export.h>
-#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 <media/msm_isp.h>
-#include <media/msm_gemini.h>
-
-#include "msm.h"
-
-#ifdef CONFIG_MSM_CAMERA_DEBUG
-#define D(fmt, args...) pr_debug("msm_isp: " fmt, ##args)
-#else
-#define D(fmt, args...) do {} while (0)
-#endif
-
-#define MSM_FRAME_AXI_MAX_BUF 32
-
-/*
- * This function executes in interrupt context.
- */
-
-void *msm_isp_sync_alloc(int size,
-	  gfp_t gfp)
-{
-	struct msm_queue_cmd *qcmd =
-		kmalloc(sizeof(struct msm_queue_cmd) + size, gfp);
-
-	if (qcmd) {
-		atomic_set(&qcmd->on_heap, 1);
-		return qcmd + 1;
-	}
-	return NULL;
-}
-
-void msm_isp_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 int msm_isp_notify_VFE_SOF_COUNT_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.value = NULL;
-	vfe_params.vfe_cfg = &cfgcmd;
-	vfe_params.data = arg;
-	rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params);
-	return 0;
-}
-
-int msm_isp_vfe_msg_to_img_mode(struct msm_cam_media_controller *pmctl,
-				int vfe_msg)
-{
-	int image_mode;
-	uint32_t vfe_output_mode = pmctl->vfe_output_mode;
-	vfe_output_mode &= ~(VFE_OUTPUTS_RDI0|VFE_OUTPUTS_RDI1);
-	if (vfe_msg == VFE_MSG_OUTPUT_PRIMARY) {
-		switch (vfe_output_mode) {
-		case VFE_OUTPUTS_MAIN_AND_PREVIEW:
-		case VFE_OUTPUTS_MAIN_AND_VIDEO:
-		case VFE_OUTPUTS_MAIN_AND_THUMB:
-		case VFE_OUTPUTS_RAW:
-		case VFE_OUTPUTS_JPEG_AND_THUMB:
-			image_mode = MSM_V4L2_EXT_CAPTURE_MODE_MAIN;
-			break;
-		case VFE_OUTPUTS_THUMB_AND_MAIN:
-			image_mode = MSM_V4L2_EXT_CAPTURE_MODE_THUMBNAIL;
-			break;
-		case VFE_OUTPUTS_VIDEO:
-		case VFE_OUTPUTS_VIDEO_AND_PREVIEW:
-			image_mode = MSM_V4L2_EXT_CAPTURE_MODE_VIDEO;
-			break;
-		case VFE_OUTPUTS_PREVIEW:
-		case VFE_OUTPUTS_PREVIEW_AND_VIDEO:
-			image_mode = MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW;
-			break;
-		default:
-			image_mode = -1;
-			break;
-		}
-	} else if (vfe_msg == VFE_MSG_OUTPUT_SECONDARY) {
-		switch (vfe_output_mode) {
-		case VFE_OUTPUTS_MAIN_AND_PREVIEW:
-		case VFE_OUTPUTS_VIDEO_AND_PREVIEW:
-			image_mode = MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW;
-			break;
-		case VFE_OUTPUTS_MAIN_AND_VIDEO:
-		case VFE_OUTPUTS_PREVIEW_AND_VIDEO:
-			image_mode = MSM_V4L2_EXT_CAPTURE_MODE_VIDEO;
-			break;
-		case VFE_OUTPUTS_MAIN_AND_THUMB:
-			image_mode = MSM_V4L2_EXT_CAPTURE_MODE_THUMBNAIL;
-			break;
-		case VFE_OUTPUTS_THUMB_AND_MAIN:
-			image_mode = MSM_V4L2_EXT_CAPTURE_MODE_MAIN;
-			break;
-		case VFE_OUTPUTS_JPEG_AND_THUMB:
-			image_mode = MSM_V4L2_EXT_CAPTURE_MODE_THUMBNAIL;
-			break;
-		case VFE_OUTPUTS_PREVIEW:
-		case VFE_OUTPUTS_VIDEO:
-			image_mode = MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW;
-			break;
-		default:
-			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_V2X_LIVESHOT_PRIMARY == vfe_msg) {
-			image_mode = MSM_V4L2_EXT_CAPTURE_MODE_V2X_LIVESHOT;
-	} else
-		image_mode = -1;
-
-	D("%s Selected image mode %d vfe output mode %d, vfe msg %d\n",
-	  __func__, image_mode, pmctl->vfe_output_mode, vfe_msg);
-	return image_mode;
-}
-
-static int msm_isp_notify_VFE_BUF_EVT(struct msm_cam_media_controller *pmctl,
-					struct v4l2_subdev *sd, void *arg)
-{
-	int rc = -EINVAL;
-	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_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;
-
-	if (!pcam) {
-		pr_err("%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);
-	}
-
-	switch (vdata->type) {
-	case VFE_MSG_START:
-	case VFE_MSG_START_RECORDING:
-	case VFE_MSG_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);
-		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);
-		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:
-		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);
-		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);
-		temp_free_buf = free_buf;
-		if (msm_mctl_reserve_free_buf(pmctl, NULL,
-					&buf_handle, &free_buf)) {
-			/* Write the same buffer into PONG */
-			free_buf = temp_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_JPEG_CAPTURE:
-		D("%s:VFE_MSG_JPEG_CAPTURE vdata->type %d\n", __func__,
-			vdata->type);
-		free_buf.num_planes = 2;
-		free_buf.ch_paddr[0] = pmctl->ping_imem_y;
-		free_buf.ch_paddr[1] = pmctl->ping_imem_cbcr;
-		cfgcmd.cmd_type = CMD_CONFIG_PING_ADDR;
-		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",
-			__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",
-			__func__, free_buf.ch_paddr[0], free_buf.ch_paddr[1]);
-		rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params);
-		break;
-	case VFE_MSG_OUTPUT_IRQ:
-		D("%s Got OUTPUT_IRQ: Getting free buf id = %d",
-						__func__, vfe_id);
-		msm_mctl_reserve_free_buf(pmctl, NULL,
-					&buf_handle, &free_buf);
-		cfgcmd.cmd_type = CMD_CONFIG_FREE_BUF_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;
-	default:
-		pr_err("%s: Invalid vdata type: %d\n", __func__, vdata->type);
-		break;
-	}
-	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)
-{
-	int rc = 0;
-	struct v4l2_event v4l2_evt;
-	struct msm_isp_event_ctrl *isp_event;
-	struct msm_free_buf buf;
-
-	if (!pmctl) {
-		pr_err("%s: no context in dsp callback.\n", __func__);
-		rc = -EINVAL;
-		return rc;
-	}
-
-	if (notification == NOTIFY_VFE_BUF_EVT)
-		return msm_isp_notify_VFE_BUF_EVT(pmctl, sd, arg);
-
-	if (notification == NOTIFY_VFE_PIX_SOF_COUNT)
-		return msm_isp_notify_VFE_SOF_COUNT_EVT(sd, arg);
-
-	isp_event = kzalloc(sizeof(struct msm_isp_event_ctrl), GFP_ATOMIC);
-	if (!isp_event) {
-		pr_err("%s Insufficient memory. return", __func__);
-		return -ENOMEM;
-	}
-
-	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;
-	isp_event->isp_data.isp_msg.type = MSM_CAMERA_MSG;
-	isp_event->isp_data.isp_msg.len = 0;
-
-	switch (notification) {
-	case NOTIFY_ISP_MSG_EVT: {
-		struct isp_msg_event *isp_msg = (struct isp_msg_event *)arg;
-
-		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));
-		break;
-	}
-	case NOTIFY_VFE_MSG_OUT: {
-		uint8_t msgid;
-		struct msm_cam_buf_handle buf_handle;
-		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;
-
-			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;
-		}
-		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);
-		}
-		break;
-	case NOTIFY_VFE_MSG_COMP_STATS: {
-		struct msm_stats_buf *stats = (struct msm_stats_buf *)arg;
-		struct msm_stats_buf *stats_buf = NULL;
-
-		isp_event->isp_data.isp_msg.msg_id = MSG_ID_STATS_COMPOSITE;
-		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) {
-			pr_err("%s: out of memory.\n", __func__);
-			rc = -ENOMEM;
-		} else {
-			*stats_buf = *stats;
-			isp_event->isp_data.isp_msg.len	=
-				sizeof(struct msm_stats_buf);
-			isp_event->isp_data.isp_msg.data = stats_buf;
-		}
-		}
-		break;
-	case NOTIFY_VFE_MSG_STATS: {
-		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;
-		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_BE:
-			stats.be.buff = stats.buffer;
-			stats.be.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;
-		case MSG_ID_STATS_AWB:
-			stats.awb.buff = stats.buffer;
-			stats.awb.fd = stats.fd;
-			break;
-		case MSG_ID_STATS_IHIST:
-			stats.ihist.buff = stats.buffer;
-			stats.ihist.fd = stats.fd;
-			break;
-		case MSG_ID_STATS_RS:
-			stats.rs.buff = stats.buffer;
-			stats.rs.fd = stats.fd;
-			break;
-		case MSG_ID_STATS_CS:
-			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:
-			pr_err("%s: Invalid msg type", __func__);
-			break;
-		}
-		if (!stats.buffer) {
-			pr_err("%s: msm_pmem_stats_ptov_lookup error\n",
-							__func__);
-			isp_event->isp_data.isp_msg.len = 0;
-			rc = -EFAULT;
-		} else {
-			struct msm_stats_buf *stats_buf =
-				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);
-				rc = -ENOMEM;
-			} else {
-				*stats_buf = stats;
-				isp_event->isp_data.isp_msg.len	=
-					sizeof(struct msm_stats_buf);
-				isp_event->isp_data.isp_msg.data = stats_buf;
-			}
-		}
-		}
-		break;
-	default:
-		pr_err("%s: Unsupport isp notification %d\n",
-			__func__, notification);
-		rc = -EINVAL;
-		break;
-	}
-
-	v4l2_event_queue(pmctl->config_device->config_stat_event_queue.pvdev,
-			 &v4l2_evt);
-
-	return rc;
-}
-
-int msm_isp_notify(struct msm_cam_media_controller *pmctl,
-	struct v4l2_subdev *sd,	unsigned int notification, void *arg)
-{
-	return msm_isp_notify_vfe(pmctl, sd, notification, arg);
-}
-EXPORT_SYMBOL(msm_isp_notify);
-
-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 axidata axi_data;
-
-	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 %d\n", __func__, cfgcmd.cmd_type);
-	switch (cfgcmd.cmd_type) {
-	case CMD_STATS_BG_ENABLE:
-	case CMD_STATS_BE_ENABLE:
-	case CMD_STATS_BF_ENABLE:
-	case CMD_STATS_BHIST_ENABLE:
-	case CMD_STATS_AF_ENABLE:
-	case CMD_STATS_AEC_ENABLE:
-	case CMD_STATS_AWB_ENABLE:
-	case CMD_STATS_AEC_AWB_ENABLE:
-	case CMD_STATS_IHIST_ENABLE:
-	case CMD_STATS_RS_ENABLE:
-	case CMD_STATS_CS_ENABLE:
-		return msm_isp_subdev_ioctl(sd, &cfgcmd, NULL);
-	case CMD_GENERAL:
-	case CMD_STATS_DISABLE:
-		return msm_isp_subdev_ioctl(sd, &cfgcmd,
-							&axi_data);
-	default:
-		pr_err("%s: unknown command type %d\n",
-			__func__, cfgcmd.cmd_type);
-	}
-
-	return -EINVAL;
-}
-
-static int msm_axi_config(struct v4l2_subdev *sd,
-		struct msm_cam_media_controller *mctl, 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_PRIM:
-	case CMD_AXI_CFG_SEC:
-	case CMD_AXI_CFG_ZSL:
-	case CMD_RAW_PICT_AXI_CFG:
-	case CMD_AXI_CFG_PRIM_ALL_CHNLS:
-	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_RESET:
-	case CMD_AXI_CFG_TERT1:
-	case CMD_AXI_CFG_TERT2:
-		/* 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:
-		pr_err("%s: unknown command type %d\n",
-			__func__,
-			cfgcmd.cmd_type);
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
-static int msm_put_stats_buffer(struct v4l2_subdev *sd,
-			struct msm_cam_media_controller *mctl, 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(mctl, buf.buffer, buf.fd);
-
-	if (pphy != 0) {
-		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 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_BE)
-			cfgcmd.cmd_type = CMD_STATS_BE_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",
-				__func__,
-				buf.type);
-			rc = -EINVAL;
-			goto put_done;
-		}
-
-		cfgcmd.value = (void *)&buf;
-
-		rc = msm_isp_subdev_ioctl(sd, &cfgcmd, &pphy);
-	} else {
-		pr_err("%s: NULL physical address\n", __func__);
-		rc = -EINVAL;
-	}
-
-put_done:
-	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,
-			 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;
-	D("%s: cmd %d\n", __func__, _IOC_NR(cmd));
-	switch (cmd) {
-	case MSM_CAM_IOCTL_CONFIG_VFE:
-		/* Coming from config thread for update */
-		rc = msm_config_vfe(sd, pmctl, argp);
-		break;
-
-	case MSM_CAM_IOCTL_AXI_CONFIG:
-		D("Received MSM_CAM_IOCTL_AXI_CONFIG\n");
-		rc = msm_axi_config(sd, pmctl, argp);
-		break;
-
-	case MSM_CAM_IOCTL_RELEASE_STATS_BUFFER:
-		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);
-		break;
-
-	default:
-		break;
-	}
-
-	D("%s: cmd %d DONE\n", __func__, _IOC_NR(cmd));
-
-	return rc;
-}
-EXPORT_SYMBOL(msm_isp_config);
-
-int msm_isp_subdev_ioctl(struct v4l2_subdev *isp_subdev,
-	struct msm_vfe_cfg_cmd *cfgcmd, void *data)
-{
-	struct msm_camvfe_params vfe_params;
-	vfe_params.vfe_cfg = cfgcmd;
-	vfe_params.data = data;
-	return v4l2_subdev_call(isp_subdev, core, ioctl, 0, &vfe_params);
-}
diff --git a/drivers/media/platform/msm/camera_v1/msm_mctl.c b/drivers/media/platform/msm/camera_v1/msm_mctl.c
deleted file mode 100644
index 95e889d..0000000
--- a/drivers/media/platform/msm/camera_v1/msm_mctl.c
+++ /dev/null
@@ -1,1753 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundataion. All rights reserved.
- *
- * This 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 <linux/wakelock.h>
-
-#include <media/v4l2-dev.h>
-#include <media/v4l2-ioctl.h>
-#include <media/v4l2-device.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"
-#include "msm_flash.h"
-
-#ifdef CONFIG_MSM_CAMERA_DEBUG
-#define D(fmt, args...) pr_debug("msm_mctl: " fmt, ##args)
-#else
-#define D(fmt, args...) do {} while (0)
-#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 */
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	},
-	{
-	.name	   = "NV21YUV",
-	.depth	  = 12,
-	.bitsperpxl = 8,
-	.fourcc	 = V4L2_PIX_FMT_NV21,
-	.pxlcode	= V4L2_MBUS_FMT_YUYV8_2X8, /* YUV sensor */
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	},
-	{
-	.name	   = "NV12BAYER",
-	.depth	  = 8,
-	.bitsperpxl = 8,
-	.fourcc	 = V4L2_PIX_FMT_NV12,
-	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, /* Bayer sensor */
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	},
-	{
-	.name	   = "NV21BAYER",
-	.depth	  = 8,
-	.bitsperpxl = 8,
-	.fourcc	 = V4L2_PIX_FMT_NV21,
-	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, /* Bayer sensor */
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	},
-	{
-	.name	   = "NV16BAYER",
-	.depth	  = 8,
-	.bitsperpxl = 8,
-	.fourcc	 = V4L2_PIX_FMT_NV16,
-	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, /* Bayer sensor */
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	},
-	{
-	.name	   = "NV61BAYER",
-	.depth	  = 8,
-	.bitsperpxl = 8,
-	.fourcc	 = V4L2_PIX_FMT_NV61,
-	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, /* Bayer sensor */
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	},
-	{
-	.name	   = "NV21BAYER",
-	.depth	  = 8,
-	.bitsperpxl = 8,
-	.fourcc	 = V4L2_PIX_FMT_NV21,
-	.pxlcode	= V4L2_MBUS_FMT_SGRBG10_1X10, /* Bayer sensor */
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	},
-	{
-	.name	   = "YU12BAYER",
-	.depth	  = 8,
-	.bitsperpxl = 8,
-	.fourcc	 = V4L2_PIX_FMT_YUV420M,
-	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, /* Bayer sensor */
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	},
-	{
-	.name	   = "RAWBAYER",
-	.depth	  = 10,
-	.bitsperpxl = 10,
-	.fourcc	 = V4L2_PIX_FMT_SBGGR10,
-	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, /* Bayer sensor */
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	},
-	{
-	.name	   = "RAWBAYER",
-	.depth	  = 10,
-	.bitsperpxl = 10,
-	.fourcc	 = V4L2_PIX_FMT_SBGGR10,
-	.pxlcode	= V4L2_MBUS_FMT_SGRBG10_1X10, /* Bayer sensor */
-	.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_get_sensor_info(
-	struct msm_cam_media_controller *mctl,
-	void __user *arg)
-{
-	int rc = 0;
-	struct msm_camsensor_info info;
-	struct msm_camera_sensor_info *sdata;
-	struct msm_cam_v4l2_device *pcam = mctl->pcam_ptr;
-	if (copy_from_user(&info,
-			arg,
-			sizeof(struct msm_camsensor_info))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	sdata = mctl->sdata;
-	D("%s: sensor_name %s\n", __func__, sdata->sensor_name);
-
-	memcpy(&info.name[0], sdata->sensor_name, MAX_SENSOR_NAME);
-	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.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 (copy_to_user((void *)arg,
-				&info,
-				sizeof(struct msm_camsensor_info))) {
-		ERR_COPY_TO_USER();
-		rc = -EFAULT;
-	}
-	return rc;
-}
-
-static int msm_mctl_set_vfe_output_mode(struct msm_cam_media_controller
-					*p_mctl, void __user *arg)
-{
-	int rc = 0;
-	if (copy_from_user(&p_mctl->vfe_output_mode,
-		(void __user *)arg, sizeof(p_mctl->vfe_output_mode))) {
-		pr_err("%s Copy from user failed ", __func__);
-		rc = -EFAULT;
-	} else {
-		pr_debug("%s: mctl=0x%p, vfe output mode =0x%x\n",
-		  __func__, p_mctl, p_mctl->vfe_output_mode);
-	}
-	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;
-}
-
-/* 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)
-{
-	int rc = -EINVAL;
-	void __user *argp = (void __user *)arg;
-	if (!p_mctl) {
-		pr_err("%s: param is NULL", __func__);
-		return -EINVAL;
-	}
-	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;
-
-	case MSM_CAM_IOCTL_SENSOR_IO_CFG:
-		rc = v4l2_subdev_call(p_mctl->sensor_sdev,
-			core, ioctl, VIDIOC_MSM_SENSOR_CFG, argp);
-			break;
-
-	case MSM_CAM_IOCTL_OEM:
-	 rc = v4l2_subdev_call(p_mctl->sensor_sdev,
-		 core, ioctl, VIDIOC_MSM_SENSOR_CFG, argp);
-		 break;
-
-	case MSM_CAM_IOCTL_SENSOR_V4l2_S_CTRL: {
-			struct v4l2_control v4l2_ctrl;
-			CDBG("subdev call\n");
-			if (copy_from_user(&v4l2_ctrl,
-				(void *)argp,
-				sizeof(struct v4l2_control))) {
-				CDBG("copy fail\n");
-				return -EFAULT;
-			}
-			CDBG("subdev call ok\n");
-			rc = v4l2_subdev_call(p_mctl->sensor_sdev,
-				core, s_ctrl, &v4l2_ctrl);
-			break;
-	}
-
-	case MSM_CAM_IOCTL_SENSOR_V4l2_QUERY_CTRL: {
-			struct v4l2_queryctrl v4l2_qctrl;
-			CDBG("query called\n");
-			if (copy_from_user(&v4l2_qctrl,
-				(void *)argp,
-				sizeof(struct v4l2_queryctrl))) {
-				CDBG("copy fail\n");
-				rc = -EFAULT;
-				break;
-			}
-			rc = v4l2_subdev_call(p_mctl->sensor_sdev,
-				core, queryctrl, &v4l2_qctrl);
-			if (rc < 0) {
-				rc = -EFAULT;
-				break;
-			}
-			if (copy_to_user((void *)argp,
-					 &v4l2_qctrl,
-					 sizeof(struct v4l2_queryctrl))) {
-				rc = -EFAULT;
-			}
-			break;
-	}
-
-	case MSM_CAM_IOCTL_GET_ACTUATOR_INFO: {
-		struct msm_actuator_cfg_data cdata;
-		if (copy_from_user(&cdata,
-			(void *)argp,
-			sizeof(struct msm_actuator_cfg_data))) {
-			ERR_COPY_FROM_USER();
-			return -EFAULT;
-		}
-		cdata.is_af_supported = 0;
-		rc = 0;
-
-		if (p_mctl->act_sdev) {
-			struct msm_camera_sensor_info *sdata;
-
-			sdata = p_mctl->sdata;
-			CDBG("%s: Act_cam_Name %d\n", __func__,
-				sdata->actuator_info->cam_name);
-
-			cdata.is_af_supported = 1;
-			cdata.cfg.cam_name =
-				(enum af_camera_name)sdata->
-				actuator_info->cam_name;
-
-			CDBG("%s: Af Support:%d\n", __func__,
-				cdata.is_af_supported);
-			CDBG("%s: Act_name:%d\n", __func__, cdata.cfg.cam_name);
-
-		}
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct msm_actuator_cfg_data))) {
-			ERR_COPY_TO_USER();
-			rc = -EFAULT;
-		}
-		break;
-	}
-
-	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);
-		} else {
-			rc = copy_from_user(
-				&act_data,
-				(void *)argp,
-				sizeof(struct msm_actuator_cfg_data));
-			if (rc != 0) {
-				rc = -EFAULT;
-				break;
-			}
-			act_data.is_af_supported = 0;
-			rc = copy_to_user((void *)argp,
-					 &act_data,
-					 sizeof(struct msm_actuator_cfg_data));
-			if (rc != 0) {
-				rc = -EFAULT;
-				break;
-			}
-		}
-		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))) {
-			ERR_COPY_FROM_USER();
-			rc = -EFAULT;
-		} else {
-			msm_mctl_gettimeofday(&timestamp);
-			rc = copy_to_user((void *)argp,
-				 &timestamp, sizeof(timestamp));
-		}
-		break;
-	}
-
-	case MSM_CAM_IOCTL_FLASH_CTRL: {
-		if (p_mctl->flash_sdev && msm_sensor_state_check(p_mctl))
-			rc = v4l2_subdev_call(p_mctl->flash_sdev,
-				core, ioctl, VIDIOC_MSM_FLASH_CFG, argp);
-		break;
-	}
-	case MSM_CAM_IOCTL_PICT_PP:
-		rc = msm_mctl_set_pp_key(p_mctl, (void __user *)arg);
-		break;
-	case MSM_CAM_IOCTL_PICT_PP_DIVERT_DONE:
-		rc = msm_mctl_pp_divert_done(p_mctl, (void __user *)arg);
-		break;
-	case MSM_CAM_IOCTL_PICT_PP_DONE:
-		rc = msm_mctl_pp_done(p_mctl, (void __user *)arg);
-		break;
-	case MSM_CAM_IOCTL_MCTL_POST_PROC:
-		rc = msm_mctl_pp_ioctl(p_mctl, cmd, arg);
-		break;
-	case MSM_CAM_IOCTL_RESERVE_FREE_FRAME:
-		rc = msm_mctl_pp_reserve_free_frame(p_mctl,
-			(void __user *)arg);
-		break;
-	case MSM_CAM_IOCTL_RELEASE_FREE_FRAME:
-		rc = msm_mctl_pp_release_free_frame(p_mctl,
-			(void __user *)arg);
-		break;
-	case MSM_CAM_IOCTL_SET_VFE_OUTPUT_TYPE:
-		rc = msm_mctl_set_vfe_output_mode(p_mctl,
-		  (void __user *)arg);
-		break;
-	case MSM_CAM_IOCTL_MCTL_DIVERT_DONE:
-		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);
-			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);
-		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;
-
-	default:
-		/* ISP config*/
-		D("%s:%d: go to default. Calling msm_isp_config\n",
-			__func__, __LINE__);
-		rc = p_mctl->isp_config(p_mctl, cmd, arg);
-		break;
-	}
-	D("%s: !!! cmd = %d, rc = %d\n",
-		__func__, _IOC_NR(cmd), rc);
-	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 = 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;
-	struct msm_camera_sensor_flash_data *flash_data = sinfo->flash_data;
-	uint8_t csid_core;
-	D("%s\n", __func__);
-	if (!p_mctl) {
-		pr_err("%s: param is NULL", __func__);
-		return -EINVAL;
-	}
-
-	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);
-
-		csid_core = camdev->csid_core;
-		rc = msm_mctl_find_sensor_subdevs(p_mctl, camdev->csiphy_core,
-			csid_core);
-		if (rc < 0) {
-			pr_err("%s: msm_mctl_find_sensor_subdevs failed:%d\n",
-				__func__, rc);
-			goto register_sdev_failed;
-		}
-
-		/* then sensor - move sub dev later */
-		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 (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 (!p_mctl->flash_sdev && flash_data) {
-			if ((flash_data->flash_type == MSM_CAMERA_FLASH_LED) &&
-				(flash_data->flash_src_index >= 0))
-				msm_mctl_find_flash_subdev(p_mctl,
-					flash_data->flash_src_index);
-		}
-
-		if (p_mctl->flash_sdev && p_mctl->sdata->flash_data &&
-			p_mctl->sdata->flash_data->flash_type !=
-			MSM_CAMERA_FLASH_NONE) {
-			rc = v4l2_subdev_call(p_mctl->flash_sdev, core, ioctl,
-					VIDIOC_MSM_FLASH_LED_DATA_CFG,
-					p_mctl->sdata->flash_data);
-			if (rc < 0) {
-				pr_err("%s: set flash led failed %d\n",
-				__func__, rc);
-			}
-		}
-
-		if (p_mctl->flash_sdev && p_mctl->sdata->strobe_flash_data) {
-			rc = v4l2_subdev_call(p_mctl->flash_sdev, core, ioctl,
-					VIDIOC_MSM_FLASH_STROBE_DATA_CFG,
-					p_mctl->sdata->strobe_flash_data);
-			if (rc < 0) {
-				pr_err("%s: set strobe flash led failed %d\n",
-				__func__, rc);
-			}
-		}
-
-		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:
-register_sdev_failed:
-	wake_unlock(&p_mctl->wake_lock);
-	mutex_unlock(&p_mctl->lock);
-	return rc;
-}
-
-static void msm_mctl_release(struct msm_cam_media_controller *p_mctl)
-{
-	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;
-	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);
-	}
-
-	if (p_mctl->vpe_sdev) {
-		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->csid_sdev) {
-		v4l2_subdev_call(p_mctl->csid_sdev, core, ioctl,
-			VIDIOC_MSM_CSID_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->act_sdev) {
-		v4l2_subdev_call(p_mctl->act_sdev, core, s_power, 0);
-		p_mctl->act_sdev = NULL;
-	}
-
-	v4l2_subdev_call(p_mctl->sensor_sdev, core, s_power, 0);
-
-	pm_qos_update_request(&p_mctl->pm_qos_req_list,
-				PM_QOS_DEFAULT_VALUE);
-	pm_qos_remove_request(&p_mctl->pm_qos_req_list);
-
-	wake_unlock(&p_mctl->wake_lock);
-}
-
-int msm_mctl_init_user_formats(struct msm_cam_v4l2_device *pcam)
-{
-	struct v4l2_subdev *sd = pcam->sensor_sdev;
-	enum v4l2_mbus_pixelcode pxlcode;
-	int numfmt_sensor = 0;
-	int numfmt = 0;
-	int rc = 0;
-	int i, j;
-
-	D("%s\n", __func__);
-	while (!v4l2_subdev_call(sd, video, enum_mbus_fmt, numfmt_sensor,
-								&pxlcode))
-		numfmt_sensor++;
-
-	D("%s, numfmt_sensor = %d\n", __func__, numfmt_sensor);
-	if (!numfmt_sensor)
-		return -ENXIO;
-
-	pcam->usr_fmts = vmalloc(numfmt_sensor * ARRAY_SIZE(msm_isp_formats) *
-				sizeof(struct msm_isp_color_fmt));
-	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);
-		if (rc < 0) {
-			vfree(pcam->usr_fmts);
-			return rc;
-		}
-
-		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);
-				D("format pxlcode 0x%x (0x%x) found\n",
-					  pcam->usr_fmts[numfmt].pxlcode,
-					  pcam->usr_fmts[numfmt].fourcc);
-				numfmt++;
-			}
-		}
-	}
-
-	pcam->num_fmts = numfmt;
-
-	if (numfmt == 0) {
-		pr_err("%s: No supported formats.\n", __func__);
-		vfree(pcam->usr_fmts);
-		return -EINVAL;
-	}
-
-	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;
-	D("%s\n", __func__);
-	if (!pcam) {
-		pr_err("%s: param is NULL", __func__);
-		return -EINVAL;
-	}
-	pcam->mctl_handle = msm_cam_server_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);
-	if (!pmctl) {
-		pr_err("%s: invalid mctl controller", __func__);
-		return -EINVAL;
-	}
-
-	wake_lock_init(&pmctl->wake_lock, WAKE_LOCK_SUSPEND, "msm_camera");
-	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->flash_sdev = pcam->flash_sdev;
-	pmctl->act_sdev = pcam->act_sdev;
-	pmctl->eeprom_sdev = pcam->eeprom_sdev;
-	pmctl->sensor_sdev = pcam->sensor_sdev;
-	pmctl->sdata = pcam->sdata;
-	v4l2_set_subdev_hostdata(pcam->sensor_sdev, pmctl);
-
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	pmctl->client = msm_ion_client_create(-1, "camera");
-	kref_init(&pmctl->refcount);
-#endif
-
-	return 0;
-}
-
-int msm_mctl_free(struct msm_cam_v4l2_device *pcam)
-{
-	int rc = 0;
-	struct msm_cam_media_controller *pmctl = NULL;
-	D("%s\n", __func__);
-
-	pmctl = msm_cam_server_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);
-	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;
-
-	if (f == NULL) {
-		pr_err("%s :: cannot open video driver data", __func__);
-		return rc;
-	}
-	pcam = video_drvdata(f);
-
-	if (!pcam) {
-		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;
-	}
-	pcam_inst = kzalloc(sizeof(struct msm_cam_v4l2_dev_inst), GFP_KERNEL);
-	if (!pcam_inst) {
-		mutex_unlock(&pcam->mctl_node.dev_lock);
-		return rc;
-	}
-
-	pcam_inst->sensor_pxlcode = pcam->usr_fmts[0].pxlcode;
-	pcam_inst->my_index = i;
-	pcam_inst->pcam = pcam;
-	mutex_init(&pcam_inst->inst_lock);
-	pcam->mctl_node.dev_inst[i] = pcam_inst;
-
-	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) {
-		pr_err("%s: mctl session open failed %d", __func__, rc);
-		mutex_unlock(&pcam->mctl_node.dev_lock);
-		return rc;
-	}
-
-	pmctl = msm_cam_server_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);
-
-	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;
-}
-
-static unsigned int msm_mctl_dev_poll(struct file *f,
-				struct poll_table_struct *wait)
-{
-	int rc = 0;
-	struct msm_cam_v4l2_device *pcam;
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	pcam_inst = container_of(f->private_data,
-			struct msm_cam_v4l2_dev_inst, eventHandle);
-	pcam = pcam_inst->pcam;
-
-	D("%s : E pcam_inst = %p", __func__, pcam_inst);
-	if (!pcam) {
-		pr_err("%s NULL pointer of camera device!\n", __func__);
-		return -EINVAL;
-	}
-
-	poll_wait(f, &(pcam_inst->eventHandle.wait), wait);
-	if (v4l2_event_pending(&pcam_inst->eventHandle)) {
-		rc |= POLLPRI;
-		D("%s Event available on mctl node ", __func__);
-	}
-
-	D("%s poll on vb2\n", __func__);
-	if (!pcam_inst->vid_bufq.streaming) {
-		D("%s vid_bufq.streaming is off, inst=0x%x\n",
-				__func__, (u32)pcam_inst);
-		return rc;
-	}
-	rc |= vb2_poll(&pcam_inst->vid_bufq, f, wait);
-
-	D("%s : X ", __func__);
-	return rc;
-}
-
-static int msm_mctl_dev_close(struct file *f)
-{
-	int rc = 0;
-	struct msm_cam_v4l2_device *pcam;
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	struct msm_cam_media_controller *pmctl;
-	pcam_inst = container_of(f->private_data,
-		struct msm_cam_v4l2_dev_inst, eventHandle);
-	pcam = pcam_inst->pcam;
-
-	D("%s : E ", __func__);
-	if (!pcam) {
-		pr_err("%s NULL pointer of camera device!\n", __func__);
-		return -EINVAL;
-	}
-
-	pmctl = msm_cam_server_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);
-		if (rc < 0) {
-			pr_err("%s: mctl session close failed %d",
-				__func__, rc);
-			mutex_unlock(&pcam->mctl_node.dev_lock);
-			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);
-	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);
-	}
-	mutex_unlock(&pcam->mctl_node.dev_lock);
-	D("%s : use_count %d X ", __func__, pcam->mctl_node.use_count);
-	return rc;
-}
-
-static struct v4l2_file_operations g_msm_mctl_fops = {
-	.owner   = THIS_MODULE,
-	.open	= msm_mctl_dev_open,
-	.poll	= msm_mctl_dev_poll,
-	.release = msm_mctl_dev_close,
-	.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)
-{
-	struct msm_cam_v4l2_device *pcam;
-
-	if (f == NULL) {
-		pr_err("%s :: NULL file pointer", __func__);
-		return -EINVAL;
-	}
-
-	pcam = video_drvdata(f);
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	if (!pcam) {
-		pr_err("%s NULL pointer passed in!\n", __func__);
-		return -EINVAL;
-	}
-
-	strlcpy(pcaps->driver, pcam->media_dev.dev->driver->name,
-			sizeof(pcaps->driver));
-	pcaps->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
-	return 0;
-}
-
-static int msm_mctl_v4l2_queryctrl(struct file *f, void *pctx,
-				struct v4l2_queryctrl *pqctrl)
-{
-	int rc = 0;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	return rc;
-}
-
-static int msm_mctl_v4l2_g_ctrl(struct file *f, void *pctx,
-					struct v4l2_control *c)
-{
-	int rc = 0;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	return rc;
-}
-
-static int msm_mctl_v4l2_s_ctrl(struct file *f, void *pctx,
-					struct v4l2_control *ctrl)
-{
-	int rc = 0;
-	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);
-
-	D("%s\n", __func__);
-
-	WARN_ON(pctx != f->private_data);
-	mutex_lock(&pcam->mctl_node.dev_lock);
-	if (ctrl->id == MSM_V4L2_PID_PP_PLANE_INFO) {
-		if (copy_from_user(&pcam_inst->plane_info,
-					(void *)ctrl->value,
-					sizeof(struct img_plane_info))) {
-			pr_err("%s inst %p Copying plane_info failed ",
-					__func__, pcam_inst);
-			rc = -EFAULT;
-		}
-		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,
-				pcam_inst->plane_info.plane[1].size);
-	} else
-		pr_err("%s Unsupported S_CTRL Value ", __func__);
-
-	mutex_unlock(&pcam->mctl_node.dev_lock);
-
-	return rc;
-}
-
-static int msm_mctl_v4l2_reqbufs(struct file *f, void *pctx,
-				struct v4l2_requestbuffers *pb)
-{
-	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__);
-			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);
-		mutex_unlock(&pcam_inst->inst_lock);
-		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++) {
-			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;
-		}
-	} 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);
-		if (!pcam_inst->buf_offset) {
-			pr_err("%s out of memory ", __func__);
-			mutex_unlock(&pcam_inst->inst_lock);
-			return -ENOMEM;
-		}
-		for (i = 0; i < pb->count; i++) {
-			pcam_inst->buf_offset[i] =
-				kzalloc(sizeof(struct msm_cam_buf_offset) *
-				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--) {
-					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);
-				return -ENOMEM;
-			}
-		}
-	}
-	pcam_inst->buf_count = pb->count;
-	D("%s inst %p, buf count %d ", __func__,
-		pcam_inst, pcam_inst->buf_count);
-	mutex_unlock(&pcam_inst->inst_lock);
-	return rc;
-}
-
-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,
-		struct msm_cam_v4l2_dev_inst, eventHandle);
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-	mutex_lock(&pcam_inst->inst_lock);
-	rc = vb2_querybuf(&pcam_inst->vid_bufq, pb);
-	mutex_unlock(&pcam_inst->inst_lock);
-	return rc;
-}
-
-static int msm_mctl_v4l2_qbuf(struct file *f, void *pctx,
-					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);
-
-	D("%s Inst = %p\n", __func__, pcam_inst);
-	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. ", __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 ", __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",
-				__func__, i, pb->m.planes[i].reserved[0],
-				pb->m.planes[i].data_offset);
-			pcam_inst->buf_offset[pb->index][i].data_offset =
-				pb->m.planes[i].data_offset;
-			pcam_inst->buf_offset[pb->index][i].addr_offset =
-				pb->m.planes[i].reserved[0];
-			pcam_inst->plane_info.plane[i].offset = 0;
-			D("%s, len %d user[%d] %p buf_len %d\n",
-				__func__, pb->length, i,
-				(void *)pb->m.planes[i].m.userptr,
-				pb->m.planes[i].length);
-		}
-	} else {
-		D("%s stored reserved info %d", __func__, pb->reserved);
-		pcam_inst->buf_offset[pb->index][0].addr_offset = pb->reserved;
-	}
-
-	rc = vb2_qbuf(&pcam_inst->vid_bufq, pb);
-	D("%s, videobuf_qbuf returns %d\n", __func__, rc);
-
-	mutex_unlock(&pcam_inst->inst_lock);
-	return rc;
-}
-
-static int msm_mctl_v4l2_dqbuf(struct file *f, void *pctx,
-					struct v4l2_buffer *pb)
-{
-	int rc = 0, i;
-	/* 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);
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-	mutex_lock(&pcam_inst->inst_lock);
-	if (0 == pcam_inst->streamon) {
-		mutex_unlock(&pcam_inst->inst_lock);
-		return -EACCES;
-	}
-
-	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;
-}
-
-static int msm_mctl_v4l2_streamon(struct file *f, void *pctx,
-					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,
-		struct msm_cam_v4l2_dev_inst, eventHandle);
-
-	D("%s Inst %p\n", __func__, pcam_inst);
-	WARN_ON(pctx != f->private_data);
-
-	mutex_lock(&pcam->mctl_node.dev_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__);
-		mutex_unlock(&pcam_inst->inst_lock);
-		mutex_unlock(&pcam->mctl_node.dev_lock);
-		return -EINVAL;
-	}
-
-	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);
-	D("%s rc = %d\n", __func__, rc);
-	return rc;
-}
-
-static int msm_mctl_v4l2_streamoff(struct file *f, void *pctx,
-					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,
-		struct msm_cam_v4l2_dev_inst, eventHandle);
-
-	D("%s Inst %p\n", __func__, pcam_inst);
-	WARN_ON(pctx != f->private_data);
-
-	if ((buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) &&
-		(buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE)) {
-		pr_err("%s Invalid buffer type ", __func__);
-		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);
-	mutex_unlock(&pcam->mctl_node.dev_lock);
-	return rc;
-}
-
-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;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-	if ((pfmtdesc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) &&
-		(pfmtdesc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE))
-		return -EINVAL;
-
-	if (pfmtdesc->index >= pcam->num_fmts)
-		return -EINVAL;
-
-	isp_fmt = &pcam->usr_fmts[pfmtdesc->index];
-
-	if (isp_fmt->name)
-		strlcpy(pfmtdesc->description, isp_fmt->name,
-						sizeof(pfmtdesc->description));
-
-	pfmtdesc->pixelformat = isp_fmt->fourcc;
-
-	D("%s: [%d] 0x%x, %s\n", __func__, pfmtdesc->index,
-		isp_fmt->fourcc, isp_fmt->name);
-	return 0;
-}
-
-static int msm_mctl_v4l2_g_fmt_cap(struct file *f,
-		void *pctx, struct v4l2_format *pfmt)
-{
-	int rc = 0;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	if (pfmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
-		return -EINVAL;
-
-	return rc;
-}
-
-static int msm_mctl_v4l2_g_fmt_cap_mplane(struct file *f,
-		void *pctx, struct v4l2_format *pfmt)
-{
-	int rc = 0;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	if (pfmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
-		return -EINVAL;
-
-	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)
-{
-	int rc = 0;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	return rc;
-}
-
-static int msm_mctl_v4l2_try_fmt_cap_mplane(struct file *f, void *pctx,
-					struct v4l2_format *pfmt)
-{
-	int rc = 0;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	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;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	return rc;
-}
-
-static int msm_mctl_v4l2_s_fmt_cap_mplane(struct file *f, void *pctx,
-				struct v4l2_format *pfmt)
-{
-	int rc = 0, i;
-	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);
-
-	D("%s Inst %p\n", __func__, pcam_inst);
-	WARN_ON(pctx != f->private_data);
-
-	for (i = 0; i < pcam->num_fmts; i++)
-		if (pcam->usr_fmts[i].fourcc == pfmt->fmt.pix_mp.pixelformat)
-			break;
-	if (i == pcam->num_fmts) {
-		pr_err("%s: User requested pixelformat %x not supported\n",
-			__func__, pfmt->fmt.pix_mp.pixelformat);
-		return -EINVAL;
-	}
-	pcam_inst->vid_fmt = *pfmt;
-	pcam_inst->sensor_pxlcode =
-		pcam->usr_fmts[i].pxlcode;
-	D("%s: inst=%p, width=%d, heigth=%d\n",
-		__func__, pcam_inst,
-		pcam_inst->vid_fmt.fmt.pix_mp.width,
-		pcam_inst->vid_fmt.fmt.pix_mp.height);
-	return rc;
-}
-static int msm_mctl_v4l2_g_jpegcomp(struct file *f, void *pctx,
-				struct v4l2_jpegcompression *pcomp)
-{
-	int rc = -EINVAL;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	return rc;
-}
-
-static int msm_mctl_v4l2_s_jpegcomp(struct file *f, void *pctx,
-				struct v4l2_jpegcompression *pcomp)
-{
-	int rc = -EINVAL;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	return rc;
-}
-
-
-static int msm_mctl_v4l2_g_crop(struct file *f, void *pctx,
-					struct v4l2_crop *crop)
-{
-	int rc = -EINVAL;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	return rc;
-}
-
-static int msm_mctl_v4l2_s_crop(struct file *f, void *pctx,
-					struct v4l2_crop *a)
-{
-	int rc = -EINVAL;
-
-	D("%s\n", __func__);
-	WARN_ON(pctx != f->private_data);
-
-	return rc;
-}
-
-/* Stream type-dependent parameter ioctls */
-static int msm_mctl_v4l2_g_parm(struct file *f, void *pctx,
-				struct v4l2_streamparm *a)
-{
-	int rc = -EINVAL;
-	return rc;
-}
-
-static int msm_mctl_vidbuf_get_path(u32 extendedmode)
-{
-	switch (extendedmode) {
-	case MSM_V4L2_EXT_CAPTURE_MODE_THUMBNAIL:
-		return OUTPUT_TYPE_T;
-	case MSM_V4L2_EXT_CAPTURE_MODE_MAIN:
-		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_DEFAULT:
-	case MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW:
-	default:
-		return OUTPUT_TYPE_P;
-	}
-}
-
-static int msm_mctl_v4l2_s_parm(struct file *f, void *pctx,
-				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->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;
-}
-
-static int msm_mctl_v4l2_subscribe_event(struct v4l2_fh *fh,
-			struct v4l2_event_subscription *sub)
-{
-	int rc = 0;
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	pcam_inst =
-		(struct msm_cam_v4l2_dev_inst *)container_of(fh,
-		struct msm_cam_v4l2_dev_inst, eventHandle);
-
-	D("%s:fh = 0x%x, type = 0x%x\n", __func__, (u32)fh, sub->type);
-
-	if (sub->type == V4L2_EVENT_ALL)
-		sub->type = V4L2_EVENT_PRIVATE_START+MSM_CAM_APP_NOTIFY_EVENT;
-	rc = v4l2_event_subscribe(fh, sub, 30);
-	if (rc < 0)
-		pr_err("%s: failed for evtType = 0x%x, rc = %d\n",
-						__func__, sub->type, rc);
-	return rc;
-}
-
-static int msm_mctl_v4l2_unsubscribe_event(struct v4l2_fh *fh,
-			struct v4l2_event_subscription *sub)
-{
-	int rc = 0;
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	pcam_inst =
-		(struct msm_cam_v4l2_dev_inst *)container_of(fh,
-		struct msm_cam_v4l2_dev_inst, eventHandle);
-
-	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 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,
-
-	.vidioc_s_crop = msm_mctl_v4l2_s_crop,
-	.vidioc_g_crop = msm_mctl_v4l2_g_crop,
-
-	.vidioc_queryctrl = msm_mctl_v4l2_queryctrl,
-	.vidioc_g_ctrl = msm_mctl_v4l2_g_ctrl,
-	.vidioc_s_ctrl = msm_mctl_v4l2_s_ctrl,
-
-	.vidioc_reqbufs = msm_mctl_v4l2_reqbufs,
-	.vidioc_querybuf = msm_mctl_v4l2_querybuf,
-	.vidioc_qbuf = msm_mctl_v4l2_qbuf,
-	.vidioc_dqbuf = msm_mctl_v4l2_dqbuf,
-
-	.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,
-	.vidioc_try_fmt_vid_cap_mplane = msm_mctl_v4l2_try_fmt_cap_mplane,
-	.vidioc_g_fmt_vid_cap = msm_mctl_v4l2_g_fmt_cap,
-	.vidioc_g_fmt_vid_cap_mplane = msm_mctl_v4l2_g_fmt_cap_mplane,
-	.vidioc_s_fmt_vid_cap = msm_mctl_v4l2_s_fmt_cap,
-	.vidioc_s_fmt_vid_cap_mplane = msm_mctl_v4l2_s_fmt_cap_mplane,
-
-	.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;
-	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 */
-	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));
-
-	pvdev->release   = video_device_release;
-	pvdev->fops	  = &g_msm_mctl_fops;
-	pvdev->ioctl_ops  = &g_msm_mctl_ioctl_ops;
-	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,
-			-1);
-	if (rc) {
-		pr_err("%s: video_register_device failed\n", __func__);
-		goto reg_fail;
-	}
-	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);
-
-	return rc ;
-
-reg_fail:
-	video_device_release(pvdev);
-	v4l2_device_unregister(&pcam->mctl_node.v4l2_dev);
-	pcam->mctl_node.v4l2_dev.dev = NULL;
-	return rc;
-}
diff --git a/drivers/media/platform/msm/camera_v1/msm_mctl_buf.c b/drivers/media/platform/msm/camera_v1/msm_mctl_buf.c
deleted file mode 100644
index 041f674..0000000
--- a/drivers/media/platform/msm/camera_v1/msm_mctl_buf.c
+++ /dev/null
@@ -1,1044 +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 <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/vmalloc.h>
-
-#include <media/v4l2-dev.h>
-#include <media/v4l2-ioctl.h>
-#include <media/v4l2-device.h>
-
-
-
-#include "msm.h"
-#include "msm_cam_server.h"
-#include "msm_ispif.h"
-
-#ifdef CONFIG_MSM_CAMERA_DEBUG
-#define D(fmt, args...) pr_debug("msm_mctl_buf: " fmt, ##args)
-#else
-#define D(fmt, args...) do {} while (0)
-#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[])
-{
-	/* 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;
-
-	D("%s\n", __func__);
-	if (!pcam || !(*num_buffers)) {
-		pr_err("%s error : invalid input\n", __func__);
-		return -EINVAL;
-	}
-
-	*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;
-		D("%s Inst %p : Plane %d Offset = %d Size = %ld"
-			"Aligned Size = %d", __func__, pcam_inst, i,
-			pcam_inst->plane_info.plane[i].offset,
-			pcam_inst->plane_info.plane[i].size, sizes[i]);
-	}
-	return 0;
-}
-
-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)
-{
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	struct msm_cam_v4l2_device *pcam;
-	struct msm_cam_media_controller *pmctl;
-	struct videobuf2_contig_pmem *mem;
-	struct vb2_queue	*vq;
-	uint32_t buf_idx;
-	struct msm_frame_buffer *buf;
-	int rc = 0, i;
-	enum videobuf2_buffer_type buf_type;
-	struct videobuf2_msm_offset offset;
-	vq = vb->vb2_queue;
-	pcam_inst = vb2_get_drv_priv(vq);
-	pcam = pcam_inst->pcam;
-	D("%s\n", __func__);
-	D("%s, inst=0x%x,idx=%d, width = %d\n", __func__,
-		(u32)pcam_inst, pcam_inst->my_index,
-		pcam_inst->vid_fmt.fmt.pix.width);
-	D("%s, inst=0x%x,idx=%d, height = %d\n", __func__,
-		(u32)pcam_inst, pcam_inst->my_index,
-		pcam_inst->vid_fmt.fmt.pix.height);
-
-	buf = container_of(vb, struct msm_frame_buffer, vidbuf);
-	if (buf->state == MSM_BUFFER_STATE_INITIALIZED)
-		return rc;
-
-	if (pcam_inst->plane_info.buffer_type ==
-		V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
-		buf_type = VIDEOBUF2_MULTIPLE_PLANES;
-	else if (pcam_inst->plane_info.buffer_type ==
-		V4L2_BUF_TYPE_VIDEO_CAPTURE)
-		buf_type = VIDEOBUF2_SINGLE_PLANE;
-	else
-		return -EINVAL;
-
-	if (buf_type == VIDEOBUF2_SINGLE_PLANE) {
-		offset.sp_off.y_off = pcam_inst->plane_info.sp_y_offset;
-		offset.sp_off.cbcr_off =
-			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;
-	}
-	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;
-
-		if (vb->v4l2_buf.memory == V4L2_MEMORY_USERPTR)
-			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);
-		else
-			rc = videobuf2_pmem_contig_mmap_get(mem, &offset,
-				buf_type, pcam_inst->path);
-		if (rc < 0) {
-			pr_err("%s error initializing buffer ",
-				__func__);
-			return rc;
-		}
-	}
-	buf->state = MSM_BUFFER_STATE_INITIALIZED;
-	return rc;
-}
-
-static int msm_vb2_ops_buf_prepare(struct vb2_buffer *vb)
-{
-	int i, rc = 0;
-	uint32_t len;
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	struct msm_cam_v4l2_device *pcam;
-	struct msm_frame_buffer *buf;
-	struct vb2_queue *vq;
-
-	D("%s\n", __func__);
-	if (!vb || !vb->vb2_queue) {
-		pr_err("%s error : input is NULL\n", __func__);
-		return -EINVAL;
-	}
-	vq = vb->vb2_queue;
-	pcam_inst = vb2_get_drv_priv(vq);
-	pcam = pcam_inst->pcam;
-	buf = container_of(vb, struct msm_frame_buffer, vidbuf);
-
-	if (!pcam || !buf) {
-		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);
-	}
-	buf->state = MSM_BUFFER_STATE_PREPARED;
-	return rc;
-}
-
-static int msm_vb2_ops_buf_finish(struct vb2_buffer *vb)
-{
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	struct msm_cam_v4l2_device *pcam;
-	struct msm_frame_buffer *buf;
-
-	pcam_inst = vb2_get_drv_priv(vb->vb2_queue);
-	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__,
-	(uint32_t)pcam_inst, (uint32_t)buf, vb->v4l2_buf.index);
-	return 0;
-}
-
-static void msm_vb2_ops_buf_cleanup(struct vb2_buffer *vb)
-{
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	struct msm_cam_media_controller *pmctl;
-	struct msm_cam_v4l2_device *pcam;
-	struct videobuf2_contig_pmem *mem;
-	struct msm_frame_buffer *buf, *tmp;
-	uint32_t i, vb_phyaddr = 0, buf_phyaddr = 0;
-	unsigned long flags = 0;
-
-	pcam_inst = vb2_get_drv_priv(vb->vb2_queue);
-	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);
-			if (!mem) {
-				D("%s Inst %p memory already freed up. return",
-					__func__, pcam_inst);
-				return;
-			}
-			D("%s: inst=%p, buf=0x%x, idx=%d plane id = %d\n",
-				__func__, pcam_inst,
-				(uint32_t)buf, vb->v4l2_buf.index, i);
-
-			spin_lock_irqsave(&pcam_inst->vq_irqlock, flags);
-			list_for_each_entry_safe(buf, tmp,
-					&pcam_inst->free_vq, list) {
-				if (&buf->vidbuf == vb) {
-					list_del_init(&buf->list);
-					break;
-				}
-			}
-			spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
-		}
-	} else {
-		mem = vb2_plane_cookie(vb, 0);
-		if (!mem)
-			return;
-		D("%s: inst=0x%x, buf=0x%x, idx=%d\n", __func__,
-		(uint32_t)pcam_inst, (uint32_t)buf, vb->v4l2_buf.index);
-		vb_phyaddr = (unsigned long) videobuf2_to_pmem_contig(vb, 0);
-		spin_lock_irqsave(&pcam_inst->vq_irqlock, flags);
-		list_for_each_entry_safe(buf, tmp,
-				&pcam_inst->free_vq, list) {
-			buf_phyaddr = (unsigned long)
-				videobuf2_to_pmem_contig(&buf->vidbuf, 0);
-			D("%s vb_idx=%d,vb_paddr=0x%x,phyaddr=0x%x\n",
-				__func__, buf->vidbuf.v4l2_buf.index,
-				buf_phyaddr, vb_phyaddr);
-			if (vb_phyaddr == buf_phyaddr) {
-				list_del_init(&buf->list);
-				break;
-			}
-		}
-		spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
-	}
-	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
-	if (pmctl == 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;
-		}
-	}
-	buf->state = MSM_BUFFER_STATE_UNUSED;
-}
-
-static int msm_vb2_ops_start_streaming(struct vb2_queue *q, unsigned int count)
-{
-	return 0;
-}
-
-static int msm_vb2_ops_stop_streaming(struct vb2_queue *q)
-{
-	return 0;
-}
-
-static void msm_vb2_ops_buf_queue(struct vb2_buffer *vb)
-{
-	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 msm_frame_buffer *buf;
-	D("%s\n", __func__);
-	if (!vb || !vb->vb2_queue) {
-		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",
-		__func__, pcam_inst,
-	vb, vb->v4l2_buf.index, vb->v4l2_buf.length);
-	D("%s pcam_inst=%p, idx=%d\n", __func__, pcam_inst,
-		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;
-}
-
-static struct vb2_ops msm_vb2_ops = {
-	.queue_setup = msm_vb2_ops_queue_setup,
-	.wait_prepare = msm_vb2_ops_wait_prepare,
-	.wait_finish = msm_vb2_ops_wait_finish,
-	.buf_init = msm_vb2_ops_buf_init,
-	.buf_prepare = msm_vb2_ops_buf_prepare,
-	.buf_finish = msm_vb2_ops_buf_finish,
-	.buf_cleanup = msm_vb2_ops_buf_cleanup,
-	.start_streaming = msm_vb2_ops_start_streaming,
-	.stop_streaming = msm_vb2_ops_stop_streaming,
-	.buf_queue = msm_vb2_ops_buf_queue,
-};
-
-
-/* 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)
-{
-	if (!q) {
-		pr_err("%s error : input is NULL\n", __func__);
-		return -EINVAL;
-	}
-
-	spin_lock_init(&pcam_inst->vq_irqlock);
-	INIT_LIST_HEAD(&pcam_inst->free_vq);
-	videobuf2_queue_pmem_contig_init(q, type,
-					&msm_vb2_ops,
-					sizeof(struct msm_frame_buffer),
-					(void *)pcam_inst);
-	return 0;
-}
-
-int msm_mctl_img_mode_to_inst_index(struct msm_cam_media_controller *pmctl,
-					int image_mode, int node_type)
-{
-	if ((image_mode >= 0) && node_type &&
-		pmctl->pcam_ptr->mctl_node.dev_inst_map[image_mode])
-		return pmctl->pcam_ptr->
-				mctl_node.dev_inst_map[image_mode]->my_index;
-	else if ((image_mode >= 0) &&
-		pmctl->pcam_ptr->dev_inst_map[image_mode])
-		return	pmctl->pcam_ptr->
-				dev_inst_map[image_mode]->my_index;
-	else
-		return -EINVAL;
-}
-
-void msm_mctl_gettimeofday(struct timeval *tv)
-{
-	struct timespec ts;
-
-	BUG_ON(!tv);
-
-	ktime_get_ts(&ts);
-	tv->tv_sec = ts.tv_sec;
-	tv->tv_usec = ts.tv_nsec/1000;
-}
-
-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)
-{
-	struct msm_frame_buffer *buf = NULL, *tmp;
-	uint32_t buf_phyaddr = 0;
-	unsigned long flags = 0;
-	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)
-			offset = mem->offset.data_offset +
-				pcam_inst->buf_offset[buf_idx][0].data_offset;
-		else
-			offset = mem->offset.sp_off.y_off;
-		buf_phyaddr = (unsigned long)
-				videobuf2_to_pmem_contig(&buf->vidbuf, 0) +
-				offset;
-		D("%s vb_idx=%d,vb_paddr=0x%x ch0=0x%x\n",
-			__func__, buf->vidbuf.v4l2_buf.index,
-			buf_phyaddr, fbuf->ch_paddr[0]);
-		if (fbuf->ch_paddr[0] == buf_phyaddr) {
-			if (del_buf)
-				list_del_init(&buf->list);
-			spin_unlock_irqrestore(&pcam_inst->vq_irqlock,
-								flags);
-			buf->state = MSM_BUFFER_STATE_RESERVED;
-			return buf;
-		}
-	}
-	spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
-	return NULL;
-}
-
-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)
-{
-	struct msm_frame_buffer *buf = NULL;
-	int del_buf = 1;
-
-	buf = msm_mctl_buf_find(pmctl, pcam_inst, del_buf, fbuf);
-	if (!buf) {
-		pr_err("%s: buf=0x%x not found\n",
-			__func__, fbuf->ch_paddr[0]);
-		return -EINVAL;
-	}
-	if (!cam_ts->present) {
-		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;
-	}
-	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)
-{
-	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 {
-				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);
-				return -EINVAL;
-			}
-			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));
-		rc = msm_mctl_buf_done_proc(p_mctl, pcam_inst,
-			fbuf, &frame_id, &cam_ts);
-	}
-	return rc;
-}
-
-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->mctl_vbqueue_init = msm_vbqueue_init;
-	return 0;
-}
-
-static int is_buffer_queued(struct msm_cam_v4l2_device *pcam, int image_mode)
-{
-	int idx;
-	int ret = 0;
-	struct msm_frame_buffer *buf = NULL;
-	struct msm_cam_v4l2_dev_inst *pcam_inst = NULL;
-	idx = pcam->mctl_node.dev_inst_map[image_mode]->my_index;
-	pcam_inst = pcam->mctl_node.dev_inst[idx];
-	list_for_each_entry(buf, &pcam_inst->free_vq, list) {
-		if (buf->state != MSM_BUFFER_STATE_QUEUED)
-			continue;
-		ret = 1;
-	}
-	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) {
-			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 (img_mode == MSM_V4L2_EXT_CAPTURE_MODE_V2X_LIVESHOT) {
-				img_mode = MSM_V4L2_EXT_CAPTURE_MODE_MAIN;
-			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)
-{
-	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);
-	}
-	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_v4l2_dev_inst *pcam_inst = pref_pcam_inst;
-	unsigned long flags = 0;
-	struct videobuf2_contig_pmem *mem;
-	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__);
-		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 || !pcam_inst->streamon) {
-		pr_err("%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;
-
-		buf_idx = buf->vidbuf.v4l2_buf.index;
-		if (pcam_inst->vid_fmt.type ==
-				V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
-			free_buf->num_planes =
-				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 =
-					mem->offset.data_offset;
-				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 +
-				plane_offset;
-
-			}
-		} 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;
-			free_buf->ch_paddr[1] =	free_buf->ch_paddr[0] +
-				mem->offset.sp_off.cbcr_off;
-		}
-		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]);
-		rc = 0;
-		break;
-	}
-	if (rc != 0)
-		D("%s:No free buffer available: inst = 0x%p ",
-				__func__, pcam_inst);
-	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)
-{
-	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",
-			__func__);
-		return rc;
-	}
-
-	spin_lock_irqsave(&pcam_inst->vq_irqlock, flags);
-	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 Return buffer %d and mark it as QUEUED\n",
-				__func__, buf->vidbuf.v4l2_buf.index);
-			buf->state = MSM_BUFFER_STATE_QUEUED;
-			rc = 0;
-			break;
-		}
-	}
-	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)
-{
-	struct msm_cam_v4l2_dev_inst *pcam_inst = NULL;
-	int rc = 0, idx;
-	struct msm_cam_timestamp cam_ts;
-
-	if (!pmctl || !buf_handle || !ret_frame) {
-		pr_err("%s Invalid argument ", __func__);
-		return -EINVAL;
-	}
-
-	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 (!pcam_inst) {
-		pr_err("%s Invalid instance, cannot send buf to user",
-			__func__);
-		return -EINVAL;
-	}
-
-	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)
-		/* the frame is dirty, not going to disptach to app */
-		rc = msm_mctl_release_free_buf(pmctl, pcam_inst, frame);
-	else
-		rc = msm_mctl_buf_done_proc(pmctl, pcam_inst, frame,
-			NULL, &cam_ts);
-	return rc;
-}
-
-int msm_mctl_buf_return_buf(struct msm_cam_media_controller *pmctl,
-			int image_mode, struct msm_frame_buffer *rbuf)
-{
-	int idx = 0;
-	struct msm_frame_buffer *buf = NULL;
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	struct msm_cam_v4l2_device *pcam = pmctl->pcam_ptr;
-	unsigned long flags = 0;
-
-	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 {
-		pr_err("%s Invalid image mode %d ", __func__, image_mode);
-		return -EINVAL;
-	}
-
-	if (!pcam_inst) {
-		pr_err("%s Invalid instance\n", __func__);
-		return -EINVAL;
-	}
-
-	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 (rbuf == buf) {
-				D("%s Return buffer %x in pcam_inst %p ",
-				__func__, (int)rbuf, pcam_inst);
-				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 -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;
-}
-#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/platform/msm/camera_v1/msm_mctl_pp.c b/drivers/media/platform/msm/camera_v1/msm_mctl_pp.c
deleted file mode 100644
index ae3ce63..0000000
--- a/drivers/media/platform/msm/camera_v1/msm_mctl_pp.c
+++ /dev/null
@@ -1,738 +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 <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 "msm.h"
-#include "msm_vpe.h"
-
-#ifdef CONFIG_MSM_CAMERA_DEBUG
-#define D(fmt, args...) pr_debug("msm_mctl: " fmt, ##args)
-#else
-#define D(fmt, args...) do {} while (0)
-#endif
-
-static int msm_mctl_pp_buf_divert(
-			struct msm_cam_media_controller *pmctl,
-			struct msm_cam_v4l2_dev_inst *pcam_inst,
-			struct msm_cam_evt_divert_frame *div)
-{
-	struct v4l2_event v4l2_evt;
-	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. return", __func__);
-		return -ENOMEM;
-	}
-	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__,
-		pcam_inst, pcam_inst->image_mode, div->frame.frame_id);
-	v4l2_event_queue(
-		pmctl->config_device->config_stat_event_queue.pvdev,
-		&v4l2_evt);
-	return 0;
-}
-
-int msm_mctl_check_pp(struct msm_cam_media_controller *p_mctl,
-	int image_mode, int *pp_divert_type, int *pp_type)
-{
-	int rc = 0;
-	unsigned long flags;
-	uint32_t pp_key = 0;
-
-	*pp_type = 0;
-	*pp_divert_type = 0;
-	spin_lock_irqsave(&p_mctl->pp_info.lock, flags);
-	switch (image_mode) {
-	case MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW:
-		pp_key = PP_PREV;
-		if (p_mctl->pp_info.pp_key & pp_key)
-			*pp_divert_type = OUTPUT_TYPE_P;
-		if (p_mctl->pp_info.pp_ctrl.pp_msg_type & OUTPUT_TYPE_P)
-			*pp_type = OUTPUT_TYPE_P;
-		break;
-	case MSM_V4L2_EXT_CAPTURE_MODE_MAIN:
-		pp_key = PP_SNAP;
-		if (p_mctl->pp_info.pp_key & pp_key)
-			*pp_divert_type = OUTPUT_TYPE_S;
-		if (p_mctl->pp_info.pp_ctrl.pp_msg_type & OUTPUT_TYPE_S)
-			*pp_type = OUTPUT_TYPE_P;
-		break;
-	case MSM_V4L2_EXT_CAPTURE_MODE_VIDEO:
-		if (p_mctl->pp_info.pp_ctrl.pp_msg_type == OUTPUT_TYPE_V)
-			*pp_type = OUTPUT_TYPE_V;
-		break;
-	case MSM_V4L2_EXT_CAPTURE_MODE_THUMBNAIL:
-		pp_key = PP_THUMB;
-		if (p_mctl->pp_info.pp_key & pp_key)
-			*pp_divert_type = OUTPUT_TYPE_T;
-		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;
-	default:
-		break;
-	}
-	if (p_mctl->vfe_output_mode != VFE_OUTPUTS_MAIN_AND_THUMB &&
-		p_mctl->vfe_output_mode != VFE_OUTPUTS_THUMB_AND_MAIN) {
-		if (p_mctl->pp_info.div_frame[image_mode].ch_paddr[0])
-			*pp_divert_type = 0;
-	}
-	spin_unlock_irqrestore(&p_mctl->pp_info.lock, flags);
-	D("%s: pp_type=%d, pp_divert_type = %d",
-	__func__, *pp_type, *pp_divert_type);
-	return rc;
-}
-
-static int is_buf_in_queue(struct msm_cam_v4l2_device *pcam,
-	struct msm_free_buf *fbuf, int image_mode)
-{
-	struct msm_frame_buffer *buf = NULL, *tmp;
-	struct msm_cam_v4l2_dev_inst *pcam_inst = NULL;
-	unsigned long flags = 0;
-	struct videobuf2_contig_pmem *mem;
-	uint32_t buf_idx, offset = 0;
-	uint32_t buf_phyaddr = 0;
-	int idx;
-	idx = pcam->mctl_node.dev_inst_map[image_mode]->my_index;
-	pcam_inst = pcam->mctl_node.dev_inst[idx];
-	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 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;
-		else
-			offset = mem->offset.sp_off.y_off;
-		buf_phyaddr = (unsigned long)
-			videobuf2_to_pmem_contig(&buf->vidbuf, 0) +
-			offset;
-		D("%s vb_idx=%d,vb_paddr=0x%x ch0=0x%x\n",
-		  __func__, buf->vidbuf.v4l2_buf.index,
-		  buf_phyaddr, fbuf->ch_paddr[0]);
-		if (fbuf->ch_paddr[0] == buf_phyaddr) {
-			spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
-			return 1;
-		}
-	}
-	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_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 {
-			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 {
-			pr_err("%s Invalid image mode %d. Return NULL\n",
-				__func__, buf_handle->image_mode);
-		}
-	} else {
-		pr_err("%s Invalid buffer lookup type ", __func__);
-	}
-	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,
-	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 */
-	struct msm_cam_evt_divert_frame div;
-	struct msm_frame_buffer *vb = NULL;
-	struct videobuf2_contig_pmem *mem;
-	uint32_t image_mode;
-
-	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);
-	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);
-	if (!vb)
-		return -EINVAL;
-
-	vb->vidbuf.v4l2_buf.sequence = frame_id;
-	buf_idx = vb->vidbuf.v4l2_buf.index;
-	D("%s Diverting frame %d %x Image mode %d\n", __func__, buf_idx,
-		(uint32_t)vb, pcam_inst->image_mode);
-	div.image_mode = pcam_inst->image_mode;
-	div.op_mode    = pcam_inst->pcam->op_mode;
-	div.inst_idx   = pcam_inst->my_index;
-	div.node_idx   = pcam_inst->pcam->vnode_id;
-	p_mctl->pp_info.cur_frame_id[pcam_inst->image_mode] = frame_id;
-	div.frame.frame_id =
-		p_mctl->pp_info.cur_frame_id[pcam_inst->image_mode];
-	div.frame.buf_idx  = buf_idx;
-	div.frame.handle = (uint32_t)vb;
-	msm_mctl_gettimeofday(&div.frame.timestamp);
-	vb->vidbuf.v4l2_buf.timestamp = div.frame.timestamp;
-	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);
-		div.frame.sp.addr_offset = mem->addr_offset;
-		div.frame.sp.y_off      = 0;
-		div.frame.sp.cbcr_off   = mem->offset.sp_off.cbcr_off;
-		div.frame.sp.fd         = (int)mem->vaddr;
-		div.frame.sp.length     = mem->size;
-		if (!pp_type)
-			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)
-				div.frame.mp[i].data_offset = 0;
-			else
-				div.frame.mp[i].data_offset =
-				pcam_inst->buf_offset[buf_idx][i].data_offset;
-			div.frame.mp[i].addr_offset =
-				mem->addr_offset;
-			div.frame.mp[i].fd = (int)mem->vaddr;
-			div.frame.mp[i].length = mem->size;
-		}
-		if (!pp_type)
-			p_mctl->pp_info.div_frame[pcam_inst->image_mode].
-			ch_paddr[0] = div.frame.mp[0].phy_addr +
-					div.frame.mp[0].data_offset;
-	}
-	rc = msm_mctl_pp_buf_divert(p_mctl, pcam_inst, &div);
-	return rc;
-}
-
-static int msm_mctl_pp_get_phy_addr(
-	struct msm_cam_v4l2_dev_inst *pcam_inst,
-	uint32_t frame_handle,
-	struct msm_pp_frame *pp_frame)
-{
-	struct msm_frame_buffer *vb = NULL;
-	struct videobuf2_contig_pmem *mem;
-	int i, buf_idx = 0;
-
-	vb = (struct msm_frame_buffer *)frame_handle;
-	buf_idx = vb->vidbuf.v4l2_buf.index;
-	memset(pp_frame, 0, sizeof(struct msm_pp_frame));
-	pp_frame->handle = (uint32_t)vb;
-	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;
-		pp_frame->sp.addr_offset = mem->addr_offset;
-		pp_frame->sp.phy_addr =
-			videobuf2_to_pmem_contig(&vb->vidbuf, 0);
-		pp_frame->sp.y_off = 0;
-		pp_frame->sp.cbcr_off = mem->offset.sp_off.cbcr_off;
-		pp_frame->sp.length = mem->size;
-		pp_frame->sp.fd = (int)mem->vaddr;
-	} else {
-		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);
-			pp_frame->mp[i].addr_offset = mem->addr_offset;
-			pp_frame->mp[i].phy_addr =
-				videobuf2_to_pmem_contig(&vb->vidbuf, i);
-			pp_frame->mp[i].data_offset =
-			pcam_inst->buf_offset[buf_idx][i].data_offset;
-			pp_frame->mp[i].fd = (int)mem->vaddr;
-			pp_frame->mp[i].length = mem->size;
-			D("%s frame id %d buffer %d plane %d phy addr 0x%x"
-				" fd %d length %d\n", __func__,
-				pp_frame->frame_id, buf_idx, i,
-				(uint32_t)pp_frame->mp[i].phy_addr,
-				pp_frame->mp[i].fd, pp_frame->mp[i].length);
-		}
-	}
-	return 0;
-}
-
-static int msm_mctl_pp_path_to_img_mode(int path)
-{
-	switch (path) {
-	case OUTPUT_TYPE_P:
-		return MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW;
-	case OUTPUT_TYPE_V:
-		return MSM_V4L2_EXT_CAPTURE_MODE_VIDEO;
-	case OUTPUT_TYPE_S:
-		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;
-	}
-}
-
-int msm_mctl_pp_proc_cmd(struct msm_cam_media_controller *p_mctl,
-			struct msm_mctl_pp_cmd *pp_cmd)
-{
-	int rc = 0;
-	unsigned long flags;
-
-	switch (pp_cmd->id) {
-	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();
-			return -EFAULT;
-		}
-		D("%s: Divert Image mode =%d Enable %d",
-			__func__, divert_pp.path, divert_pp.enable);
-		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;
-		else
-			p_mctl->pp_info.pp_ctrl.pp_msg_type &= ~divert_pp.path;
-		spin_unlock_irqrestore(&p_mctl->pp_info.lock, flags);
-		D("%s: pp path = 0x%x", __func__,
-			p_mctl->pp_info.pp_ctrl.pp_msg_type);
-		break;
-	}
-	default:
-		rc = -EPERM;
-	break;
-	}
-	return rc;
-}
-
-
-int msm_mctl_pp_ioctl(struct msm_cam_media_controller *p_mctl,
-			unsigned int cmd, unsigned long arg)
-{
-	int rc = -EINVAL;
-	struct msm_mctl_post_proc_cmd pp_cmd;
-	void __user *argp = (void __user *)arg;
-
-	if (copy_from_user(&pp_cmd, argp, sizeof(pp_cmd)))
-		return -EFAULT;
-
-	switch (pp_cmd.type) {
-	case MSM_PP_CMD_TYPE_MCTL:
-		rc = msm_mctl_pp_proc_cmd(p_mctl, &pp_cmd.cmd);
-		break;
-	default:
-		rc = -EPERM;
-		break;
-	}
-	if (!rc) {
-		/* deep copy back the return value */
-		if (copy_to_user((void *)arg,
-			&pp_cmd,
-			sizeof(struct msm_mctl_post_proc_cmd))) {
-			ERR_COPY_TO_USER();
-			rc = -EFAULT;
-		}
-	}
-	return rc;
-}
-
-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;
-	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();
-		return -EFAULT;
-	}
-
-	image_mode = div_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];
-	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);
-	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))) {
-			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,
-		pcam_inst, rc, free_buf.ch_paddr[0]);
-	return rc;
-}
-
-int msm_mctl_pp_release_free_frame(
-	struct msm_cam_media_controller *p_mctl,
-	void __user *arg)
-{
-	struct msm_cam_evt_divert_frame div_frame;
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	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();
-		return -EFAULT;
-	}
-
-	image_mode = div_frame.image_mode;
-	if (image_mode < 0) {
-		pr_err("%s Invalid image mode %d\n", __func__, image_mode);
-		return -EINVAL;
-	}
-	frame = &div_frame.frame;
-	if (frame->num_planes > 1)
-		free_buf.ch_paddr[0] = frame->mp[0].phy_addr;
-	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);
-	if (!pcam_inst) {
-		pr_err("%s Invalid instance. Cannot release frame.\n",
-			__func__);
-		return -EINVAL;
-	}
-
-	rc = msm_mctl_release_free_buf(p_mctl, pcam_inst, &free_buf);
-	D("%s: release free buf, rc = %d, phy = 0x%x",
-		__func__, rc, free_buf.ch_paddr[0]);
-
-	return rc;
-}
-
-int msm_mctl_set_pp_key(struct msm_cam_media_controller *p_mctl,
-				void __user *arg)
-{
-	int rc = 0;
-	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();
-		rc = -EFAULT;
-	} 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;
-}
-
-int msm_mctl_pp_done(
-	struct msm_cam_media_controller *p_mctl,
-	void __user *arg)
-{
-	struct msm_pp_frame frame;
-	int 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;
-
-	if (copy_from_user(&frame, arg, sizeof(frame))) {
-		ERR_COPY_FROM_USER();
-		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) {
-		pr_err("%s Invalid image mode\n", __func__);
-		return image_mode;
-	}
-	D("%s Returning frame %x id %d to kernel ", __func__,
-		(int)frame.handle, frame.frame_id);
-	if (p_mctl->pp_info.div_frame[image_mode].ch_paddr[0]) {
-		memcpy(&buf,
-			&p_mctl->pp_info.div_frame[image_mode],
-			sizeof(buf));
-		memset(&p_mctl->pp_info.div_frame[image_mode],
-			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 {
-		if (frame.num_planes > 1)
-			buf.ch_paddr[0] = frame.mp[0].phy_addr +
-						frame.mp[0].data_offset;
-		else
-			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);
-	return rc;
-}
-
-int msm_mctl_pp_divert_done(
-	struct msm_cam_media_controller *p_mctl,
-	void __user *arg)
-{
-	struct msm_pp_frame frame;
-	int rc = 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();
-		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;
-	}
-
-	if (frame.num_planes > 1)
-		buf.ch_paddr[0] = frame.mp[0].phy_addr +
-					frame.mp[0].data_offset;
-	else
-		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);
-	return rc;
-}
-
-int msm_mctl_pp_mctl_divert_done(
-	struct msm_cam_media_controller *p_mctl,
-	void __user *arg)
-{
-	struct msm_cam_evt_divert_frame div_frame;
-	struct msm_frame_buffer *buf;
-	int image_mode, rc = 0;
-
-	if (copy_from_user(&div_frame, arg,
-			sizeof(struct msm_cam_evt_divert_frame))) {
-		pr_err("%s copy from user failed ", __func__);
-		return -EFAULT;
-	}
-
-	if (!div_frame.frame.handle) {
-		pr_err("%s Invalid buffer handle ", __func__);
-		return -EINVAL;
-	}
-	image_mode = div_frame.image_mode;
-	buf = (struct msm_frame_buffer *)div_frame.frame.handle;
-	D("%s Returning buffer %x Image mode %d ", __func__,
-		(int)buf, image_mode);
-	rc = msm_mctl_buf_return_buf(p_mctl, image_mode, buf);
-	if (rc < 0)
-		pr_err("%s Error returning mctl buffer ", __func__);
-
-	return rc;
-}
diff --git a/drivers/media/platform/msm/camera_v1/msm_mem.c b/drivers/media/platform/msm/camera_v1/msm_mem.c
deleted file mode 100644
index c9a87d7..0000000
--- a/drivers/media/platform/msm/camera_v1/msm_mem.c
+++ /dev/null
@@ -1,392 +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/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 "msm.h"
-
-#ifdef CONFIG_MSM_CAMERA_DEBUG
-#define D(fmt, args...) pr_debug("msm_isp: " fmt, ##args)
-#else
-#define D(fmt, args...) do {} while (0)
-#endif
-
-#define PAD_TO_WORD(a)	  (((a) + 3) & ~3)
-
-#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 DEFINE_MUTEX(hlist_mut);
-
-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 -EINVAL;
-		}
-	}
-
-	return 0;
-}
-
-static int msm_pmem_table_add(struct hlist_head *ptype,
-	struct msm_pmem_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 = -ENOMEM;
-
-	unsigned long len;
-	struct msm_pmem_region *region;
-
-	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, info->fd);
-	if (IS_ERR_OR_NULL(region->handle))
-		goto out1;
-	if (ion_map_iommu(client, region->handle, domain_num, 0,
-				  SZ_4K, 0, &paddr, &len, 0, 0) < 0)
-		goto out2;
-#else
-	paddr = 0;
-	file = NULL;
-	kvstart = 0;
-#endif
-	if (!info->len)
-		info->len = len;
-	paddr += info->offset;
-	len = info->len;
-
-	if (check_overlap(ptype, paddr, len) < 0) {
-		rc = -EINVAL;
-		goto out3;
-	}
-
-	CDBG("%s: type %d, active flag %d, paddr 0x%lx, vaddr 0x%lx\n",
-		__func__, info->type, info->active, paddr,
-		(unsigned long)info->vaddr);
-
-	INIT_HLIST_NODE(&region->list);
-	region->paddr = paddr;
-	region->len = len;
-	memcpy(&region->info, info, sizeof(region->info));
-	D("%s Adding region to list with type %d\n", __func__,
-						region->info.type);
-	D("%s pmem_stats address is 0x%p\n", __func__, ptype);
-	hlist_add_head(&(region->list), ptype);
-
-	return 0;
-out3:
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	ion_unmap_iommu(client, region->handle, domain_num, 0);
-#endif
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-out2:
-	ion_free(client, region->handle);
-#endif
-out1:
-	kfree(region);
-out:
-	return rc;
-}
-
-static int __msm_register_pmem(struct hlist_head *ptype,
-			struct msm_pmem_info *pinfo, struct ion_client *client,
-			int domain_num)
-{
-	int rc = 0;
-
-	switch (pinfo->type) {
-	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:
-	case MSM_PMEM_AEC_AWB:
-	case MSM_PMEM_BAYER_GRID:
-	case MSM_PMEM_BAYER_EXPOSURE:
-	case MSM_PMEM_BAYER_FOCUS:
-	case MSM_PMEM_BAYER_HIST:
-		rc = msm_pmem_table_add(ptype, pinfo, client, domain_num);
-		break;
-
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	return rc;
-}
-
-static int __msm_pmem_table_del(struct hlist_head *ptype,
-			struct msm_pmem_info *pinfo, struct ion_client *client,
-			int domain_num)
-{
-	int rc = 0;
-	struct msm_pmem_region *region;
-	struct hlist_node *node, *n;
-
-	switch (pinfo->type) {
-	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:
-	case MSM_PMEM_AEC_AWB:
-	case MSM_PMEM_BAYER_GRID:
-	case MSM_PMEM_BAYER_EXPOSURE:
-	case MSM_PMEM_BAYER_FOCUS:
-	case MSM_PMEM_BAYER_HIST:
-		hlist_for_each_entry_safe(region, node, n,
-				ptype, 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_unmap_iommu(client, region->handle,
-					domain_num, 0);
-				ion_free(client, region->handle);
-#endif
-				kfree(region);
-			}
-		}
-		break;
-
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	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)
-{
-	struct msm_pmem_region *region;
-	struct msm_pmem_region *regptr;
-	struct hlist_node *node, *n;
-
-	uint8_t rc = 0;
-	D("%s\n", __func__);
-	regptr = reg;
-	mutex_lock(&hlist_mut);
-	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++;
-		}
-	}
-	D("%s finished, rc=%d\n", __func__, rc);
-	mutex_unlock(&hlist_mut);
-	return rc;
-}
-
-int msm_pmem_region_get_phy_addr(struct hlist_head *ptype,
-	struct msm_mem_map_info *mem_map, int32_t *phyaddr)
-{
-	struct msm_pmem_region *region;
-	struct hlist_node *node, *n;
-	int pmem_type = mem_map->mem_type;
-	int rc = -EFAULT;
-
-	D("%s\n", __func__);
-	*phyaddr = 0;
-	mutex_lock(&hlist_mut);
-	hlist_for_each_entry_safe(region, node, n, ptype, list) {
-		if (region->info.type == pmem_type &&
-			(uint32_t)region->info.vaddr == mem_map->cookie) {
-			*phyaddr = (int32_t)region->paddr;
-			rc = 0;
-			break;
-		}
-	}
-	D("%s finished, phy_addr = 0x%x, rc=%d\n", __func__, *phyaddr, rc);
-	mutex_unlock(&hlist_mut);
-	return rc;
-}
-
-uint8_t msm_pmem_region_lookup_2(struct hlist_head *ptype,
-					int pmem_type,
-					struct msm_pmem_region *reg,
-					uint8_t maxcount)
-{
-	struct msm_pmem_region *region;
-	struct msm_pmem_region *regptr;
-	struct hlist_node *node, *n;
-	uint8_t rc = 0;
-	regptr = reg;
-	mutex_lock(&hlist_mut);
-	hlist_for_each_entry_safe(region, node, n, ptype, list) {
-		D("Mio: info.type=%d, pmem_type = %d,"
-						"info.active = %d\n",
-		region->info.type, pmem_type, region->info.active);
-
-		if (region->info.type == pmem_type && region->info.active) {
-			D("info.type=%d, pmem_type = %d,"
-							"info.active = %d,\n",
-				region->info.type, pmem_type,
-				region->info.active);
-			*regptr = *region;
-			region->info.type = MSM_PMEM_VIDEO;
-			rc += 1;
-			if (rc >= maxcount)
-				break;
-			regptr++;
-		}
-	}
-	mutex_unlock(&hlist_mut);
-	return rc;
-}
-
-unsigned long msm_pmem_stats_vtop_lookup(
-				struct msm_cam_media_controller *mctl,
-				unsigned long buffer,
-				int fd)
-{
-	struct msm_pmem_region *region;
-	struct hlist_node *node, *n;
-
-	hlist_for_each_entry_safe(region, node, n,
-	&mctl->stats_info.pmem_stats_list, list) {
-		if (((unsigned long)(region->info.vaddr) == buffer) &&
-						(region->info.fd == fd) &&
-						region->info.active == 0) {
-			region->info.active = 1;
-			return region->paddr;
-		}
-	}
-
-	return 0;
-}
-
-unsigned long msm_pmem_stats_ptov_lookup(
-		struct msm_cam_media_controller *mctl,
-		unsigned long addr, int *fd)
-{
-	struct msm_pmem_region *region;
-	struct hlist_node *node, *n;
-
-	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);
-		}
-	}
-
-	return 0;
-}
-
-int msm_register_pmem(struct hlist_head *ptype, void __user *arg,
-					struct ion_client *client,
-					int domain_num)
-{
-	struct msm_pmem_info info;
-
-	if (copy_from_user(&info, arg, sizeof(info))) {
-		ERR_COPY_FROM_USER();
-			return -EFAULT;
-	}
-
-	return __msm_register_pmem(ptype, &info, client, domain_num);
-}
-//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 msm_pmem_info info;
-
-	if (copy_from_user(&info, arg, sizeof(info))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	return __msm_pmem_table_del(ptype, &info, client, domain_num);
-}
-//EXPORT_SYMBOL(msm_pmem_table_del);
diff --git a/drivers/media/platform/msm/camera_v1/msm_v4l2_video.c b/drivers/media/platform/msm/camera_v1/msm_v4l2_video.c
deleted file mode 100644
index 23e74ef..0000000
--- a/drivers/media/platform/msm/camera_v1/msm_v4l2_video.c
+++ /dev/null
@@ -1,973 +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/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_CBCR_H2V2;
-		break;
-	case V4L2_PIX_FMT_NV21:
-		mdp_format = MDP_Y_CRCB_H2V2;
-		break;
-	case V4L2_PIX_FMT_YUV420:
-		mdp_format = MDP_Y_CB_CR_H2V2;
-		break;
-	case V4L2_PIX_FMT_UYVY:
-		mdp_format = MDP_CBYCRY_H2V1;
-		break;
-	case V4L2_PIX_FMT_YUYV:
-		mdp_format = MDP_YCBYCR_H2V1;
-		break;
-	case V4L2_PIX_FMT_YVU420:
-		mdp_format = MDP_Y_CR_CB_GH2V2;
-		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, false, 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))) {
-			pr_err("%s:copy_from_user for userptr failed\n",
-				__func__);
-			mutex_unlock(&msmfb_lock);
-			return -EINVAL;
-		}
-		ret = msm_fb_v4l2_update(vout->par, true,
-		(unsigned long)up_buffer.fd[0], up_buffer.offset[0],
-		(unsigned long)up_buffer.fd[1], up_buffer.offset[1],
-		(unsigned long)up_buffer.fd[2], up_buffer.offset[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;
-	struct v4l2_buffer *buffer = arg;
-
-	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);
-		if (buffer->memory == V4L2_MEMORY_USERPTR) {
-			if (!capable(CAP_SYS_RAWIO))
-				return -EPERM;
-			ret = msm_v4l2_overlay_vidioc_qbuf(file, fh, arg, true);
-		} else {
-			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);
-
-	if (!start)
-		return -EINVAL;
-
-	/*
-	 * 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;
-
-	if ((vma->vm_end <= vma->vm_start) ||
-	    (off >= len) ||
-	    ((vma->vm_end - vma->vm_start) > (len - off))) {
-		pr_err("v4l2 map request, memory requested out of bounds\n");
-		return -EINVAL;
-	}
-
-	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);
-
-	start += off;
-	if (start < off)
-		return -EINVAL;
-	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/platform/msm/camera_v1/msm_v4l2_video.h b/drivers/media/platform/msm/camera_v1/msm_v4l2_video.h
deleted file mode 100644
index 6de6c80..0000000
--- a/drivers/media/platform/msm/camera_v1/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 fd[3]; /* ION fd of frame or plane */
-	size_t offset[3]; /* offset of frame or plane in multi buffer case */
-};
-
-#endif
diff --git a/drivers/media/platform/msm/camera_v1/msm_vpe.c b/drivers/media/platform/msm/camera_v1/msm_vpe.c
deleted file mode 100644
index ea1c819..0000000
--- a/drivers/media/platform/msm/camera_v1/msm_vpe.c
+++ /dev/null
@@ -1,1146 +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 <mach/irqs.h>
-#include <linux/io.h>
-#include <linux/slab.h>
-#include <linux/regulator/consumer.h>
-#include <linux/clk.h>
-#include <mach/clk.h>
-#include <asm/div64.h>
-#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 "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_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 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_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);
-	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__,
-		 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_ctrl->vpebase + VPE_OUTP0_ADDR_OFFSET);
-	/* for video  CbCr address */
-	msm_camera_io_w(vpe_ctrl->out_cbcr_addr,
-		vpe_ctrl->vpebase + VPE_OUTP1_ADDR_OFFSET);
-}
-
-static int vpe_reset(void)
-{
-	uint32_t vpe_version;
-	uint32_t rc = 0;
-	unsigned long flags = 0;
-
-	spin_lock_irqsave(&vpe_ctrl->lock, flags);
-	if (vpe_ctrl->state == VPE_STATE_IDLE) {
-		D("%s: VPE already disabled.", __func__);
-		spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
-		return rc;
-	}
-	spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
-
-	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. */
-	while (1) {
-		rc =
-		msm_camera_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,
-			vpe_ctrl->vpebase + VPE_AXI_RD_ARB_CONFIG_OFFSET);
-
-	msm_camera_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,
-			vpe_ctrl->vpebase + VPE_OP_MODE_OFFSET);
-	msm_camera_io_w(VPE_DEFAULT_SCALE_CONFIG,
-			vpe_ctrl->vpebase + VPE_SCALE_CONFIG_OFFSET);
-	vpe_config_axi_default();
-	return rc;
-}
-
-static int msm_vpe_cfg_update(void *pinfo)
-{
-	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 +
-						VPE_OP_MODE_OFFSET) & 0xE00;
-	if (pinfo != NULL) {
-		D("%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);
-	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_ctrl->vpebase + VPE_SCALE_COEFF_LSBn(i));
-		msm_camera_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);
-}
-
-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);
-}
-
-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);
-
-	temp = msm_camera_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,
-		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;
-	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;
-
-	/* 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);
-
-	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",
-		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);
-
-	src_x = pcrop->src_x;
-	src_y = pcrop->src_y;
-
-	D("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 +
-			VPE_SRC_XY_OFFSET);
-	D("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;
-
-	D("phase step x = %d, step y = %d.\n",
-		 phase_step_x, phase_step_y);
-	D("phase init x = %d, init y = %d.\n",
-		 phase_init_x, phase_init_y);
-
-	msm_camera_io_w(phase_step_x, vpe_ctrl->vpebase +
-			VPE_SCALE_PHASEX_STEP_OFFSET);
-	msm_camera_io_w(phase_step_y, vpe_ctrl->vpebase +
-			VPE_SCALE_PHASEY_STEP_OFFSET);
-
-	msm_camera_io_w(phase_init_x, vpe_ctrl->vpebase +
-			VPE_SCALE_PHASEX_INIT_OFFSET);
-
-	msm_camera_io_w(phase_init_y, vpe_ctrl->vpebase +
-			VPE_SCALE_PHASEY_INIT_OFFSET);
-
-	return 1;
-}
-
-int msm_vpe_is_busy(void)
-{
-	int busy = 0;
-	unsigned long flags;
-	spin_lock_irqsave(&vpe_ctrl->lock, flags);
-	if (vpe_ctrl->state == VPE_STATE_ACTIVE)
-		busy = 1;
-	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);
-
-	vpe_ctrl->state = VPE_STATE_ACTIVE;
-	spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
-	vpe_start();
-	return rc;
-}
-
-static void vpe_send_outmsg(void)
-{
-	unsigned long flags;
-	struct v4l2_event v4l2_evt;
-	struct msm_queue_cmd *event_qcmd;
-	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;
-	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);
-	spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
-}
-
-static void vpe_do_tasklet(unsigned long data)
-{
-	D("%s: irq_status = 0x%x",
-		   __func__, vpe_ctrl->irq_status);
-	if (vpe_ctrl->irq_status & 0x1)
-		vpe_send_outmsg();
-
-}
-DECLARE_TASKLET(vpe_tasklet, vpe_do_tasklet, 0);
-
-static irqreturn_t vpe_parse_irq(int irq_num, void *data)
-{
-	vpe_ctrl->irq_status = msm_camera_io_r_mb(vpe_ctrl->vpebase +
-							VPE_INTR_STATUS_OFFSET);
-	msm_camera_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);
-	tasklet_schedule(&vpe_tasklet);
-	return IRQ_HANDLED;
-}
-
-static struct msm_cam_clk_info vpe_clk_info[] = {
-	{"vpe_clk", 160000000},
-	{"vpe_pclk", -1},
-};
-
-int vpe_enable(uint32_t clk_rate, struct msm_cam_media_controller *mctl)
-{
-	int rc = 0;
-	unsigned long flags = 0;
-	D("%s", __func__);
-	/* don't change the order of clock and irq.*/
-	spin_lock_irqsave(&vpe_ctrl->lock, flags);
-	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;
-	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;
-		}
-	}
-
-	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)
-		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);
-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 rc = 0;
-	unsigned long flags = 0;
-	D("%s", __func__);
-	spin_lock_irqsave(&vpe_ctrl->lock, flags);
-	if (vpe_ctrl->state == VPE_STATE_IDLE) {
-		D("%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
-	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);
-	spin_lock_irqsave(&vpe_ctrl->lock, flags);
-	vpe_ctrl->state = VPE_STATE_IDLE;
-	spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
-	return rc;
-}
-
-static int msm_vpe_do_pp(struct msm_mctl_pp_frame_info *pp_frame_info)
-{
-	int rc = 0;
-	unsigned long flags;
-
-	spin_lock_irqsave(&vpe_ctrl->lock, flags);
-	if (vpe_ctrl->state == VPE_STATE_ACTIVE ||
-		 vpe_ctrl->state == VPE_STATE_IDLE) {
-		spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
-		pr_err(" =====VPE in wrong state:%d!!!  Wrong!========\n",
-		vpe_ctrl->state);
-		return -EBUSY;
-	}
-	spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
-	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);
-	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 rc = 0;
-	struct msm_cam_media_controller *mctl;
-	mctl = v4l2_get_subdev_hostdata(sd);
-	D("%s:begin", __func__);
-	if (atomic_read(&vpe_init_done)) {
-		pr_err("%s: VPE has been initialized", __func__);
-		return -EBUSY;
-	}
-	atomic_set(&vpe_init_done, 1);
-
-	rc = msm_vpe_resource_init();
-	if (rc < 0) {
-		atomic_set(&vpe_init_done, 0);
-		return rc;
-	}
-	spin_lock_init(&vpe_ctrl->lock);
-	D("%s:end", __func__);
-	return rc;
-}
-EXPORT_SYMBOL(msm_vpe_subdev_init);
-
-static int msm_vpe_resource_init(void)
-{
-	int rc = 0;
-
-	vpe_ctrl->vpebase = ioremap(vpe_ctrl->vpemem->start,
-		resource_size(vpe_ctrl->vpemem));
-
-	if (!vpe_ctrl->vpebase) {
-		rc = -ENOMEM;
-		pr_err("%s: vpe ioremap failed\n", __func__);
-		goto vpe_unmap_mem_region;
-	}
-
-	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. */
-}
-
-void msm_vpe_subdev_release(struct v4l2_subdev *sd)
-{
-	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);
-	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)
-{
-	struct msm_vpe_cfg_cmd *vpe_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);
-			break;
-		}
-		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;
-		}
-		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;
-	}
-	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 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);
-	}
-	/* 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)
-{
-	int rc = 0;
-	struct msm_cam_subdev_info sd_info;
-
-	D("%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__);
-		return -ENOMEM;
-	}
-
-	v4l2_subdev_init(&vpe_ctrl->subdev, &msm_vpe_subdev_ops);
-	v4l2_set_subdevdata(&vpe_ctrl->subdev, vpe_ctrl);
-	vpe_ctrl->subdev.internal_ops = &msm_vpe_internal_ops;
-	vpe_ctrl->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	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) {
-		pr_err("%s: no mem resource?\n", __func__);
-		rc = -ENODEV;
-		goto vpe_no_resource;
-	}
-	vpe_ctrl->vpeirq = platform_get_resource_byname(pdev,
-					IORESOURCE_IRQ, "vpe");
-	if (!vpe_ctrl->vpeirq) {
-		pr_err("%s: no irq resource?\n", __func__);
-		rc = -ENODEV;
-		goto vpe_no_resource;
-	}
-
-	vpe_ctrl->vpeio = request_mem_region(vpe_ctrl->vpemem->start,
-		resource_size(vpe_ctrl->vpemem), pdev->name);
-	if (!vpe_ctrl->vpeio) {
-		pr_err("%s: no valid mem region\n", __func__);
-		rc = -EBUSY;
-		goto vpe_no_resource;
-	}
-
-	rc = request_irq(vpe_ctrl->vpeirq->start, vpe_parse_irq,
-		IRQF_TRIGGER_RISING, "vpe", 0);
-	if (rc < 0) {
-		release_mem_region(vpe_ctrl->vpemem->start,
-			resource_size(vpe_ctrl->vpemem));
-		pr_err("%s: irq request fail\n", __func__);
-		rc = -EBUSY;
-		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
-
-	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");
-
-	return 0;
-
-vpe_no_resource:
-	pr_err("%s: VPE Probe failed.\n", __func__);
-	kfree(vpe_ctrl);
-	return rc;
-}
-
-struct platform_driver msm_vpe_driver = {
-	.probe = msm_vpe_probe,
-	.driver = {
-		.name = MSM_VPE_DRV_NAME,
-		.owner = THIS_MODULE,
-	},
-};
-
-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);
-}
-
-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/platform/msm/camera_v1/msm_vpe.h b/drivers/media/platform/msm/camera_v1/msm_vpe.h
deleted file mode 100644
index 6b89bf0..0000000
--- a/drivers/media/platform/msm/camera_v1/msm_vpe.h
+++ /dev/null
@@ -1,186 +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_VPE_H_
-#define _MSM_VPE_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_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_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
-#define VPE_SUBDEV_MAX_EVENTS        30
-
-/**************************************************/
-/*********** End of command id ********************/
-/**************************************************/
-
-enum vpe_state {
-	VPE_STATE_IDLE,
-	VPE_STATE_INIT,
-	VPE_STATE_ACTIVE,
-};
-
-struct vpe_ctrl_type {
-	spinlock_t        lock;
-	uint32_t          irq_status;
-	void              *syncdata;
-	uint16_t          op_mode;
-	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. */
-	struct timespec   ts;
-	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;
-	struct v4l2_subdev subdev;
-	struct platform_device *pdev;
-	struct resource   *vpeirq;
-	void __iomem      *vpebase;
-	struct resource	  *vpemem;
-	struct resource   *vpeio;
-	void        *device_extdata;
-	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;
-};
-
-/*
-* 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;
-	/* crop 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  yBuffer;
-	uint32_t  cbcrBuffer;
-	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;
-};
-
-#endif /*_MSM_VPE_H_*/
-
diff --git a/drivers/media/platform/msm/camera_v1/msm_vpe1.c b/drivers/media/platform/msm/camera_v1/msm_vpe1.c
deleted file mode 100644
index 948f7ac..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/msm_vpe1.h b/drivers/media/platform/msm/camera_v1/msm_vpe1.h
deleted file mode 100644
index 5fd7a4a..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9d112.c b/drivers/media/platform/msm/camera_v1/mt9d112.c
deleted file mode 100644
index 9c19965..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9d112.h b/drivers/media/platform/msm/camera_v1/mt9d112.h
deleted file mode 100644
index f07d732..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9d112_reg.c b/drivers/media/platform/msm/camera_v1/mt9d112_reg.c
deleted file mode 100644
index 6c35cbc..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9d113.c b/drivers/media/platform/msm/camera_v1/mt9d113.c
deleted file mode 100644
index a32c804..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9d113.h b/drivers/media/platform/msm/camera_v1/mt9d113.h
deleted file mode 100644
index 4aedc5e..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9d113_reg.c b/drivers/media/platform/msm/camera_v1/mt9d113_reg.c
deleted file mode 100644
index 28ff518..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9e013.c b/drivers/media/platform/msm/camera_v1/mt9e013.c
deleted file mode 100644
index f91bec4..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9e013.h b/drivers/media/platform/msm/camera_v1/mt9e013.h
deleted file mode 100644
index 6f43ec4..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9e013_reg.c b/drivers/media/platform/msm/camera_v1/mt9e013_reg.c
deleted file mode 100644
index bdcf3f8..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9p012.h b/drivers/media/platform/msm/camera_v1/mt9p012.h
deleted file mode 100644
index a30b2f1..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9p012_bam.c b/drivers/media/platform/msm/camera_v1/mt9p012_bam.c
deleted file mode 100644
index 9363893..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9p012_fox.c b/drivers/media/platform/msm/camera_v1/mt9p012_fox.c
deleted file mode 100644
index a8d90c1..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9p012_km.c b/drivers/media/platform/msm/camera_v1/mt9p012_km.c
deleted file mode 100644
index 959023b..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9p012_km.h b/drivers/media/platform/msm/camera_v1/mt9p012_km.h
deleted file mode 100644
index d386474..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9p012_km_reg.c b/drivers/media/platform/msm/camera_v1/mt9p012_km_reg.c
deleted file mode 100644
index 5c6318f..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9p012_reg.c b/drivers/media/platform/msm/camera_v1/mt9p012_reg.c
deleted file mode 100644
index b828852..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9t013.c b/drivers/media/platform/msm/camera_v1/mt9t013.c
deleted file mode 100644
index e107930..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9t013.h b/drivers/media/platform/msm/camera_v1/mt9t013.h
deleted file mode 100644
index e2d0c23..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/mt9t013_reg.c b/drivers/media/platform/msm/camera_v1/mt9t013_reg.c
deleted file mode 100644
index 9031441..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/ov5640.c b/drivers/media/platform/msm/camera_v1/ov5640.c
deleted file mode 100644
index 8441a46..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/ov5640.h b/drivers/media/platform/msm/camera_v1/ov5640.h
deleted file mode 100644
index a428da6..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/ov5647.c b/drivers/media/platform/msm/camera_v1/ov5647.c
deleted file mode 100644
index 365faef..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/ov5647.h b/drivers/media/platform/msm/camera_v1/ov5647.h
deleted file mode 100644
index 0015d63..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/ov5647_reg.c b/drivers/media/platform/msm/camera_v1/ov5647_reg.c
deleted file mode 100644
index c9709bf..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/ov7692.c b/drivers/media/platform/msm/camera_v1/ov7692.c
deleted file mode 100644
index 252d42c..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/ov7692.h b/drivers/media/platform/msm/camera_v1/ov7692.h
deleted file mode 100644
index da98284..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/ov7692_qrd.c b/drivers/media/platform/msm/camera_v1/ov7692_qrd.c
deleted file mode 100644
index 05a82ab..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/ov9726.c b/drivers/media/platform/msm/camera_v1/ov9726.c
deleted file mode 100644
index 96a084c..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/ov9726.h b/drivers/media/platform/msm/camera_v1/ov9726.h
deleted file mode 100644
index 40ba1a8..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/ov9726_reg.c b/drivers/media/platform/msm/camera_v1/ov9726_reg.c
deleted file mode 100644
index 216ecca..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/qs_s5k4e1.c b/drivers/media/platform/msm/camera_v1/qs_s5k4e1.c
deleted file mode 100644
index 32d094d..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/qs_s5k4e1.h b/drivers/media/platform/msm/camera_v1/qs_s5k4e1.h
deleted file mode 100644
index dca3d0a..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/qs_s5k4e1_reg.c b/drivers/media/platform/msm/camera_v1/qs_s5k4e1_reg.c
deleted file mode 100644
index b872343..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/s5k3e2fx.c b/drivers/media/platform/msm/camera_v1/s5k3e2fx.c
deleted file mode 100644
index f7591d9..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/s5k3e2fx.h b/drivers/media/platform/msm/camera_v1/s5k3e2fx.h
deleted file mode 100644
index 3cf4f8e..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/s5k4e1.c b/drivers/media/platform/msm/camera_v1/s5k4e1.c
deleted file mode 100644
index c62103e..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/s5k4e1.h b/drivers/media/platform/msm/camera_v1/s5k4e1.h
deleted file mode 100644
index d58b3f0..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/s5k4e1_reg.c b/drivers/media/platform/msm/camera_v1/s5k4e1_reg.c
deleted file mode 100644
index 679ef17..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/sensors/Makefile b/drivers/media/platform/msm/camera_v1/sensors/Makefile
deleted file mode 100644
index 174e9ba..0000000
--- a/drivers/media/platform/msm/camera_v1/sensors/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1
-EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/io
-EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/eeprom
-EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/csi
-obj-$(CONFIG_MSM_CAMERA_SENSOR) += msm_sensor_common.o msm_sensor.o msm_sensor_bayer.o msm_sensor_init.o
-obj-$(CONFIG_OV5647) += ov5647_v4l2.o
-obj-$(CONFIG_OV8825) += ov8825_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
diff --git a/drivers/media/platform/msm/camera_v1/sensors/imx074_v4l2.c b/drivers/media/platform/msm/camera_v1/sensors/imx074_v4l2.c
deleted file mode 100644
index f0759a8..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/sensors/imx091.h b/drivers/media/platform/msm/camera_v1/sensors/imx091.h
deleted file mode 100644
index a909138..0000000
--- a/drivers/media/platform/msm/camera_v1/sensors/imx091.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.
- *
- */
-#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,
-	.sensor_read_eeprom = msm_sensor_bayer_eeprom_read,
-};
-
-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/platform/msm/camera_v1/sensors/imx135_v4l2.c b/drivers/media/platform/msm/camera_v1/sensors/imx135_v4l2.c
deleted file mode 100644
index 98e2999..0000000
--- a/drivers/media/platform/msm/camera_v1/sensors/imx135_v4l2.c
+++ /dev/null
@@ -1,1289 +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 "imx135"
-#define PLATFORM_DRIVER_NAME "msm_camera_imx135"
-#define imx135_obj imx135_##obj
-
-DEFINE_MUTEX(imx135_mut);
-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, 0x06},
-	{0x0341, 0x2E},
-	{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 = 3290,
-		.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 = 1582,
-		.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)
-{
-	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 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,
-};
-
-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/platform/msm/camera_v1/sensors/msm_sensor.c b/drivers/media/platform/msm/camera_v1/sensors/msm_sensor.c
deleted file mode 100644
index 3df963a..0000000
--- a/drivers/media/platform/msm/camera_v1/sensors/msm_sensor.c
+++ /dev/null
@@ -1,1975 +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 <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)
-{
-	uint16_t cur_line = 0;
-	uint16_t exp_fl_lines = 0;
-	if (s_ctrl->sensor_exp_gain_info) {
-		msm_camera_i2c_read(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
-			&cur_line,
-			MSM_CAMERA_I2C_WORD_DATA);
-		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)
-			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_fl_lines %d, exp_fl_lines %d\n", __func__,
-			s_ctrl->msm_sensor_reg->
-			output_settings[s_ctrl->curr_res].frame_length_lines,
-			exp_fl_lines);
-	}
-	return;
-}
-
-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];
-	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 > s_ctrl->msm_sensor_reg->
-			output_settings[s_ctrl->curr_res].frame_length_lines)
-			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;
-	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;
-}
-
-int32_t msm_sensor_write_res_settings(struct msm_sensor_ctrl_t *s_ctrl,
-	uint16_t res)
-{
-	int32_t rc;
-	rc = msm_sensor_write_conf_array(
-		s_ctrl->sensor_i2c_client,
-		s_ctrl->msm_sensor_reg->mode_settings, res);
-	if (rc < 0)
-		return rc;
-
-	rc = msm_sensor_write_output_settings(s_ctrl, res);
-	if (rc < 0)
-		return rc;
-
-	return rc;
-}
-
-int32_t msm_sensor_write_output_settings(struct msm_sensor_ctrl_t *s_ctrl,
-	uint16_t res)
-{
-	int32_t rc = -EFAULT;
-	struct msm_camera_i2c_reg_conf dim_settings[] = {
-		{s_ctrl->sensor_output_reg_addr->x_output,
-			s_ctrl->msm_sensor_reg->
-			output_settings[res].x_output},
-		{s_ctrl->sensor_output_reg_addr->y_output,
-			s_ctrl->msm_sensor_reg->
-			output_settings[res].y_output},
-		{s_ctrl->sensor_output_reg_addr->line_length_pclk,
-			s_ctrl->msm_sensor_reg->
-			output_settings[res].line_length_pclk},
-		{s_ctrl->sensor_output_reg_addr->frame_length_lines,
-			s_ctrl->msm_sensor_reg->
-			output_settings[res].frame_length_lines},
-	};
-
-	rc = msm_camera_i2c_write_tbl(s_ctrl->sensor_i2c_client, dim_settings,
-		ARRAY_SIZE(dim_settings), MSM_CAMERA_I2C_WORD_DATA);
-	return rc;
-}
-
-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->func_tbl->sensor_adjust_frame_lines(s_ctrl);
-
-	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)
-{
-	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)
-{
-	msm_camera_i2c_write_tbl(
-		s_ctrl->sensor_i2c_client,
-		s_ctrl->msm_sensor_reg->group_hold_on_conf,
-		s_ctrl->msm_sensor_reg->group_hold_on_conf_size,
-		s_ctrl->msm_sensor_reg->default_data_type);
-}
-
-void msm_sensor_group_hold_off(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	msm_camera_i2c_write_tbl(
-		s_ctrl->sensor_i2c_client,
-		s_ctrl->msm_sensor_reg->group_hold_off_conf,
-		s_ctrl->msm_sensor_reg->group_hold_off_conf_size,
-		s_ctrl->msm_sensor_reg->default_data_type);
-}
-
-int32_t msm_sensor_set_fps(struct msm_sensor_ctrl_t *s_ctrl,
-						struct fps_cfg *fps)
-{
-	s_ctrl->fps_divider = fps->fps_div;
-
-	return 0;
-}
-
-int32_t msm_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;
-
-	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;
-}
-
-int32_t msm_sensor_write_exp_gain2(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t gain, uint32_t line)
-{
-	uint32_t fl_lines, ll_pclk, ll_ratio;
-	uint8_t offset;
-	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;
-	if (line > (fl_lines - offset)) {
-		ll_ratio = (line * Q10) / (fl_lines - offset);
-		ll_pclk = ll_pclk * ll_ratio / Q10;
-		line = fl_lines - 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->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_setting1(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");
-		msm_sensor_enable_debugfs(s_ctrl);
-		s_ctrl->func_tbl->sensor_stop_stream(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);
-		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
-			NOTIFY_PCLK_CHANGE,
-			&s_ctrl->sensordata->pdata->ioclk.vfe_clk_rate);
-	}
-	return rc;
-}
-
-int32_t msm_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) {
-		s_ctrl->func_tbl->sensor_stop_stream(s_ctrl);
-		msm_sensor_write_init_settings(s_ctrl);
-	} else if (update_type == MSM_SENSOR_UPDATE_PERIODIC) {
-		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);
-	}
-	return rc;
-}
-
-int32_t msm_sensor_set_sensor_mode(struct msm_sensor_ctrl_t *s_ctrl,
-	int mode, int res)
-{
-	int32_t rc = 0;
-	if (s_ctrl->curr_res != res) {
-		s_ctrl->curr_frame_length_lines =
-			s_ctrl->msm_sensor_reg->
-			output_settings[res].frame_length_lines;
-
-		s_ctrl->curr_line_length_pclk =
-			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)
-			return rc;
-		s_ctrl->curr_res = res;
-	}
-
-	return rc;
-}
-
-int32_t msm_sensor_mode_init(struct msm_sensor_ctrl_t *s_ctrl,
-			int mode, struct sensor_init_cfg *init_info)
-{
-	int32_t rc = 0;
-	s_ctrl->fps_divider = Q10;
-	s_ctrl->cam_mode = MSM_SENSOR_MODE_INVALID;
-
-	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);
-	}
-	return rc;
-}
-
-int32_t msm_sensor_get_output_info(struct msm_sensor_ctrl_t *s_ctrl,
-		struct sensor_output_info_t *sensor_output_info)
-{
-	int rc = 0;
-	sensor_output_info->num_info = s_ctrl->msm_sensor_reg->num_conf;
-	if (copy_to_user((void *)sensor_output_info->output_info,
-		s_ctrl->msm_sensor_reg->output_settings,
-		sizeof(struct msm_sensor_output_info_t) *
-		s_ctrl->msm_sensor_reg->num_conf))
-		rc = -EFAULT;
-
-	return rc;
-}
-
-static int32_t msm_sensor_release(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	CDBG("%s called\n", __func__);
-	s_ctrl->func_tbl->sensor_stop_stream(s_ctrl);
-	return 0;
-}
-
-long msm_sensor_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;
-	if (s_ctrl->sensor_state == MSM_SENSOR_POWER_DOWN)
-		return -EINVAL;
-	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 =
-			s_ctrl->sensordata->pdata->csiphy_core;
-	}
-	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;
-	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_SET_FPS:
-		case CFG_SET_PICT_FPS:
-			if (s_ctrl->func_tbl->
-			sensor_set_fps == NULL) {
-				rc = -EFAULT;
-				break;
-			}
-			rc = s_ctrl->func_tbl->
-				sensor_set_fps(
-				s_ctrl,
-				&(cdata.cfg.fps));
-			break;
-
-		case CFG_SET_EXP_GAIN:
-			if (s_ctrl->func_tbl->
-			sensor_write_exp_gain == NULL) {
-				rc = -EFAULT;
-				break;
-			}
-			rc =
-				s_ctrl->func_tbl->
-				sensor_write_exp_gain(
-					s_ctrl,
-					cdata.cfg.exp_gain.gain,
-					cdata.cfg.exp_gain.line);
-			break;
-
-		case CFG_SET_PICT_EXP_GAIN:
-			if (s_ctrl->func_tbl->
-			sensor_write_snapshot_exp_gain == NULL) {
-				rc = -EFAULT;
-				break;
-			}
-			rc =
-				s_ctrl->func_tbl->
-				sensor_write_snapshot_exp_gain(
-					s_ctrl,
-					cdata.cfg.exp_gain.gain,
-					cdata.cfg.exp_gain.line);
-			break;
-
-		case CFG_SET_MODE:
-			if (s_ctrl->func_tbl->
-			sensor_set_sensor_mode == NULL) {
-				rc = -EFAULT;
-				break;
-			}
-			rc = s_ctrl->func_tbl->
-				sensor_set_sensor_mode(
-					s_ctrl,
-					cdata.mode,
-					cdata.rs);
-			break;
-
-		case CFG_SET_EFFECT:
-			break;
-
-		case CFG_SENSOR_INIT:
-			if (s_ctrl->func_tbl->
-			sensor_mode_init == NULL) {
-				rc = -EFAULT;
-				break;
-			}
-			rc = s_ctrl->func_tbl->
-				sensor_mode_init(
-				s_ctrl,
-				cdata.mode,
-				&(cdata.cfg.init_info));
-			break;
-
-		case CFG_GET_OUTPUT_INFO:
-			if (s_ctrl->func_tbl->
-			sensor_get_output_info == NULL) {
-				rc = -EFAULT;
-				break;
-			}
-			rc = s_ctrl->func_tbl->
-				sensor_get_output_info(
-				s_ctrl,
-				&cdata.cfg.output_info);
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_START_STREAM:
-			if (s_ctrl->func_tbl->sensor_start_stream == 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);
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				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;
-
-		default:
-			rc = -EFAULT;
-			break;
-		}
-
-	mutex_unlock(s_ctrl->msm_sensor_mutex);
-
-	return rc;
-}
-
-static struct msm_cam_clk_info cam_8960_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);
-	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_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 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;
-	struct msm_camera_sensor_flash_data *flash_data = NULL;
-	struct device_node *flash_src_node = NULL;
-
-	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;
-	}
-
-	if (!of_get_property(of_node, "qcom,flash-src-index", &val)) {
-		CDBG("%s flash not available\n", __func__);
-		return rc;
-	}
-	flash_data = sensordata->flash_data;
-
-	flash_src_node = of_parse_phandle(of_node, "qcom,flash-src-index", 0);
-	if (!flash_src_node) {
-		pr_err("%s:%d flash_src_node NULL\n", __func__,
-			__LINE__);
-		goto ERROR1;
-	}
-
-	rc = of_property_read_u32(flash_src_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 ERROR2;
-	}
-	flash_data->flash_type = val;
-
-	rc = of_property_read_u32(flash_src_node, "cell-index", &val);
-	CDBG("%s qcom,flash-src-index %d, rc %d\n", __func__, val, rc);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR2;
-	}
-	flash_data->flash_src_index = val;
-
-	of_node_put(flash_src_node);
-
-	return rc;
-ERROR2:
-	of_node_put(flash_src_node);
-ERROR1:
-	flash_data->flash_type = MSM_CAMERA_FLASH_NONE;
-	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);
-	}
-
-	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;
-	}
-	sensordata->pdata->csiphy_core = 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;
-	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;
-	}
-
-	rc = msm_camera_request_gpio_table(data, 1);
-	if (rc < 0) {
-		pr_err("%s: request gpio failed\n", __func__);
-		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);
-	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);
-	if (rc < 0) {
-		pr_err("%s: enable regulator failed\n", __func__);
-		goto enable_vreg_failed;
-	}
-
-	rc = msm_camera_config_gpio_table(data, 1);
-	if (rc < 0) {
-		pr_err("%s: config gpio failed\n", __func__);
-		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;
-
-		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;
-		}
-	}
-
-	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);
-
-	if (data->sensor_platform_info->ext_power_ctrl != NULL)
-		data->sensor_platform_info->ext_power_ctrl(1);
-
-	if (data->sensor_platform_info->i2c_conf &&
-		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,
-			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,
-		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);
-request_gpio_failed:
-	kfree(s_ctrl->reg_ptr);
-	return rc;
-}
-
-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);
-	}
-
-	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);
-
-	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_camera_config_gpio_table(data, 0);
-	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, 0);
-	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, 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_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;
-}
-
-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);
-	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);
-	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);
-		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_match_id(s_ctrl);
-	if (rc < 0)
-		goto probe_fail;
-
-	if (!s_ctrl->wait_num_frames)
-		s_ctrl->wait_num_frames = 1 * Q10;
-
-	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;
-	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);
-	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;
-}
-
-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;
-	}
-
-	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;
-	if (!s_ctrl->wait_num_frames)
-		s_ctrl->wait_num_frames = 1 * Q10;
-
-	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;
-
-	pr_err("%s %s probe succeeded\n", __func__,
-		s_ctrl->sensordata->sensor_name);
-	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;
-}
-
-int32_t msm_sensor_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_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;
-			}
-			s_ctrl->sensor_state = MSM_SENSOR_POWER_UP;
-		}
-	} else {
-		rc = s_ctrl->func_tbl->sensor_power_down(s_ctrl);
-		s_ctrl->sensor_state = MSM_SENSOR_POWER_DOWN;
-	}
-	mutex_unlock(s_ctrl->msm_sensor_mutex);
-	return rc;
-}
-
-int32_t msm_sensor_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_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_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_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;
-}
-
-static int msm_sensor_debugfs_stream_s(void *data, u64 val)
-{
-	struct msm_sensor_ctrl_t *s_ctrl = (struct msm_sensor_ctrl_t *) data;
-	if (val)
-		s_ctrl->func_tbl->sensor_start_stream(s_ctrl);
-	else
-		s_ctrl->func_tbl->sensor_stop_stream(s_ctrl);
-	return 0;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(sensor_debugfs_stream, NULL,
-			msm_sensor_debugfs_stream_s, "%llu\n");
-
-static int msm_sensor_debugfs_test_s(void *data, u64 val)
-{
-	CDBG("val: %llu\n", val);
-	return 0;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(sensor_debugfs_test, NULL,
-			msm_sensor_debugfs_test_s, "%llu\n");
-
-int msm_sensor_enable_debugfs(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	struct dentry *debugfs_base, *sensor_dir;
-	debugfs_base = debugfs_create_dir("msm_sensor", NULL);
-	if (!debugfs_base)
-		return -ENOMEM;
-
-	sensor_dir = debugfs_create_dir
-		(s_ctrl->sensordata->sensor_name, debugfs_base);
-	if (!sensor_dir)
-		return -ENOMEM;
-
-	if (!debugfs_create_file("stream", S_IRUGO | S_IWUSR, sensor_dir,
-			(void *) s_ctrl, &sensor_debugfs_stream))
-		return -ENOMEM;
-
-	if (!debugfs_create_file("test", S_IRUGO | S_IWUSR, sensor_dir,
-			(void *) s_ctrl, &sensor_debugfs_test))
-		return -ENOMEM;
-
-	return 0;
-}
diff --git a/drivers/media/platform/msm/camera_v1/sensors/msm_sensor.h b/drivers/media/platform/msm/camera_v1/sensors/msm_sensor.h
deleted file mode 100644
index e144197..0000000
--- a/drivers/media/platform/msm/camera_v1/sensors/msm_sensor.h
+++ /dev/null
@@ -1,118 +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_H
-#define MSM_SENSOR_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 <media/msm_camera.h>
-#include <media/v4l2-subdev.h>
-#include "msm_camera_i2c.h"
-#include "msm_camera_eeprom.h"
-#include "msm_sensor_common.h"
-
-void msm_sensor_start_stream(struct msm_sensor_ctrl_t *s_ctrl);
-void msm_sensor_stop_stream(struct msm_sensor_ctrl_t *s_ctrl);
-void msm_sensor_group_hold_on(struct msm_sensor_ctrl_t *s_ctrl);
-void msm_sensor_group_hold_off(struct msm_sensor_ctrl_t *s_ctrl);
-
-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 msm_sensor_write_exp_gain2(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t 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,
-			int mode, struct sensor_init_cfg *init_info);
-int32_t msm_sensor_get_output_info(struct msm_sensor_ctrl_t *,
-		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);
-
-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_platform_probe(struct platform_device *pdev, void *data);
-
-int32_t msm_sensor_power(struct v4l2_subdev *sd, int on);
-
-int32_t msm_sensor_v4l2_s_ctrl(struct v4l2_subdev *sd,
-	struct v4l2_control *ctrl);
-
-int32_t msm_sensor_v4l2_query_ctrl(
-	struct v4l2_subdev *sd, struct v4l2_queryctrl *qctrl);
-
-int msm_sensor_s_ctrl_by_index(struct msm_sensor_ctrl_t *s_ctrl,
-	struct msm_sensor_v4l2_ctrl_info_t *ctrl_info, int value);
-
-int 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 msm_sensor_v4l2_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-			enum v4l2_mbus_pixelcode *code);
-
-int msm_sensor_write_init_settings(struct msm_sensor_ctrl_t *s_ctrl);
-int msm_sensor_write_res_settings
-	(struct msm_sensor_ctrl_t *s_ctrl, uint16_t res);
-
-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_setting1(struct msm_sensor_ctrl_t *s_ctrl,
-			int update_type, int res);
-
-int msm_sensor_enable_debugfs(struct msm_sensor_ctrl_t *s_ctrl);
-
-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);
-
-#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/platform/msm/camera_v1/sensors/msm_sensor_bayer.c b/drivers/media/platform/msm/camera_v1/sensors/msm_sensor_bayer.c
deleted file mode 100644
index 18e78a8..0000000
--- a/drivers/media/platform/msm/camera_v1/sensors/msm_sensor_bayer.c
+++ /dev/null
@@ -1,909 +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"
-/*=============================================================*/
-
-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.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;
-}
-
-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;
-	if (s_ctrl->func_tbl->sensor_read_eeprom != NULL)
-		s_ctrl->func_tbl->sensor_read_eeprom(s_ctrl);
-	else
-		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/platform/msm/camera_v1/sensors/msm_sensor_bayer.h b/drivers/media/platform/msm/camera_v1/sensors/msm_sensor_bayer.h
deleted file mode 100644
index 584b790..0000000
--- a/drivers/media/platform/msm/camera_v1/sensors/msm_sensor_bayer.h
+++ /dev/null
@@ -1,78 +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);
-
-int32_t msm_sensor_bayer_eeprom_read(struct msm_sensor_ctrl_t *s_ctrl);
-
-#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/platform/msm/camera_v1/sensors/msm_sensor_common.c b/drivers/media/platform/msm/camera_v1/sensors/msm_sensor_common.c
deleted file mode 100644
index a8d78b0..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/sensors/msm_sensor_common.h b/drivers/media/platform/msm/camera_v1/sensors/msm_sensor_common.h
deleted file mode 100644
index a1f5b83..0000000
--- a/drivers/media/platform/msm/camera_v1/sensors/msm_sensor_common.h
+++ /dev/null
@@ -1,227 +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_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 (*sensor_write_snapshot_exp_gain) (struct msm_sensor_ctrl_t *,
-			uint16_t, uint32_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 *);
-	int32_t (*sensor_read_eeprom)(struct msm_sensor_ctrl_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;
-
-	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/platform/msm/camera_v1/sensors/msm_sensor_init.c b/drivers/media/platform/msm/camera_v1/sensors/msm_sensor_init.c
deleted file mode 100644
index d759cf1..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/sensors/mt9e013_v4l2.c b/drivers/media/platform/msm/camera_v1/sensors/mt9e013_v4l2.c
deleted file mode 100644
index 289beba..0000000
--- a/drivers/media/platform/msm/camera_v1/sensors/mt9e013_v4l2.c
+++ /dev/null
@@ -1,496 +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 "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)
-{
-	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)
-{
-	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/platform/msm/camera_v1/sensors/mt9m114_v4l2.c b/drivers/media/platform/msm/camera_v1/sensors/mt9m114_v4l2.c
deleted file mode 100644
index c952f7b..0000000
--- a/drivers/media/platform/msm/camera_v1/sensors/mt9m114_v4l2.c
+++ /dev/null
@@ -1,1332 +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 const struct of_device_id mt9m114_dt_match[] = {
-	{.compatible = "qcom,mt9m114", .data = &mt9m114_s_ctrl},
-	{}
-};
-
-MODULE_DEVICE_TABLE(of, mt9m114_dt_match);
-
-static struct platform_driver mt9m114_platform_driver = {
-	.driver = {
-		.name = "qcom,mt9m114",
-		.owner = THIS_MODULE,
-		.of_match_table = mt9m114_dt_match,
-	},
-};
-
-static int32_t mt9m114_platform_probe(struct platform_device *pdev)
-{
-	int32_t rc = 0;
-	const struct of_device_id *match;
-	match = of_match_device(mt9m114_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(&mt9m114_platform_driver,
-		mt9m114_platform_probe);
-	if (!rc)
-		return rc;
-	return i2c_add_driver(&mt9m114_i2c_driver);
-}
-
-
-static void __exit msm_sensor_exit_module(void)
-{
-	if (mt9m114_s_ctrl.pdev) {
-		msm_sensor_free_sensor_data(&mt9m114_s_ctrl);
-		platform_driver_unregister(&mt9m114_platform_driver);
-	} else {
-		i2c_del_driver(&mt9m114_i2c_driver);
-	}
-	return;
-}
-
-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_exit(msm_sensor_exit_module);
-MODULE_DESCRIPTION("Aptina 1.26MP YUV sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/platform/msm/camera_v1/sensors/ov2720.c b/drivers/media/platform/msm/camera_v1/sensors/ov2720.c
deleted file mode 100644
index fe7bf07..0000000
--- a/drivers/media/platform/msm/camera_v1/sensors/ov2720.c
+++ /dev/null
@@ -1,856 +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"
-#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)
-{
-	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,
-};
-
-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/platform/msm/camera_v1/sensors/ov2720.h b/drivers/media/platform/msm/camera_v1/sensors/ov2720.h
deleted file mode 100644
index 6b47666..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/sensors/ov5647_v4l2.c b/drivers/media/platform/msm/camera_v1/sensors/ov5647_v4l2.c
deleted file mode 100644
index f27e648..0000000
--- a/drivers/media/platform/msm/camera_v1/sensors/ov5647_v4l2.c
+++ /dev/null
@@ -1,831 +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"
-#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 */
-	{0x0100, 0x01},
-	{0x4800, 0x04},
-};
-
-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)
-{
-
-	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)
-{
-	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/platform/msm/camera_v1/sensors/ov7692_v4l2.c b/drivers/media/platform/msm/camera_v1/sensors/ov7692_v4l2.c
deleted file mode 100644
index efc78f8..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/sensors/ov8825_v4l2.c b/drivers/media/platform/msm/camera_v1/sensors/ov8825_v4l2.c
deleted file mode 100644
index ddf4619..0000000
--- a/drivers/media/platform/msm/camera_v1/sensors/ov8825_v4l2.c
+++ /dev/null
@@ -1,937 +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"
-#define SENSOR_NAME "ov8825"
-#define PLATFORM_DRIVER_NAME "msm_camera_ov8825"
-#define ov8825_obj ov8825_##obj
-
-/* TO DO - Currently ov5647 typical values are used
- * Need to get the exact values */
-#define OV8825_RG_RATIO_TYPICAL_VALUE 64 /* R/G of typical camera module */
-#define OV8825_BG_RATIO_TYPICAL_VALUE 105 /* 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},
-};
-
-static struct msm_camera_i2c_reg_conf ov8825_stop_settings[] = {
-	{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_prev_settings[] = {
-	{0x3003, 0xce}, /*PLL_CTRL0*/
-	{0x3004, 0xd4}, /*PLL_CTRL1*/
-	{0x3005, 0x00}, /*PLL_CTRL2*/
-	{0x3006, 0x10}, /*PLL_CTRL3*/
-	{0x3007, 0x3b}, /*PLL_CTRL4*/
-	{0x3011, 0x01}, /*MIPI_Lane_4_Lane*/
-	{0x3012, 0x80}, /*SC_PLL CTRL_S0*/
-	{0x3013, 0x39}, /*SC_PLL CTRL_S1*/
-	{0x3104, 0x20}, /*SCCB_PLL*/
-	{0x3106, 0x15}, /*SRB_CTRL*/
-	{0x3501, 0x4e}, /*AEC_HIGH*/
-	{0x3502, 0xa0}, /*AEC_LOW*/
-	{0x350b, 0x1f}, /*AGC*/
-	{0x3600, 0x06}, /*ANACTRL0*/
-	{0x3601, 0x34}, /*ANACTRL1*/
-	{0x3700, 0x20}, /*SENCTROL0 Sensor control*/
-	{0x3702, 0x50}, /*SENCTROL2 Sensor control*/
-	{0x3703, 0xcc}, /*SENCTROL3 Sensor control*/
-	{0x3704, 0x19}, /*SENCTROL4 Sensor control*/
-	{0x3705, 0x14}, /*SENCTROL5 Sensor control*/
-	{0x3706, 0x4b}, /*SENCTROL6 Sensor control*/
-	{0x3707, 0x63}, /*SENCTROL7 Sensor control*/
-	{0x3708, 0x84}, /*SENCTROL8 Sensor control*/
-	{0x3709, 0x40}, /*SENCTROL9 Sensor control*/
-	{0x370a, 0x12}, /*SENCTROLA Sensor control*/
-	{0x370e, 0x00}, /*SENCTROLE Sensor control*/
-	{0x3711, 0x0f}, /*SENCTROL11 Sensor control*/
-	{0x3712, 0x9c}, /*SENCTROL12 Sensor control*/
-	{0x3724, 0x01}, /*Reserved*/
-	{0x3725, 0x92}, /*Reserved*/
-	{0x3726, 0x01}, /*Reserved*/
-	{0x3727, 0xa9}, /*Reserved*/
-	{0x3800, 0x00}, /*HS(HREF start High)*/
-	{0x3801, 0x00}, /*HS(HREF start Low)*/
-	{0x3802, 0x00}, /*VS(Vertical start High)*/
-	{0x3803, 0x00}, /*VS(Vertical start Low)*/
-	{0x3804, 0x0c}, /*HW = 3295*/
-	{0x3805, 0xdf}, /*HW*/
-	{0x3806, 0x09}, /*VH = 2459*/
-	{0x3807, 0x9b}, /*VH*/
-	{0x3808, 0x06}, /*ISPHO = 1632*/
-	{0x3809, 0x60}, /*ISPHO*/
-	{0x380a, 0x04}, /*ISPVO = 1224*/
-	{0x380b, 0xc8}, /*ISPVO*/
-	{0x380c, 0x0d}, /*HTS = 3516*/
-	{0x380d, 0xbc}, /*HTS*/
-	{0x380e, 0x04}, /*VTS = 1264*/
-	{0x380f, 0xf0}, /*VTS*/
-	{0x3810, 0x00}, /*HOFF = 8*/
-	{0x3811, 0x08}, /*HOFF*/
-	{0x3812, 0x00}, /*VOFF = 4*/
-	{0x3813, 0x04}, /*VOFF*/
-	{0x3814, 0x31}, /*X INC*/
-	{0x3815, 0x31}, /*Y INC*/
-	{0x3820, 0x81}, /*Timing Reg20:Vflip*/
-	{0x3821, 0x17}, /*Timing Reg21:Hmirror*/
-	{0x3f00, 0x00}, /*PSRAM Ctrl0*/
-	{0x3f01, 0xfc}, /*PSRAM Ctrl1*/
-	{0x3f05, 0x10}, /*PSRAM Ctrl5*/
-	{0x4600, 0x04}, /*VFIFO Ctrl0*/
-	{0x4601, 0x00}, /*VFIFO Read ST High*/
-	{0x4602, 0x30}, /*VFIFO Read ST Low*/
-	{0x4837, 0x28}, /*MIPI PCLK PERIOD*/
-	{0x5068, 0x00}, /*HSCALE_CTRL*/
-	{0x506a, 0x00}, /*VSCALE_CTRL*/
-	{0x5c00, 0x80}, /*PBLC CTRL00*/
-	{0x5c01, 0x00}, /*PBLC CTRL01*/
-	{0x5c02, 0x00}, /*PBLC CTRL02*/
-	{0x5c03, 0x00}, /*PBLC CTRL03*/
-	{0x5c04, 0x00}, /*PBLC CTRL04*/
-	{0x5c08, 0x10}, /*PBLC CTRL08*/
-	{0x6900, 0x61}, /*CADC CTRL00*/
-};
-
-static struct msm_camera_i2c_reg_conf ov8825_snap_settings[] = {
-	{0x3003, 0xce}, /*PLL_CTRL0*/
-	{0x3004, 0xd8}, /*PLL_CTRL1*/
-	{0x3005, 0x00}, /*PLL_CTRL2*/
-	{0x3006, 0x10}, /*PLL_CTRL3*/
-	{0x3007, 0x3b}, /*PLL_CTRL4*/
-	{0x3011, 0x01}, /*MIPI_Lane_4_Lane*/
-	{0x3012, 0x81}, /*SC_PLL CTRL_S0*/
-	{0x3013, 0x39}, /*SC_PLL CTRL_S1*/
-	{0x3104, 0x20}, /*SCCB_PLL*/
-	{0x3106, 0x11}, /*SRB_CTRL*/
-	{0x3501, 0x9a}, /*AEC_HIGH*/
-	{0x3502, 0xa0}, /*AEC_LOW*/
-	{0x350b, 0x1f}, /*AGC*/
-	{0x3600, 0x07}, /*ANACTRL0*/
-	{0x3601, 0x33}, /*ANACTRL1*/
-	{0x3700, 0x10}, /*SENCTROL0 Sensor control*/
-	{0x3702, 0x28}, /*SENCTROL2 Sensor control*/
-	{0x3703, 0x6c}, /*SENCTROL3 Sensor control*/
-	{0x3704, 0x8d}, /*SENCTROL4 Sensor control*/
-	{0x3705, 0x0a}, /*SENCTROL5 Sensor control*/
-	{0x3706, 0x27}, /*SENCTROL6 Sensor control*/
-	{0x3707, 0x63}, /*SENCTROL7 Sensor control*/
-	{0x3708, 0x40}, /*SENCTROL8 Sensor control*/
-	{0x3709, 0x20}, /*SENCTROL9 Sensor control*/
-	{0x370a, 0x12}, /*SENCTROLA Sensor control*/
-	{0x370e, 0x00}, /*SENCTROLE Sensor control*/
-	{0x3711, 0x07}, /*SENCTROL11 Sensor control*/
-	{0x3712, 0x4e}, /*SENCTROL12 Sensor control*/
-	{0x3724, 0x00}, /*Reserved*/
-	{0x3725, 0xd4}, /*Reserved*/
-	{0x3726, 0x00}, /*Reserved*/
-	{0x3727, 0xe1}, /*Reserved*/
-	{0x3800, 0x00}, /*HS(HREF start High)*/
-	{0x3801, 0x00}, /*HS(HREF start Low)*/
-	{0x3802, 0x00}, /*VS(Vertical start Hgh)*/
-	{0x3803, 0x00}, /*VS(Vertical start Low)*/
-	{0x3804, 0x0c}, /*HW = 3295*/
-	{0x3805, 0xdf}, /*HW*/
-	{0x3806, 0x09}, /*VH = 2459*/
-	{0x3807, 0x9b}, /*VH*/
-	{0x3808, 0x0c}, /*ISPHO = 1632*/
-	{0x3809, 0xc0}, /*ISPHO*/
-	{0x380a, 0x09}, /*ISPVO = 1224*/
-	{0x380b, 0x90}, /*ISPVO*/
-	{0x380c, 0x0e}, /*HTS = 3516*/
-	{0x380d, 0x00}, /*HTS*/
-	{0x380e, 0x09}, /*VTS = 1264*/
-	{0x380f, 0xb0}, /*VTS*/
-	{0x3810, 0x00}, /*HOFF = 8*/
-	{0x3811, 0x10}, /*HOFF*/
-	{0x3812, 0x00}, /*VOFF = 4*/
-	{0x3813, 0x06}, /*VOFF*/
-	{0x3814, 0x11}, /*X INC*/
-	{0x3815, 0x11}, /*Y INC*/
-	{0x3820, 0x80}, /*Timing Reg20:Vflip*/
-	{0x3821, 0x16}, /*Timing Reg21:Hmirror*/
-	{0x3f00, 0x02}, /*PSRAM Ctrl0*/
-	{0x3f01, 0xfc}, /*PSRAM Ctrl1*/
-	{0x3f05, 0x10}, /*PSRAM Ctrl5*/
-	{0x4600, 0x04}, /*VFIFO Ctrl0*/
-	{0x4601, 0x00}, /*VFIFO Read ST High*/
-	{0x4602, 0x78}, /*VFIFO Read ST Low*/
-	{0x4837, 0x28}, /*MIPI PCLK PERIOD*/
-	{0x5068, 0x00}, /*HSCALE_CTRL*/
-	{0x506a, 0x00}, /*VSCALE_CTRL*/
-	{0x5c00, 0x80}, /*PBLC CTRL00*/
-	{0x5c01, 0x00}, /*PBLC CTRL01*/
-	{0x5c02, 0x00}, /*PBLC CTRL02*/
-	{0x5c03, 0x00}, /*PBLC CTRL03*/
-	{0x5c04, 0x00}, /*PBLC CTRL04*/
-	{0x5c08, 0x10}, /*PBLC CTRL08*/
-	{0x6900, 0x61}, /*CADC CTRL00*/
-};
-
-
-static struct msm_camera_i2c_reg_conf ov8825_reset_settings[] = {
-	{0x0103, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf ov8825_recommend_settings[] = {
-	{0x3000, 0x16},
-	{0x3001, 0x00},
-	{0x3002, 0x6c},
-	{0x300d, 0x00},
-	{0x301f, 0x09},
-	{0x3010, 0x00},
-	{0x3018, 0x00},
-	{0x3300, 0x00},
-	{0x3500, 0x00},
-	{0x3503, 0x07},
-	{0x3509, 0x00},
-	{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},
-	{0x3701, 0x44},
-	{0x370b, 0x01},
-	{0x370c, 0x50},
-	{0x370d, 0x00},
-	{0x3816, 0x02},
-	{0x3817, 0x40},
-	{0x3818, 0x00},
-	{0x3819, 0x40},
-	{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},
-	{0x3f06, 0x00},
-	{0x3f07, 0x00},
-	{0x4000, 0x29},
-	{0x4001, 0x02},
-	{0x4002, 0x45},
-	{0x4003, 0x08},
-	{0x4004, 0x04},
-	{0x4005, 0x18},
-	{0x4300, 0xff},
-	{0x4303, 0x00},
-	{0x4304, 0x08},
-	{0x4307, 0x00},
-	{0x4800, 0x04},
-	{0x4801, 0x0f},
-	{0x4843, 0x02},
-	{0x5000, 0x06},
-	{0x5001, 0x00},
-	{0x5002, 0x00},
-	{0x501f, 0x00},
-	{0x5780, 0xfc},
-	{0x5c05, 0x00},
-	{0x5c06, 0x00},
-	{0x5c07, 0x80},
-	{0x6700, 0x05},
-	{0x6701, 0x19},
-	{0x6702, 0xfd},
-	{0x6703, 0xd7},
-	{0x6704, 0xff},
-	{0x6705, 0xff},
-	{0x6800, 0x10},
-	{0x6801, 0x02},
-	{0x6802, 0x90},
-	{0x6803, 0x10},
-	{0x6804, 0x59},
-	{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},
-	{0x3503, 0x07},
-	{0x3500, 0x00},
-	{0x3501, 0x27},
-	{0x3502, 0x00},
-	{0x350b, 0xff},
-	{0x3400, 0x04},
-	{0x3401, 0x00},
-	{0x3402, 0x04},
-	{0x3403, 0x00},
-	{0x3404, 0x04},
-	{0x3405, 0x00},
-	{0x3406, 0x01},
-	{0x5001, 0x01},
-	{0x5000, 0x86},/* enable lens compensation and dpc */
-	/* LENC setting 70% */
-	{0x5800, 0x21},
-	{0x5801, 0x10},
-	{0x5802, 0x09},
-	{0x5803, 0x0a},
-	{0x5804, 0x0f},
-	{0x5805, 0x23},
-	{0x5806, 0x08},
-	{0x5807, 0x04},
-	{0x5808, 0x04},
-	{0x5809, 0x04},
-	{0x580a, 0x04},
-	{0x580b, 0x0a},
-	{0x580c, 0x04},
-	{0x580d, 0x02},
-	{0x580e, 0x00},
-	{0x580f, 0x00},
-	{0x5810, 0x03},
-	{0x5811, 0x06},
-	{0x5812, 0x05},
-	{0x5813, 0x02},
-	{0x5814, 0x00},
-	{0x5815, 0x00},
-	{0x5816, 0x03},
-	{0x5817, 0x06},
-	{0x5818, 0x09},
-	{0x5819, 0x05},
-	{0x581a, 0x04},
-	{0x581b, 0x04},
-	{0x581c, 0x05},
-	{0x581d, 0x0a},
-	{0x581e, 0x24},
-	{0x581f, 0x11},
-	{0x5820, 0x0a},
-	{0x5821, 0x0a},
-	{0x5822, 0x10},
-	{0x5823, 0x27},
-	{0x5824, 0x2a},
-	{0x5825, 0x58},
-	{0x5826, 0x28},
-	{0x5827, 0x28},
-	{0x5828, 0x28},
-	{0x5829, 0x28},
-	{0x582a, 0x46},
-	{0x582b, 0x44},
-	{0x582c, 0x46},
-	{0x582d, 0x46},
-	{0x582e, 0x28},
-	{0x582f, 0x62},
-	{0x5830, 0x60},
-	{0x5831, 0x42},
-	{0x5832, 0x28},
-	{0x5833, 0x48},
-	{0x5834, 0x46},
-	{0x5835, 0x46},
-	{0x5836, 0x26},
-	{0x5837, 0x46},
-	{0x5838, 0x28},
-	{0x5839, 0x48},
-	{0x583a, 0x28},
-	{0x583b, 0x28},
-	{0x583c, 0x26},
-	{0x583d, 0x9d},
-};
-
-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_reset_settings[0],
-	ARRAY_SIZE(ov8825_reset_settings), 50, MSM_CAMERA_I2C_BYTE_DATA},
-	{&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},
-};
-
-static struct msm_sensor_output_info_t ov8825_dimensions[] = {
-	{
-		.x_output = 0xCC0,
-		.y_output = 0x990,
-		.line_length_pclk = 0xE00,
-		.frame_length_lines = 0x9B0,
-		.vt_pixel_clk = 133400000,
-		.op_pixel_clk = 176000000,
-		.binning_factor = 1,
-	},
-	{
-		.x_output = 0x660,
-		.y_output = 0x4C8,
-		.line_length_pclk = 0x6DE,
-		.frame_length_lines = 0x505,
-		.vt_pixel_clk = 66700000,
-		.op_pixel_clk = 88000000,
-		.binning_factor = 2,
-	},
-};
-
-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 = 0x3501,
-	.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)
-{
-	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-1,
-		&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},
-	{ }
-};
-
-int32_t ov8825_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, 0);
-	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, 1);
-	msleep(20);
-	gpio_direction_output(info->sensor_reset, 1);
-	msleep(40);
-	return rc;
-}
-
-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;
-
-	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_conf_array(
-			s_ctrl->sensor_i2c_client,
-			s_ctrl->msm_sensor_reg->mode_settings, res);
-		msleep(30);
-		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
-			NOTIFY_PCLK_CHANGE,
-			&s_ctrl->sensordata->pdata->ioclk.vfe_clk_rate);
-	}
-	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_exp_gain,
-	.sensor_csi_setting = ov8825_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 = ov8825_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-};
-
-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,
-};
-
-module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("Omnivison 8MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/platform/msm/camera_v1/sensors/ov9726_v4l2.c b/drivers/media/platform/msm/camera_v1/sensors/ov9726_v4l2.c
deleted file mode 100644
index debd959..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/sensors/s5k3l1yx.c b/drivers/media/platform/msm/camera_v1/sensors/s5k3l1yx.c
deleted file mode 100644
index 0bd625c..0000000
--- a/drivers/media/platform/msm/camera_v1/sensors/s5k3l1yx.c
+++ /dev/null
@@ -1,747 +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 msm_camera_i2c_reg_conf s5k3l1yx_19mhz_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, 0xCE}, /* 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 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},
-	{&s5k3l1yx_19mhz_prev_settings[0],
-	ARRAY_SIZE(s5k3l1yx_19mhz_prev_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,
-	},
-	/* 30 fps preview with 19.2 input clock*/
-	{
-		.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,
-	},
-};
-
-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/platform/msm/camera_v1/sensors/s5k4e1_v4l2.c b/drivers/media/platform/msm/camera_v1/sensors/s5k4e1_v4l2.c
deleted file mode 100644
index a95bb0a..0000000
--- a/drivers/media/platform/msm/camera_v1/sensors/s5k4e1_v4l2.c
+++ /dev/null
@@ -1,518 +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 "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)
-{
-	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)
-{
-	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/platform/msm/camera_v1/sensors/vx6953.c b/drivers/media/platform/msm/camera_v1/sensors/vx6953.c
deleted file mode 100644
index 9867468..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/sensors/vx6953.h b/drivers/media/platform/msm/camera_v1/sensors/vx6953.h
deleted file mode 100644
index 2fc2a19..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/sensors/vx6953_reg.h b/drivers/media/platform/msm/camera_v1/sensors/vx6953_reg.h
deleted file mode 100644
index fe99be5..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/server/Makefile b/drivers/media/platform/msm/camera_v1/server/Makefile
deleted file mode 100644
index a64be59..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1
-  EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/io
-  EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/csi
-  EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/eeprom
-  EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/sensors
-  EXTRA_CFLAGS += -Idrivers/media/platform/msm/camera_v1/actuators
-  obj-$(CONFIG_MSM_CAMERA)   += msm_cam_server.o
-endif
diff --git a/drivers/media/platform/msm/camera_v1/server/msm_cam_server.c b/drivers/media/platform/msm/camera_v1/server/msm_cam_server.c
deleted file mode 100644
index d9fba33..0000000
--- a/drivers/media/platform/msm/camera_v1/server/msm_cam_server.c
+++ /dev/null
@@ -1,3258 +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 case of simultaneous camera,
-					 * the YUV sensor could use PIX
-					 * interface to only queue the preview
-					 * or video buffers, but does not
-					 * expect any notifications directly.
-					 * (preview/video data is updated from
-					 * postprocessing in such scenario).
-					 * In such case, there is no need to
-					 * update the mctl_handle in the intf
-					 * map table, since the notification
-					 * will not be sent directly. */
-					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;
-}
-
-
-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 (wait_count > 0);
-	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.
-	 * 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:
-	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;
-	}
-	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, 30);

-			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, 30);

-		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 (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;
-
-	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", 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);
-
-	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
-			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
-			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) {
-			interface = PIX_0;
-			break;
-		}
-		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
-				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 && 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,
-	uint8_t csiphy_core_index, uint8_t csid_core_index)
-{
-	int rc = -ENODEV;
-
-	v4l2_set_subdev_hostdata(p_mctl->sensor_sdev, p_mctl);
-
-	rc = msm_csi_register_subdevs(p_mctl, csiphy_core_index,
-		csid_core_index, &g_server_dev);
-	if (rc < 0)
-		pr_err("%s: Could not find sensor subdevs\n", __func__);
-
-	return rc;
-}
-
-int msm_mctl_find_flash_subdev(struct msm_cam_media_controller *p_mctl,
-	uint8_t index)
-{
-	if (index < MAX_NUM_FLASH_DEV)
-		p_mctl->flash_sdev = g_server_dev.flash_device[index];
-	return 0;
-}
-
-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;
-
-	case FLASH_DEV:
-		if (index >= MAX_NUM_FLASH_DEV) {
-			pr_err("%s Invalid flash idx %d", __func__, index);
-			err = -EINVAL;
-			break;
-		}
-		g_server_dev.flash_device[index] = sd;
-		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);
-
-#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__);
-		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:
-	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*/
-	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_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);
-		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/platform/msm/camera_v1/server/msm_cam_server.h b/drivers/media/platform/msm/camera_v1/server/msm_cam_server.h
deleted file mode 100644
index 810830e..0000000
--- a/drivers/media/platform/msm/camera_v1/server/msm_cam_server.h
+++ /dev/null
@@ -1,73 +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);
-#endif /* _MSM_CAM_SERVER_H */
diff --git a/drivers/media/platform/msm/camera_v1/sn12m0pz.c b/drivers/media/platform/msm/camera_v1/sn12m0pz.c
deleted file mode 100644
index 1fcd732..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/sn12m0pz.h b/drivers/media/platform/msm/camera_v1/sn12m0pz.h
deleted file mode 100644
index c3d3346..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/sn12m0pz_reg.c b/drivers/media/platform/msm/camera_v1/sn12m0pz_reg.c
deleted file mode 100644
index c406d98..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vb6801.c b/drivers/media/platform/msm/camera_v1/vb6801.c
deleted file mode 100644
index f916a1c..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vb6801.h b/drivers/media/platform/msm/camera_v1/vb6801.h
deleted file mode 100644
index 5a8842c..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vfe/Makefile b/drivers/media/platform/msm/camera_v1/vfe/Makefile
deleted file mode 100644
index ead1075..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1
-ccflags-y += -Idrivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vfe/msm_vfe31.c b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe31.c
deleted file mode 100644
index ab92085..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vfe/msm_vfe31.h b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe31.h
deleted file mode 100644
index 4e1a8d4..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vfe/msm_vfe31_v4l2.c b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe31_v4l2.c
deleted file mode 100644
index 10ddd4b..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vfe/msm_vfe31_v4l2.h b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe31_v4l2.h
deleted file mode 100644
index eea8078..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vfe/msm_vfe32.c b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe32.c
deleted file mode 100644
index 3570170..0000000
--- a/drivers/media/platform/msm/camera_v1/vfe/msm_vfe32.c
+++ /dev/null
@@ -1,6782 +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},
-		{VFE_CMD_STATS_BF_START, V32_STATS_BF_LEN, V32_STATS_BF_OFF},
-/*145*/ {VFE_CMD_STATS_BF_STOP},
-		{VFE_CMD_STATS_BHIST_START, V32_STATS_BHIST_LEN,
-			V32_STATS_BHIST_OFF},
-/*147*/	{VFE_CMD_STATS_BHIST_STOP},
-};
-
-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",
-	"EZTUNE_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",
-	"DUMMY_11",
-	"DUMMY_12", /*130*/
-	"DUMMY_13",
-	"DUMMY_14",
-	"DUMMY_15",
-	"DUMMY_16",
-	"DUMMY_17", /*135*/
-	"DUMMY_18",
-	"DUMMY_19",
-	"DUMMY_20",
-	"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",
-	"RESET_2",
-};
-
-uint8_t vfe32_use_bayer_stats(struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	if (vfe32_ctrl->ver_num.main >= 4) {
-		/* 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, irq_comp_mask = 0;
-	uint16_t vfe_output_mode =
-		share_ctrl->outpath.output_mode &
-			~(VFE32_OUTPUT_MODE_TERTIARY1|
-			VFE32_OUTPUT_MODE_TERTIARY2);
-
-	if (vfe_output_mode)
-		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));
-	}
-
-	msm_camera_io_w(irq_mask, share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-	if (vfe_output_mode)
-		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_mode =
-		output_mode &
-			~(VFE32_OUTPUT_MODE_TERTIARY1|
-			VFE32_OUTPUT_MODE_TERTIARY2);
-	if (vfe_output_mode)
-		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));
-	}
-	msm_camera_io_w(irq_mask, share_ctrl->vfebase +
-				VFE_IRQ_MASK_0);
-	if (vfe_output_mode)
-		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);
-
-	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)) {
-		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;
-
-		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));
-
-	if (mode & (VFE_OUTPUTS_RDI0|VFE_OUTPUTS_RDI1)) {
-		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;
-		}
-
-		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);
-}
-
-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));
-	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.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_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 |=
-			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);
-	}
-}
-
-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);
-
-	/* 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->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;
-
-	/* 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(0x350001F,
-			vfe32_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_HIST_UB_CFG);
-		msm_camera_io_w(0x370002F,
-			vfe32_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_AEC_BG_UB_CFG);
-		msm_camera_io_w(0x3A0002F,
-			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->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);
-
-	vfe32_ctrl->frame_skip_cnt = 31;
-	vfe32_ctrl->frame_skip_pattern = 0xffffffff;
-	vfe32_ctrl->snapshot_frame_cnt = 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);
-	vfe32_ctrl->share_ctrl->comp_output_mode &=
-			(VFE32_OUTPUT_MODE_TERTIARY1|
-			VFE32_OUTPUT_MODE_TERTIARY2);
-
-	/* 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
-		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;
-
-	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;
-	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;
-
-	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->ping.ch_paddr[0] && outch->pong.ch_paddr[0]) {
-		/* Configure Preview Ping Pong */
-		pr_info("%s Configure ping/pong address for %d",
-						__func__, path);
-		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)) {
-			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_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;
-	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_process(struct vfe_share_ctrl_t *share_ctrl)
-{
-	uint32_t vfe_mode =
-	share_ctrl->current_mode & ~(VFE_OUTPUTS_RDI0|
-		VFE_OUTPUTS_RDI1);
-
-	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 (vfe_mode) {
-		uint16_t mode = share_ctrl->comp_output_mode &
-			~(VFE32_OUTPUT_MODE_TERTIARY1|
-			VFE32_OUTPUT_MODE_TERTIARY2);
-		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);
-	}
-}
-
-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);
-
-		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);
-			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);
-		}
-	}  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_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;
-			}
-			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]);
-			}
-			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);
-					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_reset_irq(
-		struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	unsigned long flags;
-
-	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_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);
-		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);
-	}
-
-	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;
-	default:
-		msg.frameCounter = axi_ctrl->share_ctrl->vfeFrameId;
-		break;
-	}
-
-	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_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 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 temp;
-
-	msgStats.frame_id = vfe32_ctrl->share_ctrl->vfeFrameId;
-	if (vfe32_ctrl->simultaneous_sof_stat)
-		msgStats.frame_id--;
-
-	msgStats.status_bits = status_bits;
-
-	msgStats.aec.buff = vfe32_ctrl->aecbgStatsControl.bufToRender;
-	msgStats.awb.buff = vfe32_ctrl->awbStatsControl.bufToRender;
-	msgStats.af.buff = vfe32_ctrl->afbfStatsControl.bufToRender;
-
-	msgStats.ihist.buff = vfe32_ctrl->ihistStatsControl.bufToRender;
-	msgStats.rs.buff = vfe32_ctrl->rsStatsControl.bufToRender;
-	msgStats.cs.buff = vfe32_ctrl->csStatsControl.bufToRender;
-
-	temp = msm_camera_io_r(
-		vfe32_ctrl->share_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_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;
-	}
-	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_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;
-	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);
-
-		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 (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_IMASK_WHILE_STOPPING_1)
-			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) {
-				pr_err("irq	errorIrq\n");
-				vfe32_process_common_error_irq(
-					axi_ctrl,
-					qcmd->vfeInterruptStatus1 &
-					VFE32_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 &
-					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;
-		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(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) {
-		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->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) {
-		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:
-		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)
-		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,
-};
-
-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;
-	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;
-	}
-#endif
-
-	msm_camio_bus_scale_cfg(
-		mctl->sdata->pdata->cam_bus_scale_table, S_INIT);
-
-	if (axi_ctrl->share_ctrl->dual_enabled)
-		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;
-	vfe32_ctrl->vfe_sof_count_enable = false;
-	vfe32_ctrl->hfr_mode = HFR_MODE_OFF;
-
-	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;
-
-	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);
-}
-
-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);
-	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 (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);
-		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, bus_vector_idx = 0;
-	uint32_t reg_update = 0;
-	uint32_t vfe_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:
-		if (!axi_ctrl->share_ctrl->dual_enabled)
-			msm_camio_bus_scale_cfg(
-			pmctl->sdata->pdata->cam_bus_scale_table, S_PREVIEW);
-		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 (cpu_is_msm8930() || cpu_is_msm8930aa() ||
-			cpu_is_msm8930ab()) {
-			if (axi_ctrl->share_ctrl->current_mode &
-				VFE_OUTPUTS_PREVIEW_AND_VIDEO
-			|| axi_ctrl->share_ctrl->current_mode &
-				VFE_OUTPUTS_VIDEO_AND_PREVIEW)
-				bus_vector_idx = S_VIDEO;
-			else
-				bus_vector_idx = S_ADV_VIDEO;
-		} else {
-			bus_vector_idx = S_VIDEO;
-		}
-		if (!axi_ctrl->share_ctrl->dual_enabled)
-			msm_camio_bus_scale_cfg(
-			pmctl->sdata->pdata->cam_bus_scale_table,
-			bus_vector_idx);
-		return;
-	case AXI_CMD_ZSL:
-		if (!axi_ctrl->share_ctrl->dual_enabled)
-			msm_camio_bus_scale_cfg(
-			pmctl->sdata->pdata->cam_bus_scale_table, S_ZSL);
-		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(1, 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]);
-	}
-
-	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 (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);
-	int bus_vector_idx = 0;
-
-	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) {
-			bus_vector_idx = S_VIDEO;
-
-			if (cpu_is_msm8930() || cpu_is_msm8930aa() ||
-				cpu_is_msm8930ab())
-				bus_vector_idx = S_ADV_VIDEO;
-
-			msm_camio_bus_scale_cfg(
-			pmctl->sdata->pdata->cam_bus_scale_table,
-			bus_vector_idx);
-		}
-		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);
-		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 (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));
-	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_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;
-		}
-	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(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_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;
-	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 (axi_ctrl->share_ctrl->comp_output_mode &
-		VFE32_OUTPUT_MODE_TERTIARY1)
-		if (irqstatus & (0x1 << (axi_ctrl->share_ctrl->outpath.out2.ch0
-			+ VFE_WM_OFFSET)))
-			vfe32_process_output_path_irq_rdi0(axi_ctrl);
-	if (axi_ctrl->share_ctrl->comp_output_mode &
-		VFE32_OUTPUT_MODE_TERTIARY2)
-		if (irqstatus & (0x1 << (axi_ctrl->share_ctrl->outpath.out3.ch0
-			+ VFE_WM_OFFSET)))
-			vfe32_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)) {
-			uint32_t mode =
-				(axi_ctrl->share_ctrl->operation_mode &
-				~(VFE_OUTPUTS_RDI0|VFE_OUTPUTS_RDI1));
-			uint16_t output_mode =
-			axi_ctrl->share_ctrl->comp_output_mode &
-				~(VFE32_OUTPUT_MODE_TERTIARY1|
-				VFE32_OUTPUT_MODE_TERTIARY2);
-			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);
-		}
-	}
-
-	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;
-	}
-}
-
-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_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 = 0;
-	return 0;
-
-vfe32_no_resource:
-	kfree(vfe32_ctrl);
-	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/platform/msm/camera_v1/vfe/msm_vfe32.h b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe32.h
deleted file mode 100644
index fa4e0bd..0000000
--- a/drivers/media/platform/msm/camera_v1/vfe/msm_vfe32.h
+++ /dev/null
@@ -1,1078 +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_VFE32_H__
-#define __MSM_VFE32_H__
-
-#include <linux/bitops.h>
-#include "msm_vfe_stats_buf.h"
-
-#define TRUE  1
-#define FALSE 0
-
-#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
-#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_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_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_STATUS1_RDI0_REG_UPDATE_MASK  0x4000000 /*bit 26*/
-#define VFE_IRQ_STATUS1_RDI1_REG_UPDATE_MASK  0x8000000 /*bit 27*/
-
-/*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*/
-
-/* 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 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 VFE32_DMI_RAM_SEL {
-	NO_MEM_SELECTED          = 0,
-	BLACK_LUT_RAM_BANK0      = 0x1,
-	BLACK_LUT_RAM_BANK1      = 0x2,
-	ROLLOFF_RAM0_BANK0       = 0x3,
-	DEMOSAIC_LUT_RAM_BANK0   = 0x4,
-	DEMOSAIC_LUT_RAM_BANK1   = 0x5,
-	STATS_BHIST_RAM0         = 0x6,
-	STATS_BHIST_RAM1         = 0x7,
-	RGBLUT_RAM_CH0_BANK0     = 0x8,
-	RGBLUT_RAM_CH0_BANK1     = 0x9,
-	RGBLUT_RAM_CH1_BANK0     = 0xa,
-	RGBLUT_RAM_CH1_BANK1     = 0xb,
-	RGBLUT_RAM_CH2_BANK0     = 0xc,
-	RGBLUT_RAM_CH2_BANK1     = 0xd,
-	RGBLUT_CHX_BANK0         = 0xe,
-	RGBLUT_CHX_BANK1         = 0xf,
-	STATS_IHIST_RAM          = 0x10,
-	LUMA_ADAPT_LUT_RAM_BANK0 = 0x11,
-	LUMA_ADAPT_LUT_RAM_BANK1 = 0x12,
-	ROLLOFF_RAM1_BANK0       = 0x13,
-	ROLLOFF_RAM0_BANK1       = 0x14,
-	ROLLOFF_RAM1_BANK1       = 0x15,
-};
-
-enum vfe_output_state {
-	VFE_STATE_IDLE,
-	VFE_STATE_START_REQUESTED,
-	VFE_STATE_STARTED,
-	VFE_STATE_STOP_REQUESTED,
-	VFE_STATE_STOPPED,
-};
-
-#define V32_CAMIF_OFF             0x000001E4
-#define V32_CAMIF_LEN             32
-
-#define V32_DEMUX_OFF             0x00000284
-#define V32_DEMUX_LEN             20
-
-#define V32_DEMOSAICV3_0_OFF      0x00000298
-#define V32_DEMOSAICV3_0_LEN      4
-#define V32_DEMOSAICV3_1_OFF      0x0000061C
-#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_AXI_BUS_CMD_OFF       0x00000038
-#define V32_AXI_OUT_OFF           0x0000003C
-#define V32_AXI_OUT_LEN           252
-#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_FRAME_SKIP_OFF        0x00000504
-#define V32_FRAME_SKIP_LEN        32
-
-#define V32_CHROMA_SUBS_OFF       0x000004F8
-#define V32_CHROMA_SUBS_LEN       12
-
-#define V32_FOV_OFF           0x00000360
-#define V32_FOV_LEN           8
-
-#define V32_MAIN_SCALER_OFF 0x00000368
-#define V32_MAIN_SCALER_LEN 28
-
-#define V32_S2Y_OFF 0x000004D0
-#define V32_S2Y_LEN 20
-
-#define V32_S2CbCr_OFF 0x000004E4
-#define V32_S2CbCr_LEN 20
-
-#define V32_CHROMA_EN_OFF 0x000003C4
-#define V32_CHROMA_EN_LEN 36
-
-#define V32_SYNC_TIMER_OFF      0x0000020C
-#define V32_SYNC_TIMER_POLARITY_OFF 0x00000234
-#define V32_TIMER_SELECT_OFF        0x0000025C
-#define V32_SYNC_TIMER_LEN 28
-
-#define V32_ASYNC_TIMER_OFF 0x00000238
-#define V32_ASYNC_TIMER_LEN 28
-
-#define V32_BLACK_LEVEL_OFF 0x00000264
-#define V32_BLACK_LEVEL_LEN 16
-
-#define V32_MESH_ROLL_OFF_CFG_OFF             0x00000274
-#define V32_MESH_ROLL_OFF_CFG_LEN             16
-#define V32_MESH_ROLL_OFF_INIT_TABLE_SIZE     13
-#define V32_MESH_ROLL_OFF_DELTA_TABLE_SIZE    208
-#define V32_MESH_ROLL_OFF_DELTA_TABLE_OFFSET  32
-#define V32_GAMMA_LUT_BANK_SEL_MASK           0x00000007
-
-#define V33_PCA_ROLL_OFF_CFG_LEN1             16
-#define V33_PCA_ROLL_OFF_CFG_OFF1             0x00000274
-#define V33_PCA_ROLL_OFF_CFG_LEN2             12
-#define V33_PCA_ROLL_OFF_CFG_OFF2             0x000007A8
-#define V33_PCA_ROLL_OFF_TABLE_SIZE           (17 + (13*4))
-#define V33_PCA_ROLL_OFF_LUT_BANK_SEL_MASK    0x00010000
-
-#define V32_COLOR_COR_OFF 0x00000388
-#define V32_COLOR_COR_LEN 52
-
-#define V32_WB_OFF 0x00000384
-#define V32_WB_LEN 4
-
-#define V32_RGB_G_OFF 0x000003BC
-#define V32_RGB_G_LEN 4
-
-#define V32_LA_OFF 0x000003C0
-#define V32_LA_LEN 4
-
-#define V32_SCE_OFF 0x00000418
-#define V32_SCE_LEN 136
-
-#define V32_CHROMA_SUP_OFF 0x000003E8
-#define V32_CHROMA_SUP_LEN 12
-
-#define V32_MCE_OFF 0x000003F4
-#define V32_MCE_LEN 36
-#define V32_STATS_AF_OFF 0x0000053c
-#define V32_STATS_AF_LEN 16
-
-#define V32_STATS_AE_OFF 0x00000534
-#define V32_STATS_AE_LEN 8
-
-#define V32_STATS_AWB_OFF 0x0000054c
-#define V32_STATS_AWB_LEN 32
-
-#define V32_STATS_IHIST_OFF 0x0000057c
-#define V32_STATS_IHIST_LEN 8
-
-#define V32_STATS_RS_OFF 0x0000056c
-#define V32_STATS_RS_LEN 8
-
-#define V32_STATS_CS_OFF 0x00000574
-#define V32_STATS_CS_LEN 8
-
-
-#define V32_ASF_OFF 0x000004A0
-#define V32_ASF_LEN 48
-#define V32_ASF_UPDATE_LEN 36
-
-#define V32_CAPTURE_LEN 4
-
-#define V32_GET_HW_VERSION_OFF 0
-#define V32_GET_HW_VERSION_LEN 4
-
-#define V32_LINEARIZATION_OFF1 0x00000264
-#define V32_LINEARIZATION_LEN1 16
-
-#define V32_LINEARIZATION_OFF2 0x0000067C
-#define V32_LINEARIZATION_LEN2 52
-
-#define V32_DEMOSAICV3_OFF 0x00000298
-#define V32_DEMOSAICV3_LEN 4
-
-#define V32_DEMOSAICV3_DBPC_CFG_OFF  0x0000029C
-#define V32_DEMOSAICV3_DBPC_LEN 4
-
-#define V32_DEMOSAICV3_DBPC_CFG_OFF0 0x000002a0
-#define V32_DEMOSAICV3_DBPC_CFG_OFF1 0x00000604
-#define V32_DEMOSAICV3_DBPC_CFG_OFF2 0x00000608
-
-#define V32_DEMOSAICV3_DBCC_OFF 0x0000060C
-#define V32_DEMOSAICV3_DBCC_LEN 16
-
-#define V32_DEMOSAICV3_ABF_OFF 0x000002A4
-#define V32_DEMOSAICV3_ABF_LEN 180
-
-#define V32_MODULE_CFG_OFF 0x00000010
-#define V32_MODULE_CFG_LEN 4
-
-#define V32_ASF_SPECIAL_EFX_CFG_OFF 0x000005FC
-#define V32_ASF_SPECIAL_EFX_CFG_LEN 4
-
-#define V32_CLF_CFG_OFF 0x000006B0
-#define V32_CLF_CFG_LEN 72
-
-#define V32_CLF_LUMA_UPDATE_OFF 0x000006B4
-#define V32_CLF_LUMA_UPDATE_LEN 60
-
-#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;
-	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 VFE32_GAMMA_NUM_ENTRIES  64
-
-#define VFE32_LA_TABLE_LENGTH    64
-
-#define VFE32_LINEARIZATON_TABLE_LENGTH    36
-
-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 vfe32_irq_status {
-	uint32_t vfeIrqStatus0;
-	uint32_t vfeIrqStatus1;
-	uint32_t camifStatus;
-	uint32_t demosaicStatus;
-	uint32_t asfMaxEdge;
-};
-
-#define V32_PREVIEW_AXI_FLAG  0x00000001
-#define V32_SNAPSHOT_AXI_FLAG (0x00000001<<1)
-
-struct vfe32_cmd_type {
-	uint16_t id;
-	uint32_t length;
-	uint32_t offset;
-	uint32_t flag;
-};
-
-struct vfe32_free_buf {
-	struct list_head node;
-	uint32_t paddr;
-	uint32_t y_off;
-	uint32_t cbcr_off;
-};
-
-struct vfe32_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;
-	int32_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_CAMIF_ERROR               (0x00000001<<0)
-#define VFE32_IMASK_BHIST_OVWR                (0x00000001<<1)
-#define VFE32_IMASK_STATS_CS_OVWR             (0x00000001<<2)
-#define VFE32_IMASK_STATS_IHIST_OVWR          (0x00000001<<3)
-#define VFE32_IMASK_REALIGN_BUF_Y_OVFL        (0x00000001<<4)
-#define VFE32_IMASK_REALIGN_BUF_CB_OVFL       (0x00000001<<5)
-#define VFE32_IMASK_REALIGN_BUF_CR_OVFL       (0x00000001<<6)
-#define VFE32_IMASK_VIOLATION                 (0x00000001<<7)
-#define VFE32_IMASK_IMG_MAST_0_BUS_OVFL       (0x00000001<<8)
-#define VFE32_IMASK_IMG_MAST_1_BUS_OVFL       (0x00000001<<9)
-#define VFE32_IMASK_IMG_MAST_2_BUS_OVFL       (0x00000001<<10)
-#define VFE32_IMASK_IMG_MAST_3_BUS_OVFL       (0x00000001<<11)
-#define VFE32_IMASK_IMG_MAST_4_BUS_OVFL       (0x00000001<<12)
-#define VFE32_IMASK_IMG_MAST_5_BUS_OVFL       (0x00000001<<13)
-#define VFE32_IMASK_IMG_MAST_6_BUS_OVFL       (0x00000001<<14)
-#define VFE32_IMASK_STATS_AE_BG_BUS_OVFL      (0x00000001<<15)
-#define VFE32_IMASK_STATS_AF_BF_BUS_OVFL      (0x00000001<<16)
-#define VFE32_IMASK_STATS_AWB_BUS_OVFL        (0x00000001<<17)
-#define VFE32_IMASK_STATS_RS_BUS_OVFL         (0x00000001<<18)
-#define VFE32_IMASK_STATS_CS_BUS_OVFL         (0x00000001<<19)
-#define VFE32_IMASK_STATS_IHIST_BUS_OVFL      (0x00000001<<20)
-#define VFE32_IMASK_STATS_SKIN_BHIST_BUS_OVFL (0x00000001<<21)
-#define VFE32_IMASK_AXI_ERROR                 (0x00000001<<22)
-
-#define VFE_COM_STATUS 0x000FE000
-
-struct vfe32_output_path {
-	uint16_t output_mode;     /* bitmask  */
-
-	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_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_AXI_CMD                     0x000001D8
-#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_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_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_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_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
-#define VFE_RDI1_CFG                    0x000007A4
-
-#define VFE_VIOLATION_STATUS            0x000007B4
-
-#define VFE33_DMI_DATA_HI               0x000005A0
-#define VFE33_DMI_DATA_LO               0x000005A4
-
-#define VFE_AXI_CFG_MASK                0xFFFFFFFF
-
-#define VFE32_OUTPUT_MODE_PT			BIT(0)
-#define VFE32_OUTPUT_MODE_S			BIT(1)
-#define VFE32_OUTPUT_MODE_V			BIT(2)
-#define VFE32_OUTPUT_MODE_P			BIT(3)
-#define VFE32_OUTPUT_MODE_T			BIT(4)
-#define VFE32_OUTPUT_MODE_P_ALL_CHNLS		BIT(5)
-#define VFE32_OUTPUT_MODE_PRIMARY		BIT(6)
-#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)
-
-struct vfe_stats_control {
-	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;
-	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 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;
-
-};
-
-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 *vfeio;
-	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;
-};
-
-struct vfe32_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_VFE32_H__ */
diff --git a/drivers/media/platform/msm/camera_v1/vfe/msm_vfe40.c b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe40.c
deleted file mode 100644
index 5a96a79..0000000
--- a/drivers/media/platform/msm/camera_v1/vfe/msm_vfe40.c
+++ /dev/null
@@ -1,6478 +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},
-	[163] = {VFE_CMD_STATS_BE_START, V40_STATS_BE_LEN, V40_STATS_BE_OFF},
-	[164] = {VFE_CMD_STATS_BE_STOP},
-};
-
-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  = 274406400,
-		.ib  = 617103360,
-	},
-};
-
-static struct msm_bus_vectors vfe_liveshot_vectors[] = {
-	{
-		.src = MSM_BUS_MASTER_VFE,
-		.dst = MSM_BUS_SLAVE_EBI_CH0,
-		.ab  = 348192000,
-		.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,
-	},
-	{
-		ARRAY_SIZE(vfe_liveshot_vectors),
-		vfe_liveshot_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);
-	}
-
-}
-
-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(0x82F80007,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_RS_WR_UB_CFG);
-	msm_camera_io_w(0x8300000F,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_CS_WR_UB_CFG);
-
-	msm_camera_io_w(0x8310003F,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_BG_WR_UB_CFG);
-	msm_camera_io_w(0x8350003F,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_BE_WR_UB_CFG);
-	msm_camera_io_w(0x8390003F,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_BF_WR_UB_CFG);
-
-	msm_camera_io_w(0x83D0000F,
-	vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_HIST_WR_UB_CFG);
-	msm_camera_io_w(0x83E0000F,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_SKIN_WR_UB_CFG);
-
-	msm_camera_io_w(0x83F0000F,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_AWB_WR_UB_CFG);
-
-	/* stats frame subsample config*/
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_HIST_WR_FRAMEDROP_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_BG_WR_FRAMEDROP_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_BE_WR_FRAMEDROP_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_BF_WR_FRAMEDROP_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_RS_WR_FRAMEDROP_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_CS_WR_FRAMEDROP_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_SKIN_WR_FRAMEDROP_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_AWB_WR_FRAMEDROP_PATTERN);
-
-	/* stats irq subsample config*/
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_HIST_WR_IRQ_SUBSAMPLE_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_BG_WR_IRQ_SUBSAMPLE_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_BE_WR_IRQ_SUBSAMPLE_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_BF_WR_IRQ_SUBSAMPLE_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_RS_WR_IRQ_SUBSAMPLE_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_CS_WR_IRQ_SUBSAMPLE_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_SKIN_WR_IRQ_SUBSAMPLE_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_AWB_WR_IRQ_SUBSAMPLE_PATTERN);
-
-	vfe40_reset_dmi_tables(vfe40_ctrl);
-}
-
-static void vfe40_reset_internal_variables(
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	/* Stats control variables. */
-	memset(&(vfe40_ctrl->bfStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe40_ctrl->awbStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe40_ctrl->bgStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe40_ctrl->beStatsControl), 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\n",
-			__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\n", __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\n",
-			__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_be_buf_init(
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	uint32_t addr;
-	unsigned long flags;
-	uint32_t stats_type;
-
-	stats_type = MSM_STATS_TYPE_BE;
-	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 BE ping buf from free buf queue\n",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_BE_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 BE pong buf from free buf queue\n",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_BE_WR_PONG_ADDR);
-	return 0;
-}
-
-static uint32_t vfe_stats_bg_buf_init(
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	uint32_t addr;
-	unsigned long flags;
-	uint32_t stats_type;
-
-	stats_type = 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/Bg ping buf from free buf queue\n",
-			__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/Bg pong buf from free buf queue\n",
-			__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_bf_buf_init(
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	uint32_t addr;
-	unsigned long flags;
-	int rc = 0;
-
-	uint32_t stats_type;
-	stats_type = 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_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_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: {
-		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_BE_START:
-	case VFE_CMD_STATS_BF_START:
-	case VFE_CMD_STATS_BHIST_START: {
-		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_BE_START == cmd->id) {
-			module_val |= BE_ENABLE_MASK;
-			rc = vfe_stats_be_buf_init(vfe40_ctrl);
-			if (rc < 0) {
-				pr_err("%s: cannot config ping/pong address of BG",
-					__func__);
-				goto proc_general_done;
-			}
-		} else if (VFE_CMD_STATS_BG_START == cmd->id) {
-			module_val |= BG_ENABLE_MASK;
-			rc = vfe_stats_bg_buf_init(vfe40_ctrl);
-			if (rc < 0) {
-				pr_err("%s: cannot config ping/pong address of BG",
-					__func__);
-				goto proc_general_done;
-			}
-		} else if (VFE_CMD_STATS_BF_START == cmd->id) {
-			module_val |= BF_ENABLE_MASK;
-			rc = vfe_stats_bf_buf_init(vfe40_ctrl);
-			if (rc < 0) {
-				pr_err("%s: cannot config ping/pong address of BF",
-					__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 BHist",
-					__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: {
-		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_BG_STOP: {
-		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_BF_STOP: {
-		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);
-
-		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_STATS_BE_STOP: {
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~BE_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_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);
-		}
-		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;
-				msm_camera_io_w_mb(1, share_ctrl->vfebase +
-				VFE_REG_UPDATE_CMD);
-		}
-		break;
-	case VFE_STATE_STARTED:
-		CDBG("%s disabling liveshot output\n", __func__);
-		if (share_ctrl->vfe_capture_count >= 1) {
-			if (share_ctrl->vfe_capture_count == 1 &&
-				(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]);
-				msm_camera_io_w_mb(1, share_ctrl->vfebase +
-					VFE_REG_UPDATE_CMD);
-			}
-			share_ctrl->vfe_capture_count--;
-		}
-		break;
-	case VFE_STATE_STOP_REQUESTED:
-		CDBG("%s disabling liveshot output from stream off\n",
-			__func__);
-		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("%s:statsNum %d, pingpongStatus %d\n", __func__,
-		 statsNum, pingpongStatus);
-	pingpongAddr =
-		((uint32_t)(vfe40_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_PING_PONG_BASE)) +
-				(VFE_STATS_BUS_REG_NUM*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 statsBgNum:{
-		msgStats.id = MSG_ID_STATS_BG;
-		stats_type = 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 statsBeNum:{
-		msgStats.id = MSG_ID_STATS_BE;
-		stats_type = MSM_STATS_TYPE_BE;
-		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 statsBfNum:{
-		msgStats.id = MSG_ID_STATS_BF;
-		stats_type =  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->bgStatsControl.bufToRender;
-	msgStats.awb.buff = vfe40_ctrl->awbStatsControl.bufToRender;
-	msgStats.af.buff = vfe40_ctrl->bfStatsControl.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_be_irq(struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	unsigned long flags;
-	uint32_t addr;
-	uint32_t stats_type;
-	stats_type = MSM_STATS_TYPE_BE;
-	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->beStatsControl.bufToRender =
-			vfe40_process_stats_irq_common(vfe40_ctrl, statsBeNum,
-			addr);
-
-		vfe_send_stats_msg(vfe40_ctrl,
-			vfe40_ctrl->beStatsControl.bufToRender, statsBeNum);
-	} else{
-		vfe40_ctrl->beStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe40_ctrl->beStatsControl.droppedStatsFrameCount);
-	}
-}
-
-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 = 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->bgStatsControl.bufToRender =
-			vfe40_process_stats_irq_common(vfe40_ctrl, statsBgNum,
-			addr);
-
-		vfe_send_stats_msg(vfe40_ctrl,
-			vfe40_ctrl->bgStatsControl.bufToRender, statsBgNum);
-	} else{
-		vfe40_ctrl->bgStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe40_ctrl->bgStatsControl.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 = 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->bfStatsControl.bufToRender =
-			vfe40_process_stats_irq_common(vfe40_ctrl, statsBfNum,
-			addr);
-
-		vfe_send_stats_msg(vfe40_ctrl,
-			vfe40_ctrl->bfStatsControl.bufToRender, statsBfNum);
-	} else{
-		vfe40_ctrl->bfStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe40_ctrl->bfStatsControl.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 = MSM_STATS_TYPE_BE;
-	if (status_bits & VFE_IRQ_STATUS0_STATS_BE) {
-		addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl,
-				stats_type);
-		if (addr) {
-			vfe40_ctrl->beStatsControl.bufToRender =
-				vfe40_process_stats_irq_common(
-				vfe40_ctrl, statsBeNum, addr);
-			process_stats = true;
-		} else{
-			vfe40_ctrl->beStatsControl.bufToRender = 0;
-			vfe40_ctrl->beStatsControl.droppedStatsFrameCount++;
-		}
-	} else {
-		vfe40_ctrl->beStatsControl.bufToRender = 0;
-	}
-
-	stats_type = 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->bgStatsControl.bufToRender =
-				vfe40_process_stats_irq_common(
-				vfe40_ctrl, statsBgNum, addr);
-			process_stats = true;
-		} else{
-			vfe40_ctrl->bgStatsControl.bufToRender = 0;
-			vfe40_ctrl->bgStatsControl.droppedStatsFrameCount++;
-		}
-	} else {
-		vfe40_ctrl->bgStatsControl.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 = 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->bfStatsControl.bufToRender =
-				vfe40_process_stats_irq_common(
-				vfe40_ctrl, statsBfNum,
-				addr);
-			process_stats = true;
-		} else {
-			vfe40_ctrl->bfStatsControl.bufToRender = 0;
-			vfe40_ctrl->bfStatsControl.droppedStatsFrameCount++;
-		}
-	} else {
-		vfe40_ctrl->bfStatsControl.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_BE:
-		CDBG("Stats BE irq occured.\n");
-		vfe40_process_stats_be_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_BE) |
-				(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_BE)
-					v4l2_subdev_notify(&vfe40_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_STATS_BE);
-
-				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->vfeInterruptStatus1 &
-						VFE_IRQ_STATUS1_SYNC_TIMER0)
-					v4l2_subdev_notify(&vfe40_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS1_SYNC_TIMER0);
-
-				if (qcmd->vfeInterruptStatus1 &
-						VFE_IRQ_STATUS1_SYNC_TIMER1)
-					v4l2_subdev_notify(&vfe40_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS1_SYNC_TIMER1);
-
-				if (qcmd->vfeInterruptStatus1 &
-						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_BE_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_BE_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_BE_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(0x1,
-		vfe_vbif_base + VFE40_VBIF_CLKON);
-	msm_camera_io_w(0x01010101,
-		vfe_vbif_base + VFE40_VBIF_IN_RD_LIM_CONF0);
-	msm_camera_io_w(0x01010101,
-		vfe_vbif_base + VFE40_VBIF_IN_RD_LIM_CONF1);
-	msm_camera_io_w(0x10010110,
-		vfe_vbif_base + VFE40_VBIF_IN_RD_LIM_CONF2);
-	msm_camera_io_w(0x10101010,
-		vfe_vbif_base + VFE40_VBIF_IN_WR_LIM_CONF0);
-	msm_camera_io_w(0x10101010,
-		vfe_vbif_base + VFE40_VBIF_IN_WR_LIM_CONF1);
-	msm_camera_io_w(0x10101010,
-		vfe_vbif_base + VFE40_VBIF_IN_WR_LIM_CONF2);
-	msm_camera_io_w(0x00001010,
-		vfe_vbif_base + VFE40_VBIF_OUT_RD_LIM_CONF0);
-	msm_camera_io_w(0x00001010,
-		vfe_vbif_base + VFE40_VBIF_OUT_WR_LIM_CONF0);
-	msm_camera_io_w(0x00000707,
-		vfe_vbif_base + VFE40_VBIF_DDR_OUT_MAX_BURST);
-	msm_camera_io_w(0x00000707,
-		vfe_vbif_base + VFE40_VBIF_OCMEM_OUT_MAX_BURST);
-	msm_camera_io_w(0x00000030,
-		vfe_vbif_base + VFE40_VBIF_ARB_CTL);
-	msm_camera_io_w(0x04210842,
-		vfe_vbif_base + VFE40_VBIF_DDR_ARB_CONF0);
-	msm_camera_io_w(0x04210842,
-		vfe_vbif_base + VFE40_VBIF_DDR_ARB_CONF1);
-	msm_camera_io_w(0x00000001,
-		vfe_vbif_base + VFE40_VBIF_ROUND_ROBIN_QOS_ARB);
-	msm_camera_io_w(0x22222222,
-		vfe_vbif_base + VFE40_VBIF_OUT_AXI_AMEMTYPE_CONF0);
-	msm_camera_io_w(0x00002222,
-		vfe_vbif_base + VFE40_VBIF_OUT_AXI_AMEMTYPE_CONF1);
-	msm_camera_io_w(0x00000FFF,
-		vfe_vbif_base + VFE40_VBIF_OUT_AXI_AOOO_EN);
-	msm_camera_io_w(0x0FFF0FFF,
-		vfe_vbif_base + VFE40_VBIF_OUT_AXI_AOOO);
-}
-
-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;
-	/*enable bayer stats by default*/
-	vfe40_ctrl->ver_num.main = 4;
-
-	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/platform/msm/camera_v1/vfe/msm_vfe40.h b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe40.h
deleted file mode 100644
index 2b32203..0000000
--- a/drivers/media/platform/msm/camera_v1/vfe/msm_vfe40.h
+++ /dev/null
@@ -1,1063 +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_WR_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_OCMEM_OUT_MAX_BURST		0xDC
-#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_AMEMTYPE_CONF0	0x160
-#define VFE40_VBIF_OUT_AXI_AMEMTYPE_CONF1	0x164
-#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 beStatsControl;
-	struct vfe_stats_control bfStatsControl;
-	struct vfe_stats_control awbStatsControl;
-	struct vfe_stats_control bgStatsControl;
-	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 statsBeNum      0
-#define statsBgNum      1
-#define statsBfNum      2
-#define statsAwbNum     3
-#define statsRsNum      4
-#define statsCsNum      5
-#define statsIhistNum   6
-#define statsSkinNum    7
-
-#define VFE_STATS_BUS_REG_NUM  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/platform/msm/camera_v1/vfe/msm_vfe40_axi.c b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe40_axi.c
deleted file mode 100644
index 88a219c..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vfe/msm_vfe7x.c b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe7x.c
deleted file mode 100644
index d7ec547..0000000
--- a/drivers/media/platform/msm/camera_v1/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/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/platform/msm/camera_v1/vfe/msm_vfe7x.h b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe7x.h
deleted file mode 100644
index 944bfea..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vfe/msm_vfe7x27a.c b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe7x27a.c
deleted file mode 100644
index 6b41b03..0000000
--- a/drivers/media/platform/msm/camera_v1/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/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/platform/msm/camera_v1/vfe/msm_vfe7x27a.h b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe7x27a.h
deleted file mode 100644
index fbebb60..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vfe/msm_vfe7x27a_v4l2.c b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe7x27a_v4l2.c
deleted file mode 100644
index 3a8f1b2..0000000
--- a/drivers/media/platform/msm/camera_v1/vfe/msm_vfe7x27a_v4l2.c
+++ /dev/null
@@ -1,2479 +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/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;
-			}
-			if (vfe2x_ctrl->liveshot_enabled)
-				free_buf = vfe2x_check_free_buffer(
-					VFE_MSG_OUTPUT_IRQ,
-					VFE_MSG_V2X_LIVESHOT_PRIMARY);
-			else
-				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 ||
-				path == VFE_MSG_V2X_LIVESHOT_PRIMARY)
-			outch = &vfe2x_ctrl->snap;
-		else if (path == VFE_MSG_OUTPUT_SECONDARY)
-			outch = &vfe2x_ctrl->thumb;
-	} else {
-		if (path == VFE_MSG_OUTPUT_PRIMARY ||
-				path == VFE_MSG_V2X_LIVESHOT_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 ||
-				path == VFE_MSG_V2X_LIVESHOT_PRIMARY)
-			outch = &vfe2x_ctrl->snap;
-		else if (path == VFE_MSG_OUTPUT_SECONDARY)
-			outch = &vfe2x_ctrl->thumb;
-	} else {
-		if (path == VFE_MSG_OUTPUT_PRIMARY ||
-				path == VFE_MSG_V2X_LIVESHOT_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 ||
-					path == VFE_MSG_V2X_LIVESHOT_PRIMARY)
-			ch = &vfe2x_ctrl->snap;
-	} else {
-		if (path == VFE_MSG_OUTPUT_PRIMARY ||
-					path == VFE_MSG_V2X_LIVESHOT_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_AXI_START:
-	case CMD_AXI_STOP:
-	case CMD_AXI_RESET:
-		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;
-					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/platform/msm/camera_v1/vfe/msm_vfe7x27a_v4l2.h b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe7x27a_v4l2.h
deleted file mode 100644
index 78b1929..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vfe/msm_vfe8x.c b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe8x.c
deleted file mode 100644
index 953d634..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vfe/msm_vfe8x.h b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe8x.h
deleted file mode 100644
index 54e9c95..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vfe/msm_vfe8x_proc.c b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe8x_proc.c
deleted file mode 100644
index 4ebb30d..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vfe/msm_vfe8x_proc.h b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe8x_proc.h
deleted file mode 100644
index 4e18c7c..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vfe/msm_vfe_stats_buf.c b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe_stats_buf.c
deleted file mode 100644
index a550d78..0000000
--- a/drivers/media/platform/msm/camera_v1/vfe/msm_vfe_stats_buf.c
+++ /dev/null
@@ -1,476 +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 <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;
-}
-
-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);
-
-	bufq = stats_ctrl->bufq[info->type];
-	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;
-	}
-#else
-	paddr = 0;
-	file = NULL;
-	kvstart = 0;
-#endif
-	if (!info->len)
-		info->len = len;
-	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;
-#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);
-#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);
-	bufq = stats_ctrl->bufq[stats_type];
-	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);
-#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;
-
-	D("%s: type : %d\n", __func__, stats_type);
-	bufq = stats_ctrl->bufq[stats_type];
-
-	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;
-	bufq = stats_ctrl->bufq[stats_type];
-
-	list_for_each_entry(stats_buf, &bufq->head, list) {
-		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);
-	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);
-
-	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;
-	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/platform/msm/camera_v1/vfe/msm_vfe_stats_buf.h b/drivers/media/platform/msm/camera_v1/vfe/msm_vfe_stats_buf.h
deleted file mode 100644
index 6a1c79d..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vx6953.c b/drivers/media/platform/msm/camera_v1/vx6953.c
deleted file mode 100644
index cc09a0d..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vx6953.h b/drivers/media/platform/msm/camera_v1/vx6953.h
deleted file mode 100644
index 175facc..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vx6953_reg.c b/drivers/media/platform/msm/camera_v1/vx6953_reg.c
deleted file mode 100644
index eee6904..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vx6953_reg_v4l2.c b/drivers/media/platform/msm/camera_v1/vx6953_reg_v4l2.c
deleted file mode 100644
index 8b1c1be..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vx6953_v4l2.c b/drivers/media/platform/msm/camera_v1/vx6953_v4l2.c
deleted file mode 100644
index 7913752..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v1/vx6953_v4l2.h b/drivers/media/platform/msm/camera_v1/vx6953_v4l2.h
deleted file mode 100644
index 4c7e90f..0000000
--- a/drivers/media/platform/msm/camera_v1/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/platform/msm/camera_v2/isp/msm_isp_util.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp_util.c
index 5f36a4a..ea0195d 100644
--- a/drivers/media/platform/msm/camera_v2/isp/msm_isp_util.c
+++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp_util.c
@@ -513,7 +513,9 @@
 		}
 		lo_tbl_ptr = cfg_data +
 			reg_cfg_cmd->u.dmi_info.lo_tbl_offset/4;
-
+		if (reg_cfg_cmd->cmd_type == VFE_WRITE_DMI_64BIT)
+			reg_cfg_cmd->u.dmi_info.len =
+				reg_cfg_cmd->u.dmi_info.len / 2;
 		for (i = 0; i < reg_cfg_cmd->u.dmi_info.len/4; i++) {
 			lo_val = *lo_tbl_ptr++;
 			if (reg_cfg_cmd->cmd_type == VFE_WRITE_DMI_16BIT) {
@@ -621,6 +623,12 @@
 		goto reg_cfg_failed;
 	}
 
+	if (!proc_cmd->cmd_len) {
+		pr_err("%s: Passed cmd_len as 0\n", __func__);
+		rc = -EINVAL;
+		goto cfg_data_failed;
+	}
+
 	cfg_data = kzalloc(proc_cmd->cmd_len, GFP_KERNEL);
 	if (!cfg_data) {
 		pr_err("%s: cfg_data alloc failed\n", __func__);
diff --git a/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c b/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c
index 8b8d23b..2124b13 100644
--- a/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c
+++ b/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c
@@ -926,35 +926,35 @@
 
 	cpp_dev->cpp_open_cnt--;
 	if (cpp_dev->cpp_open_cnt == 0) {
-		pr_err("%s: irq_status: 0x%x\n", __func__,
+		pr_debug("irq_status: 0x%x\n",
 			msm_camera_io_r(cpp_dev->cpp_hw_base + 0x4));
-		pr_err("%s: DEBUG_SP: 0x%x\n", __func__,
+		pr_debug("DEBUG_SP: 0x%x\n",
 			msm_camera_io_r(cpp_dev->cpp_hw_base + 0x40));
-		pr_err("%s: DEBUG_T: 0x%x\n", __func__,
+		pr_debug("DEBUG_T: 0x%x\n",
 			msm_camera_io_r(cpp_dev->cpp_hw_base + 0x44));
-		pr_err("%s: DEBUG_N: 0x%x\n", __func__,
+		pr_debug("DEBUG_N: 0x%x\n",
 			msm_camera_io_r(cpp_dev->cpp_hw_base + 0x48));
-		pr_err("%s: DEBUG_R: 0x%x\n", __func__,
+		pr_debug("DEBUG_R: 0x%x\n",
 			msm_camera_io_r(cpp_dev->cpp_hw_base + 0x4C));
-		pr_err("%s: DEBUG_OPPC: 0x%x\n", __func__,
+		pr_debug("DEBUG_OPPC: 0x%x\n",
 			msm_camera_io_r(cpp_dev->cpp_hw_base + 0x50));
-		pr_err("%s: DEBUG_MO: 0x%x\n", __func__,
+		pr_debug("DEBUG_MO: 0x%x\n",
 			msm_camera_io_r(cpp_dev->cpp_hw_base + 0x54));
-		pr_err("%s: DEBUG_TIMER0: 0x%x\n", __func__,
+		pr_debug("DEBUG_TIMER0: 0x%x\n",
 			msm_camera_io_r(cpp_dev->cpp_hw_base + 0x60));
-		pr_err("%s: DEBUG_TIMER1: 0x%x\n", __func__,
+		pr_debug("DEBUG_TIMER1: 0x%x\n",
 			msm_camera_io_r(cpp_dev->cpp_hw_base + 0x64));
-		pr_err("%s: DEBUG_GPI: 0x%x\n", __func__,
+		pr_debug("DEBUG_GPI: 0x%x\n",
 			msm_camera_io_r(cpp_dev->cpp_hw_base + 0x70));
-		pr_err("%s: DEBUG_GPO: 0x%x\n", __func__,
+		pr_debug("DEBUG_GPO: 0x%x\n",
 			msm_camera_io_r(cpp_dev->cpp_hw_base + 0x74));
-		pr_err("%s: DEBUG_T0: 0x%x\n", __func__,
+		pr_debug("DEBUG_T0: 0x%x\n",
 			msm_camera_io_r(cpp_dev->cpp_hw_base + 0x80));
-		pr_err("%s: DEBUG_R0: 0x%x\n", __func__,
+		pr_debug("DEBUG_R0: 0x%x\n",
 			msm_camera_io_r(cpp_dev->cpp_hw_base + 0x84));
-		pr_err("%s: DEBUG_T1: 0x%x\n", __func__,
+		pr_debug("DEBUG_T1: 0x%x\n",
 			msm_camera_io_r(cpp_dev->cpp_hw_base + 0x88));
-		pr_err("%s: DEBUG_R1: 0x%x\n", __func__,
+		pr_debug("DEBUG_R1: 0x%x\n",
 			msm_camera_io_r(cpp_dev->cpp_hw_base + 0x8C));
 		msm_camera_io_w(0x0, cpp_dev->base + MSM_CPP_MICRO_CLKEN_CTL);
 		cpp_deinit_mem(cpp_dev);
@@ -1712,6 +1712,7 @@
 		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;
+		memset(&inst_info, 0, sizeof(struct msm_cpp_frame_info_t));
 		for (i = 0; i < MAX_ACTIVE_CPP_INSTANCE; i++) {
 			if (cpp_dev->cpp_subscribe_list[i].vfh == vfh) {
 				inst_info.inst_id = i;
diff --git a/drivers/media/platform/msm/camera_v2/pproc/vpe/msm_vpe.c b/drivers/media/platform/msm/camera_v2/pproc/vpe/msm_vpe.c
index 3aaff78..dc29199 100644
--- a/drivers/media/platform/msm/camera_v2/pproc/vpe/msm_vpe.c
+++ b/drivers/media/platform/msm/camera_v2/pproc/vpe/msm_vpe.c
@@ -1282,6 +1282,15 @@
 			return -EINVAL;
 		}
 
+		if ((u_stream_buff_info->num_buffs == 0) ||
+			(u_stream_buff_info->num_buffs >
+				MSM_CAMERA_MAX_STREAM_BUF)) {
+			pr_err("%s:%d: Invalid number of buffers\n", __func__,
+				__LINE__);
+			kfree(u_stream_buff_info);
+			mutex_unlock(&vpe_dev->mutex);
+			return -EINVAL;
+		}
 		k_stream_buff_info.num_buffs = u_stream_buff_info->num_buffs;
 		k_stream_buff_info.identity = u_stream_buff_info->identity;
 		k_stream_buff_info.buffer_info =
@@ -1425,6 +1434,7 @@
 		struct vpe_device *vpe_dev = v4l2_get_subdevdata(sd);
 		struct msm_camera_v4l2_ioctl_t *ioctl_ptr = arg;
 		struct msm_vpe_frame_info_t inst_info;
+		memset(&inst_info, 0, sizeof(struct msm_vpe_frame_info_t));
 		for (i = 0; i < MAX_ACTIVE_VPE_INSTANCE; i++) {
 			if (vpe_dev->vpe_subscribe_list[i].vfh == vfh) {
 				inst_info.inst_id = i;
diff --git a/drivers/media/platform/msm/camera_v2/sensor/cci/msm_cci.c b/drivers/media/platform/msm/camera_v2/sensor/cci/msm_cci.c
index aacc07b..4e1f73e 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/cci/msm_cci.c
+++ b/drivers/media/platform/msm/camera_v2/sensor/cci/msm_cci.c
@@ -479,7 +479,8 @@
 		return -EINVAL;
 	}
 
-	if (c_ctrl->cci_info->cci_i2c_master > MASTER_MAX) {
+	if (c_ctrl->cci_info->cci_i2c_master > MASTER_MAX
+			|| c_ctrl->cci_info->cci_i2c_master < 0) {
 		pr_err("%s:%d Invalid I2C master addr\n", __func__, __LINE__);
 		return -EINVAL;
 	}
@@ -524,7 +525,8 @@
 	enum cci_i2c_master_t master;
 	enum cci_i2c_queue_t queue = QUEUE_0;
 	cci_dev = v4l2_get_subdevdata(sd);
-	if (c_ctrl->cci_info->cci_i2c_master > MASTER_MAX) {
+	if (c_ctrl->cci_info->cci_i2c_master > MASTER_MAX
+			|| c_ctrl->cci_info->cci_i2c_master < 0) {
 		pr_err("%s:%d Invalid I2C master addr\n", __func__, __LINE__);
 		return -EINVAL;
 	}
@@ -661,7 +663,7 @@
 		CDBG("%s ref_count %d\n", __func__, cci_dev->ref_count);
 		master = c_ctrl->cci_info->cci_i2c_master;
 		CDBG("%s:%d master %d\n", __func__, __LINE__, master);
-		if (master < MASTER_MAX) {
+		if (master < MASTER_MAX && master >= 0) {
 			mutex_lock(&cci_dev->cci_master_info[master].mutex);
 			/* Set reset pending flag to TRUE */
 			cci_dev->cci_master_info[master].reset_pending = TRUE;
diff --git a/drivers/media/platform/msm/dvb/demux/mpq_dmx_plugin_common.c b/drivers/media/platform/msm/dvb/demux/mpq_dmx_plugin_common.c
index e3a539c..d3b9c0a 100644
--- a/drivers/media/platform/msm/dvb/demux/mpq_dmx_plugin_common.c
+++ b/drivers/media/platform/msm/dvb/demux/mpq_dmx_plugin_common.c
@@ -4036,6 +4036,13 @@
 				__func__);
 			return ret;
 		}
+
+		if (mpq_feed->sdmx_filter_handle ==
+			SDMX_INVALID_FILTER_HANDLE) {
+			MPQ_DVB_DBG_PRINT("%s: filter was stopped\n",
+				__func__);
+			return -ENODEV;
+		}
 	}
 
 	if (mpq_feed->sdmx_buf.pread + header->payload_length <
@@ -4089,6 +4096,13 @@
 
 		mutex_lock(&mpq_demux->mutex);
 
+		if (mpq_feed->sdmx_filter_handle ==
+			SDMX_INVALID_FILTER_HANDLE) {
+			MPQ_DVB_DBG_PRINT("%s: filter was stopped\n",
+					__func__);
+			return -ENODEV;
+		}
+
 		return ret;
 	}
 
@@ -4456,6 +4470,14 @@
 			return;
 		}
 
+		if (!header.payload_length) {
+			MPQ_DVB_DBG_PRINT(
+				"%s: warnning - video frame with 0 length, dropping\n",
+				__func__);
+			spin_unlock(&mpq_feed->video_info.video_buffer_lock);
+			continue;
+		}
+
 		packet.raw_data_len = header.payload_length;
 		packet.user_data_len = sizeof(meta_data);
 		mpq_streambuffer_get_buffer_handle(sbuf, 0,
diff --git a/drivers/media/platform/msm/vcap/Kconfig b/drivers/media/platform/msm/vcap/Kconfig
index 2bdcfbd..db3bc47 100644
--- a/drivers/media/platform/msm/vcap/Kconfig
+++ b/drivers/media/platform/msm/vcap/Kconfig
@@ -1,7 +1,6 @@
 config MSM_VCAP
 	tristate "Qualcomm MSM VCAP"
 	depends on VIDEO_DEV && VIDEO_V4L2
-	default y
 	---help---
 		Enables VCAP driver. This device allows for video capture and
 		video processing using the v4l2 api
diff --git a/drivers/media/platform/msm/vidc/hfi_packetization.c b/drivers/media/platform/msm/vidc/hfi_packetization.c
index 30ada3e..ae94287 100644
--- a/drivers/media/platform/msm/vidc/hfi_packetization.c
+++ b/drivers/media/platform/msm/vidc/hfi_packetization.c
@@ -803,7 +803,8 @@
 		pkt->rg_property_data[0] =
 			HFI_PROPERTY_PARAM_VDEC_PICTURE_TYPE_DECODE;
 		hfi = (struct hfi_enable_picture *) &pkt->rg_property_data[1];
-		hfi->picture_type = (u32) pdata;
+		hfi->picture_type =
+			((struct hfi_enable_picture *)pdata)->picture_type;
 		pkt->size += sizeof(u32) * 2;
 		break;
 	}
diff --git a/drivers/media/platform/msm/vidc/hfi_response_handler.c b/drivers/media/platform/msm/vidc/hfi_response_handler.c
index abdb039..3fd5d3a 100644
--- a/drivers/media/platform/msm/vidc/hfi_response_handler.c
+++ b/drivers/media/platform/msm/vidc/hfi_response_handler.c
@@ -1183,42 +1183,78 @@
 	callback(SESSION_GET_SEQ_HDR_DONE, &data_done);
 }
 
-void hfi_process_sys_property_info(
-		struct hfi_property_sys_image_version_info_type *pkt)
+static void hfi_process_sys_get_prop_image_version(
+		struct hfi_msg_sys_property_info_packet *pkt)
 {
 	int i = 0;
 	u32 smem_block_size = 0;
 	u8 *smem_table_ptr;
 	char version[256];
+	const u32 version_string_size = 128;
 	const u32 smem_image_index_venus = 14 * 128;
+	u8 *str_image_version;
+	int req_bytes;
 
-	if (!pkt || !pkt->string_size) {
+	req_bytes = pkt->size - sizeof(*pkt);
+	if (req_bytes < version_string_size ||
+			!pkt->rg_property_data[1] ||
+			pkt->num_properties > 1) {
+		dprintk(VIDC_ERR,
+				"hfi_process_sys_get_prop_image_version:bad_pkt: %d",
+				req_bytes);
+		return;
+	}
+	str_image_version = (u8 *)&pkt->rg_property_data[1];
+	/*
+	 * The version string returned by firmware includes null
+	 * characters at the start and in between. Replace the null
+	 * characters with space, to print the version info.
+	 */
+	for (i = 0; i < version_string_size; i++) {
+		if (str_image_version[i] != '\0')
+			version[i] = str_image_version[i];
+		else
+			version[i] = ' ';
+	}
+	version[i] = '\0';
+	dprintk(VIDC_DBG, "F/W version: %s\n", version);
+
+	smem_table_ptr = smem_get_entry(SMEM_IMAGE_VERSION_TABLE,
+			&smem_block_size);
+	if (smem_table_ptr &&
+			((smem_image_index_venus +
+				version_string_size) <= smem_block_size))
+		memcpy(smem_table_ptr + smem_image_index_venus,
+				str_image_version, version_string_size);
+}
+
+static void hfi_process_sys_property_info(
+		struct hfi_msg_sys_property_info_packet *pkt)
+{
+	if (!pkt) {
 		dprintk(VIDC_ERR, "%s: invalid param\n", __func__);
 		return;
 	}
-
-	if (pkt->string_size < sizeof(version)) {
-		/*
-		 * The version string returned by firmware includes null
-		 * characters at the start and in between. Replace the null
-		 * characters with space, to print the version info.
-		 */
-		for (i = 0; i < pkt->string_size; i++) {
-			if (pkt->str_image_version[i] != '\0')
-				version[i] = pkt->str_image_version[i];
-			else
-				version[i] = ' ';
-		}
-		version[i] = '\0';
-		dprintk(VIDC_DBG, "F/W version: %s\n", version);
+	if (pkt->size < sizeof(*pkt)) {
+		dprintk(VIDC_ERR,
+				"hfi_process_sys_property_info: bad_pkt_size\n");
+		return;
+	}
+	if (pkt->num_properties == 0) {
+		dprintk(VIDC_ERR,
+				"hfi_process_sys_property_info: no_properties\n");
+		return;
 	}
 
-	smem_table_ptr = smem_get_entry(SMEM_IMAGE_VERSION_TABLE,
-						&smem_block_size);
-	if (smem_table_ptr &&
-		((smem_image_index_venus + 128) <= smem_block_size))
-		memcpy(smem_table_ptr + smem_image_index_venus,
-			   (u8 *)pkt->str_image_version, 128);
+	switch (pkt->rg_property_data[0]) {
+	case HFI_PROPERTY_SYS_IMAGE_VERSION:
+		hfi_process_sys_get_prop_image_version(pkt);
+		break;
+	default:
+		dprintk(VIDC_ERR,
+				"hfi_process_sys_property_info:unknown_prop_id: %d\n",
+				pkt->rg_property_data[0]);
+	}
 }
 
 u32 hfi_process_msg_packet(
@@ -1263,7 +1299,7 @@
 		break;
 	case HFI_MSG_SYS_PROPERTY_INFO:
 		hfi_process_sys_property_info(
-		   (struct hfi_property_sys_image_version_info_type *)
+		   (struct hfi_msg_sys_property_info_packet *)
 			msg_hdr);
 		break;
 	case HFI_MSG_SYS_SESSION_END_DONE:
diff --git a/drivers/media/platform/msm/vidc/msm_smem.h b/drivers/media/platform/msm/vidc/msm_smem.h
index dc384bc..7bd6443 100644
--- a/drivers/media/platform/msm/vidc/msm_smem.h
+++ b/drivers/media/platform/msm/vidc/msm_smem.h
@@ -28,6 +28,10 @@
 	SMEM_SECURE = ION_FLAG_SECURE,
 };
 
+/* NOTE: if you change this enum you MUST update the
+ * "buffer-type-tz-usage-table" for any affected target
+ * in arch/arm/boot/dts/<arch>.dtsi
+ */
 enum hal_buffer {
 	HAL_BUFFER_INPUT = 0x1,
 	HAL_BUFFER_OUTPUT = 0x2,
diff --git a/drivers/media/platform/msm/vidc/msm_vdec.c b/drivers/media/platform/msm/vidc/msm_vdec.c
index f4fdfe7..efa195e 100644
--- a/drivers/media/platform/msm/vidc/msm_vdec.c
+++ b/drivers/media/platform/msm/vidc/msm_vdec.c
@@ -686,6 +686,7 @@
 int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 {
 	const struct msm_vidc_format *fmt = NULL;
+	unsigned int *plane_sizes = NULL;
 	struct hfi_device *hdev;
 	int stride, scanlines;
 	int extra_idx = 0;
@@ -741,9 +742,19 @@
 			goto exit;
 		}
 		if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
+			plane_sizes =
+			&inst->bufq[OUTPUT_PORT].vb2_bufq.plane_sizes[0];
 			for (i = 0; i < fmt->num_planes; ++i) {
-				f->fmt.pix_mp.plane_fmt[i].sizeimage =
-				inst->bufq[OUTPUT_PORT].vb2_bufq.plane_sizes[i];
+				if (plane_sizes[i] == 0) {
+					f->fmt.pix_mp.plane_fmt[i].sizeimage =
+						fmt->get_frame_size(i,
+						inst->capability.height.max,
+						inst->capability.width.max);
+					plane_sizes[i] =
+					f->fmt.pix_mp.plane_fmt[i].sizeimage;
+				} else
+					f->fmt.pix_mp.plane_fmt[i].sizeimage =
+						plane_sizes[i];
 			}
 		} else {
 			switch (fmt->fourcc) {
@@ -979,8 +990,10 @@
 					inst->capability.height.max,
 					inst->capability.width.max);
 
-		if (f->fmt.pix_mp.plane_fmt[0].sizeimage > max_input_size)
+		if (f->fmt.pix_mp.plane_fmt[0].sizeimage > max_input_size ||
+			f->fmt.pix_mp.plane_fmt[0].sizeimage == 0) {
 			f->fmt.pix_mp.plane_fmt[0].sizeimage = max_input_size;
+		}
 
 		f->fmt.pix_mp.num_planes = fmt->num_planes;
 		for (i = 0; i < fmt->num_planes; ++i) {
@@ -1807,7 +1820,7 @@
 int msm_vdec_ctrl_init(struct msm_vidc_inst *inst)
 {
 	int idx = 0;
-	struct v4l2_ctrl_config ctrl_cfg;
+	struct v4l2_ctrl_config ctrl_cfg = {0};
 	int ret_val = 0;
 
 	ret_val = v4l2_ctrl_handler_init(&inst->ctrl_handler, NUM_CTRLS);
diff --git a/drivers/media/platform/msm/vidc/msm_venc.c b/drivers/media/platform/msm/vidc/msm_venc.c
index f9b5519..c0bf32c 100644
--- a/drivers/media/platform/msm/vidc/msm_venc.c
+++ b/drivers/media/platform/msm/vidc/msm_venc.c
@@ -2662,7 +2662,7 @@
 {
 
 	int idx = 0;
-	struct v4l2_ctrl_config ctrl_cfg;
+	struct v4l2_ctrl_config ctrl_cfg = {0};
 	int ret_val = 0;
 	ret_val = v4l2_ctrl_handler_init(&inst->ctrl_handler, NUM_CTRLS);
 	if (ret_val) {
diff --git a/drivers/media/platform/msm/vidc/q6_hfi.c b/drivers/media/platform/msm/vidc/q6_hfi.c
index 7c99ec3..8e91f34 100644
--- a/drivers/media/platform/msm/vidc/q6_hfi.c
+++ b/drivers/media/platform/msm/vidc/q6_hfi.c
@@ -560,17 +560,28 @@
 		dprintk(VIDC_ERR, "session_init: failed to create packet");
 		goto err_session_init;
 	}
+	/*
+	 * Add session id to the list entry and then send the apr pkt.
+	 * This will avoid scenarios where apr_send_pkt is taking more
+	 * time and Q6 is returning an ack even before the session id
+	 * gets added to the session list.
+	 */
+	mutex_lock(&dev->session_lock);
+	list_add_tail(&new_session->list, &dev->sess_head);
+	mutex_unlock(&dev->session_lock);
 
 	rc = apr_send_pkt(dev->apr, (uint32_t *)&apr);
 	if (rc != apr.hdr.pkt_size) {
 		dprintk(VIDC_ERR, "%s: apr_send_pkt failed rc: %d",
 				__func__, rc);
+		/* Delete the session id as the send pkt is not successful */
+		mutex_lock(&dev->session_lock);
+		list_del(&new_session->list);
+		mutex_unlock(&dev->session_lock);
 		rc = -EBADE;
 		goto err_session_init;
 	}
-	mutex_lock(&dev->session_lock);
-	list_add_tail(&new_session->list, &dev->sess_head);
-	mutex_unlock(&dev->session_lock);
+
 	return new_session;
 
 err_session_init:
diff --git a/drivers/media/platform/msm/wfd/vsg-subdev.c b/drivers/media/platform/msm/wfd/vsg-subdev.c
index 0f2fbbb..c20250e 100644
--- a/drivers/media/platform/msm/wfd/vsg-subdev.c
+++ b/drivers/media/platform/msm/wfd/vsg-subdev.c
@@ -24,6 +24,12 @@
 #define DEFAULT_MODE ((enum vsg_modes)VSG_MODE_CFR)
 #define MAX_BUFS_BUSY_WITH_ENC 5
 
+static void vsg_reset_timer(struct hrtimer *timer, ktime_t time)
+{
+	hrtimer_forward_now(timer, time);
+	hrtimer_restart(timer);
+}
+
 static int vsg_release_input_buffer(struct vsg_context *context,
 		struct vsg_buf_info *buf)
 {
@@ -114,7 +120,7 @@
 	INIT_LIST_HEAD(&buf_info->node);
 
 	ktime_get_ts(&buf_info->time);
-	hrtimer_forward_now(&context->threshold_timer, ns_to_ktime(
+	vsg_reset_timer(&context->threshold_timer, ns_to_ktime(
 				context->max_frame_interval));
 
 	temp = NULL;
@@ -438,7 +444,7 @@
 			 * otherwise, diff between two consecutive frames might
 			 * be less than max_frame_interval (for just one sample)
 			 */
-			hrtimer_forward_now(&context->threshold_timer,
+			vsg_reset_timer(&context->threshold_timer,
 				ns_to_ktime(context->max_frame_interval));
 		}
 	}
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 293033b..995d9e4 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -744,7 +744,11 @@
 				 */
 				mmc_update_clk_scaling(host);
 				err = mmc_stop_request(host);
-				if (err && !context_info->is_done_rcv) {
+				if (err == MMC_BLK_NO_REQ_TO_STOP) {
+					pending_is_urgent = true;
+					/* wait for done/new/urgent event */
+					continue;
+				} else if (err && !context_info->is_done_rcv) {
 					err = MMC_BLK_ABORT;
 					break;
 				}
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 758a79e..513ddfb 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -27,6 +27,7 @@
 
 #include <linux/mmc/mmc.h>
 #include <linux/mmc/host.h>
+#include <linux/mmc/card.h>
 
 #include "sdhci.h"
 
@@ -745,6 +746,12 @@
 	if (host->quirks & SDHCI_QUIRK_BROKEN_TIMEOUT_VAL)
 		return 0xE;
 
+	/* During initialization, don't use max timeout as the clock is slow */
+	if ((host->quirks2 & SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT) &&
+		(host->clock > 400000)) {
+		return 0xF;
+	}
+
 	/* Unspecified timeout, assume max */
 	if (!data && !cmd->cmd_timeout_ms)
 		return 0xE;
@@ -2223,10 +2230,13 @@
 	struct sdhci_host *host = mmc_priv(mmc);
 	unsigned long flags;
 	struct mmc_data *data;
+	int ret = 0;
 
 	spin_lock_irqsave(&host->lock, flags);
-	if (!host->mrq || !host->data)
+	if (!host->mrq || !host->data) {
+		ret = MMC_BLK_NO_REQ_TO_STOP;
 		goto out;
+	}
 
 	data = host->data;
 
@@ -2252,7 +2262,7 @@
 	host->data = NULL;
 out:
 	spin_unlock_irqrestore(&host->lock, flags);
-	return 0;
+	return ret;
 }
 
 static unsigned int sdhci_get_xfer_remain(struct mmc_host *mmc)
diff --git a/drivers/nfc/nfc-nci.c b/drivers/nfc/nfc-nci.c
index 67b057c..043f9bc 100644
--- a/drivers/nfc/nfc-nci.c
+++ b/drivers/nfc/nfc-nci.c
@@ -923,6 +923,19 @@
 		goto err_misc_register;
 	}
 
+	regulators.regulator = regulator_get(&client->dev, regulators.name);
+	if (IS_ERR(regulators.regulator)) {
+		r = PTR_ERR(regulators.regulator);
+		pr_err("regulator get of %s failed (%d)\n", regulators.name, r);
+	} else {
+		/* Enable the regulator */
+		r = regulator_enable(regulators.regulator);
+		if (r) {
+			pr_err("vreg %s enable failed (%d)\n",
+				regulators.name, r);
+		}
+	}
+
 	logging_level = 0;
 	/* request irq.  The irq is set whenever the chip has data available
 	* for reading.  It is cleared when all data has been read.
diff --git a/drivers/nfc/nfc-nci.h b/drivers/nfc/nfc-nci.h
index 81f2521..9bfb77d 100644
--- a/drivers/nfc/nfc-nci.h
+++ b/drivers/nfc/nfc-nci.h
@@ -223,3 +223,9 @@
 	unsigned int	reg;
 };
 #endif
+/* enable LDO */
+struct vregs_info {
+	const char * const name;
+	struct regulator *regulator;
+};
+struct vregs_info regulators = {"vlogic", NULL};
diff --git a/drivers/of/of_batterydata.c b/drivers/of/of_batterydata.c
index 2061408..b0d40f1 100644
--- a/drivers/of/of_batterydata.c
+++ b/drivers/of/of_batterydata.c
@@ -244,9 +244,17 @@
 {
 	int64_t resistor_value_kohm, denom;
 
+	if (batt_id_uv == 0) {
+		/* vadc not correct or batt id line grounded, report 0 kohms */
+		return 0;
+	}
 	/* calculate the battery id resistance reported via ADC */
 	denom = div64_s64(vadc_vdd * 1000000LL, batt_id_uv) - 1000000LL;
 
+	if (denom == 0) {
+		/* batt id connector might be open, return 0 kohms */
+		return 0;
+	}
 	resistor_value_kohm = div64_s64(rpull_up * 1000000LL + denom/2, denom);
 
 	pr_debug("batt id voltage = %d, resistor value = %lld\n",
diff --git a/drivers/platform/msm/ipa/ipa.c b/drivers/platform/msm/ipa/ipa.c
index 6a16cf3..1ef1f1b 100644
--- a/drivers/platform/msm/ipa/ipa.c
+++ b/drivers/platform/msm/ipa/ipa.c
@@ -963,7 +963,7 @@
 	enum ipa_pipe_mem_type mem_type;
 
 	if (!pipe_connection || !node)
-		goto err;
+		return -EINVAL;
 
 	key = "qcom,src-bam-physical-address";
 	rc = of_property_read_u32(node, key, &val);
diff --git a/drivers/platform/msm/ipa/ipa_flt.c b/drivers/platform/msm/ipa/ipa_flt.c
index 2d75141..c3db716 100644
--- a/drivers/platform/msm/ipa/ipa_flt.c
+++ b/drivers/platform/msm/ipa/ipa_flt.c
@@ -802,8 +802,11 @@
 	IPADBG("reset flt ip=%d\n", ip);
 	list_for_each_entry_safe(entry, next, &tbl->head_flt_rule_list, link) {
 		node = ipa_search(&ipa_ctx->flt_rule_hdl_tree, (u32)entry);
-		if (node == NULL)
+		if (node == NULL) {
 			WARN_ON(1);
+			mutex_unlock(&ipa_ctx->lock);
+			return -EFAULT;
+		}
 
 		if ((ip == IPA_IP_v4 &&
 		     entry->rule.attrib.attrib_mask == IPA_FLT_PROTOCOL &&
@@ -833,8 +836,11 @@
 				link) {
 			node = ipa_search(&ipa_ctx->flt_rule_hdl_tree,
 					(u32)entry);
-			if (node == NULL)
+			if (node == NULL) {
 				WARN_ON(1);
+				mutex_unlock(&ipa_ctx->lock);
+				return -EFAULT;
+			}
 			list_del(&entry->link);
 			entry->tbl->rule_cnt--;
 			if (entry->rt_tbl)
diff --git a/drivers/platform/msm/ipa/ipa_hdr.c b/drivers/platform/msm/ipa/ipa_hdr.c
index 9618da2..54cbf5f 100644
--- a/drivers/platform/msm/ipa/ipa_hdr.c
+++ b/drivers/platform/msm/ipa/ipa_hdr.c
@@ -450,8 +450,11 @@
 			continue;
 
 		node = ipa_search(&ipa_ctx->hdr_hdl_tree, (u32) entry);
-		if (node == NULL)
+		if (node == NULL) {
 			WARN_ON(1);
+			mutex_unlock(&ipa_ctx->lock);
+			return -EFAULT;
+		}
 		list_del(&entry->link);
 		entry->cookie = 0;
 		kmem_cache_free(ipa_ctx->hdr_cache, entry);
diff --git a/drivers/platform/msm/ipa/ipa_rt.c b/drivers/platform/msm/ipa/ipa_rt.c
index 8d6d5e6..f453010 100644
--- a/drivers/platform/msm/ipa/ipa_rt.c
+++ b/drivers/platform/msm/ipa/ipa_rt.c
@@ -843,8 +843,11 @@
 					 &tbl->head_rt_rule_list, link) {
 			node = ipa_search(&ipa_ctx->rt_rule_hdl_tree,
 					  (u32)rule);
-			if (node == NULL)
+			if (node == NULL) {
 				WARN_ON(1);
+				mutex_unlock(&ipa_ctx->lock);
+				return -EFAULT;
+			}
 
 			/*
 			 * for the "default" routing tbl, remove all but the
@@ -866,8 +869,11 @@
 		}
 
 		node = ipa_search(&ipa_ctx->rt_tbl_hdl_tree, (u32)tbl);
-		if (node  == NULL)
+		if (node  == NULL) {
 			WARN_ON(1);
+			mutex_unlock(&ipa_ctx->lock);
+			return -EFAULT;
+		}
 
 		/* do not remove the "default" routing tbl which has index 0 */
 		if (tbl->idx != 0) {
diff --git a/drivers/power/qpnp-charger.c b/drivers/power/qpnp-charger.c
index 8d94b88..a627ec2 100644
--- a/drivers/power/qpnp-charger.c
+++ b/drivers/power/qpnp-charger.c
@@ -369,6 +369,7 @@
 	struct alarm			reduce_power_stage_alarm;
 	struct work_struct		reduce_power_stage_work;
 	bool				power_stage_workaround_running;
+	bool				power_stage_workaround_enable;
 };
 
 
@@ -868,7 +869,7 @@
 	}
 	if (voltage >= QPNP_CHG_VINMIN_HIGH_MIN_MV) {
 		temp = QPNP_CHG_VINMIN_HIGH_MIN_VAL;
-		temp += (voltage - QPNP_CHG_VINMIN_MIN_MV)
+		temp += (voltage - QPNP_CHG_VINMIN_HIGH_MIN_MV)
 			/ QPNP_CHG_VINMIN_STEP_HIGH_MV;
 	} else {
 		temp = QPNP_CHG_VINMIN_MIN_VAL;
@@ -896,7 +897,7 @@
 
 	if (vin_min == 0)
 		vin_min_mv = QPNP_CHG_I_MAX_MIN_100;
-	else if (vin_min > QPNP_CHG_VINMIN_HIGH_MIN_VAL)
+	else if (vin_min >= QPNP_CHG_VINMIN_HIGH_MIN_VAL)
 		vin_min_mv = QPNP_CHG_VINMIN_HIGH_MIN_MV +
 			(vin_min - QPNP_CHG_VINMIN_HIGH_MIN_VAL)
 				* QPNP_CHG_VINMIN_STEP_HIGH_MV;
@@ -2128,6 +2129,8 @@
 		if (chip->prev_usb_max_ma == ret.intval)
 			goto skip_set_iusb_max;
 
+		chip->prev_usb_max_ma = ret.intval;
+
 		if (ret.intval <= 2 && !chip->use_default_batt_values &&
 						get_prop_batt_present(chip)) {
 			qpnp_chg_usb_suspend_enable(chip, 1);
@@ -2149,14 +2152,14 @@
 
 			if ((chip->flags & POWER_STAGE_WA)
 			&& ((ret.intval / 1000) > USB_WALL_THRESHOLD_MA)
-			&& !chip->power_stage_workaround_running) {
+			&& !chip->power_stage_workaround_running
+			&& chip->power_stage_workaround_enable) {
 				chip->power_stage_workaround_running = true;
 				pr_debug("usb wall chg inserted starting power stage workaround charger_monitor = %d\n",
 						charger_monitor);
 				schedule_work(&chip->reduce_power_stage_work);
 			}
 		}
-		chip->prev_usb_max_ma = ret.intval;
 	}
 
 skip_set_iusb_max:
@@ -4123,6 +4126,10 @@
 	if (chip->use_default_batt_values)
 		chip->charging_disabled = true;
 
+	chip->power_stage_workaround_enable =
+			of_property_read_bool(chip->spmi->dev.of_node,
+					"qcom,power-stage-reduced");
+
 	of_get_property(chip->spmi->dev.of_node, "qcom,thermal-mitigation",
 		&(chip->thermal_levels));
 
diff --git a/drivers/slimbus/slim-msm-ngd.c b/drivers/slimbus/slim-msm-ngd.c
index 0c9959c..67cf049 100644
--- a/drivers/slimbus/slim-msm-ngd.c
+++ b/drivers/slimbus/slim-msm-ngd.c
@@ -1065,7 +1065,7 @@
 	}
 
 	dev = kzalloc(sizeof(struct msm_slim_ctrl), GFP_KERNEL);
-	if (IS_ERR(dev)) {
+	if (IS_ERR_OR_NULL(dev)) {
 		dev_err(&pdev->dev, "no memory for MSM slimbus controller\n");
 		return PTR_ERR(dev);
 	}
diff --git a/drivers/staging/zram/Kconfig b/drivers/staging/zram/Kconfig
index 9d11a4c..983314c 100644
--- a/drivers/staging/zram/Kconfig
+++ b/drivers/staging/zram/Kconfig
@@ -1,9 +1,6 @@
 config ZRAM
 	tristate "Compressed RAM block device support"
-	# X86 dependency is because zsmalloc uses non-portable pte/tlb
-	# functions
-	depends on BLOCK && SYSFS && X86
-	select ZSMALLOC
+	depends on BLOCK && SYSFS && ZSMALLOC
 	select LZO_COMPRESS
 	select LZO_DECOMPRESS
 	default n
@@ -17,7 +14,7 @@
 	  disks and maybe many more.
 
 	  See zram.txt for more information.
-	  Project home: http://compcache.googlecode.com/
+	  Project home: <https://compcache.googlecode.com/>
 
 config ZRAM_DEBUG
 	bool "Compressed RAM block device debug support"
diff --git a/drivers/staging/zram/Makefile b/drivers/staging/zram/Makefile
index 7f4a301..cb0f9ce 100644
--- a/drivers/staging/zram/Makefile
+++ b/drivers/staging/zram/Makefile
@@ -1,3 +1,3 @@
-zram-y	:=	zram_drv.o zram_sysfs.o
+zram-y	:=	zram_drv.o
 
 obj-$(CONFIG_ZRAM)	+=	zram.o
diff --git a/drivers/staging/zram/zram.txt b/drivers/staging/zram/zram.txt
index 5f75d29..765d790 100644
--- a/drivers/staging/zram/zram.txt
+++ b/drivers/staging/zram/zram.txt
@@ -23,17 +23,17 @@
 	This creates 4 devices: /dev/zram{0,1,2,3}
 	(num_devices parameter is optional. Default: 1)
 
-2) Set Disksize (Optional):
-	Set disk size by writing the value to sysfs node 'disksize'
-	(in bytes). If disksize is not given, default value of 25%
-	of RAM is used.
+2) Set Disksize
+        Set disk size by writing the value to sysfs node 'disksize'.
+        The value can be either in bytes or you can use mem suffixes.
+        Examples:
+            # Initialize /dev/zram0 with 50MB disksize
+            echo $((50*1024*1024)) > /sys/block/zram0/disksize
 
-	# Initialize /dev/zram0 with 50MB disksize
-	echo $((50*1024*1024)) > /sys/block/zram0/disksize
-
-	NOTE: disksize cannot be changed if the disk contains any
-	data. So, for such a disk, you need to issue 'reset' (see below)
-	before you can change its disksize.
+            # Using mem suffixes
+            echo 256K > /sys/block/zram0/disksize
+            echo 512M > /sys/block/zram0/disksize
+            echo 1G > /sys/block/zram0/disksize
 
 3) Activate:
 	mkswap /dev/zram0
@@ -65,8 +65,9 @@
 	echo 1 > /sys/block/zram0/reset
 	echo 1 > /sys/block/zram1/reset
 
-	(This frees all the memory allocated for the given device).
-
+	This frees all the memory allocated for the given device and
+	resets the disksize to zero. You must set the disksize again
+	before reusing the device.
 
 Please report any problems at:
  - Mailing list: linux-mm-cc at laptop dot org
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 685d612..91d94b5 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -37,56 +37,216 @@
 
 /* Globals */
 static int zram_major;
-struct zram *zram_devices;
+static struct zram *zram_devices;
 
 /* Module params (documentation at end) */
-static unsigned int num_devices;
+static unsigned int num_devices = 1;
 
-static void zram_stat_inc(u32 *v)
+static inline struct zram *dev_to_zram(struct device *dev)
 {
-	*v = *v + 1;
+	return (struct zram *)dev_to_disk(dev)->private_data;
 }
 
-static void zram_stat_dec(u32 *v)
+static ssize_t disksize_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
 {
-	*v = *v - 1;
+	struct zram *zram = dev_to_zram(dev);
+
+	return sprintf(buf, "%llu\n", zram->disksize);
 }
 
-static void zram_stat64_add(struct zram *zram, u64 *v, u64 inc)
+static ssize_t initstate_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
 {
-	spin_lock(&zram->stat64_lock);
-	*v = *v + inc;
-	spin_unlock(&zram->stat64_lock);
+	struct zram *zram = dev_to_zram(dev);
+
+	return sprintf(buf, "%u\n", zram->init_done);
 }
 
-static void zram_stat64_sub(struct zram *zram, u64 *v, u64 dec)
+static ssize_t num_reads_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
 {
-	spin_lock(&zram->stat64_lock);
-	*v = *v - dec;
-	spin_unlock(&zram->stat64_lock);
+	struct zram *zram = dev_to_zram(dev);
+
+	return sprintf(buf, "%llu\n",
+			(u64)atomic64_read(&zram->stats.num_reads));
 }
 
-static void zram_stat64_inc(struct zram *zram, u64 *v)
+static ssize_t num_writes_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
 {
-	zram_stat64_add(zram, v, 1);
+	struct zram *zram = dev_to_zram(dev);
+
+	return sprintf(buf, "%llu\n",
+			(u64)atomic64_read(&zram->stats.num_writes));
 }
 
-static int zram_test_flag(struct zram *zram, u32 index,
+static ssize_t invalid_io_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct zram *zram = dev_to_zram(dev);
+
+	return sprintf(buf, "%llu\n",
+			(u64)atomic64_read(&zram->stats.invalid_io));
+}
+
+static ssize_t notify_free_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct zram *zram = dev_to_zram(dev);
+
+	return sprintf(buf, "%llu\n",
+			(u64)atomic64_read(&zram->stats.notify_free));
+}
+
+static ssize_t zero_pages_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct zram *zram = dev_to_zram(dev);
+
+	return sprintf(buf, "%u\n", zram->stats.pages_zero);
+}
+
+static ssize_t orig_data_size_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct zram *zram = dev_to_zram(dev);
+
+	return sprintf(buf, "%llu\n",
+		(u64)(zram->stats.pages_stored) << PAGE_SHIFT);
+}
+
+static ssize_t compr_data_size_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct zram *zram = dev_to_zram(dev);
+
+	return sprintf(buf, "%llu\n",
+			(u64)atomic64_read(&zram->stats.compr_size));
+}
+
+static ssize_t mem_used_total_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	u64 val = 0;
+	struct zram *zram = dev_to_zram(dev);
+	struct zram_meta *meta = zram->meta;
+
+	down_read(&zram->init_lock);
+	if (zram->init_done)
+		val = zs_get_total_size_bytes(meta->mem_pool);
+	up_read(&zram->init_lock);
+
+	return sprintf(buf, "%llu\n", val);
+}
+
+static int zram_test_flag(struct zram_meta *meta, u32 index,
 			enum zram_pageflags flag)
 {
-	return zram->table[index].flags & BIT(flag);
+	return meta->table[index].flags & BIT(flag);
 }
 
-static void zram_set_flag(struct zram *zram, u32 index,
+static void zram_set_flag(struct zram_meta *meta, u32 index,
 			enum zram_pageflags flag)
 {
-	zram->table[index].flags |= BIT(flag);
+	meta->table[index].flags |= BIT(flag);
 }
 
-static void zram_clear_flag(struct zram *zram, u32 index,
+static void zram_clear_flag(struct zram_meta *meta, u32 index,
 			enum zram_pageflags flag)
 {
-	zram->table[index].flags &= ~BIT(flag);
+	meta->table[index].flags &= ~BIT(flag);
+}
+
+static inline int is_partial_io(struct bio_vec *bvec)
+{
+	return bvec->bv_len != PAGE_SIZE;
+}
+
+/*
+ * Check if request is within bounds and aligned on zram logical blocks.
+ */
+static inline int valid_io_request(struct zram *zram, struct bio *bio)
+{
+	u64 start, end, bound;
+
+	/* unaligned request */
+	if (unlikely(bio->bi_sector & (ZRAM_SECTOR_PER_LOGICAL_BLOCK - 1)))
+		return 0;
+	if (unlikely(bio->bi_size & (ZRAM_LOGICAL_BLOCK_SIZE - 1)))
+		return 0;
+
+	start = bio->bi_sector;
+	end = start + (bio->bi_size >> SECTOR_SHIFT);
+	bound = zram->disksize >> SECTOR_SHIFT;
+	/* out of range range */
+	if (unlikely(start >= bound || end > bound || start > end))
+		return 0;
+
+	/* I/O request is valid */
+	return 1;
+}
+
+static void zram_meta_free(struct zram_meta *meta)
+{
+	zs_destroy_pool(meta->mem_pool);
+	kfree(meta->compress_workmem);
+	free_pages((unsigned long)meta->compress_buffer, 1);
+	vfree(meta->table);
+	kfree(meta);
+}
+
+static struct zram_meta *zram_meta_alloc(u64 disksize)
+{
+	size_t num_pages;
+	struct zram_meta *meta = kmalloc(sizeof(*meta), GFP_KERNEL);
+	if (!meta)
+		goto out;
+
+	meta->compress_workmem = kzalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL);
+	if (!meta->compress_workmem)
+		goto free_meta;
+
+	meta->compress_buffer =
+		(void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 1);
+	if (!meta->compress_buffer) {
+		pr_err("Error allocating compressor buffer space\n");
+		goto free_workmem;
+	}
+
+	num_pages = disksize >> PAGE_SHIFT;
+	meta->table = vzalloc(num_pages * sizeof(*meta->table));
+	if (!meta->table) {
+		pr_err("Error allocating zram address table\n");
+		goto free_buffer;
+	}
+
+	meta->mem_pool = zs_create_pool(GFP_NOIO | __GFP_HIGHMEM);
+	if (!meta->mem_pool) {
+		pr_err("Error creating memory pool\n");
+		goto free_table;
+	}
+
+	return meta;
+
+free_table:
+	vfree(meta->table);
+free_buffer:
+	free_pages((unsigned long)meta->compress_buffer, 1);
+free_workmem:
+	kfree(meta->compress_workmem);
+free_meta:
+	kfree(meta);
+	meta = NULL;
+out:
+	return meta;
+}
+
+static void update_position(u32 *index, int *offset, struct bio_vec *bvec)
+{
+	if (*offset + bvec->bv_len >= PAGE_SIZE)
+		(*index)++;
+	*offset = (*offset + bvec->bv_len) % PAGE_SIZE;
 }
 
 static int page_zero_filled(void *ptr)
@@ -104,352 +264,269 @@
 	return 1;
 }
 
-static void zram_set_disksize(struct zram *zram, size_t totalram_bytes)
-{
-	if (!zram->disksize) {
-		pr_info(
-		"disk size not provided. You can use disksize_kb module "
-		"param to specify size.\nUsing default: (%u%% of RAM).\n",
-		default_disksize_perc_ram
-		);
-		zram->disksize = default_disksize_perc_ram *
-					(totalram_bytes / 100);
-	}
-
-	if (zram->disksize > 2 * (totalram_bytes)) {
-		pr_info(
-		"There is little point creating a zram of greater than "
-		"twice the size of memory since we expect a 2:1 compression "
-		"ratio. Note that zram uses about 0.1%% of the size of "
-		"the disk when not in use so a huge zram is "
-		"wasteful.\n"
-		"\tMemory Size: %zu kB\n"
-		"\tSize you selected: %llu kB\n"
-		"Continuing anyway ...\n",
-		totalram_bytes >> 10, zram->disksize
-		);
-	}
-
-	zram->disksize &= PAGE_MASK;
-}
-
-static void zram_free_page(struct zram *zram, size_t index)
-{
-	void *handle = zram->table[index].handle;
-
-	if (unlikely(!handle)) {
-		/*
-		 * No memory is allocated for zero filled pages.
-		 * Simply clear zero page flag.
-		 */
-		if (zram_test_flag(zram, index, ZRAM_ZERO)) {
-			zram_clear_flag(zram, index, ZRAM_ZERO);
-			zram_stat_dec(&zram->stats.pages_zero);
-		}
-		return;
-	}
-
-	if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) {
-		__free_page(handle);
-		zram_clear_flag(zram, index, ZRAM_UNCOMPRESSED);
-		zram_stat_dec(&zram->stats.pages_expand);
-		goto out;
-	}
-
-	zs_free(zram->mem_pool, handle);
-
-	if (zram->table[index].size <= PAGE_SIZE / 2)
-		zram_stat_dec(&zram->stats.good_compress);
-
-out:
-	zram_stat64_sub(zram, &zram->stats.compr_size,
-			zram->table[index].size);
-	zram_stat_dec(&zram->stats.pages_stored);
-
-	zram->table[index].handle = NULL;
-	zram->table[index].size = 0;
-}
-
 static void handle_zero_page(struct bio_vec *bvec)
 {
 	struct page *page = bvec->bv_page;
 	void *user_mem;
 
 	user_mem = kmap_atomic(page);
-	memset(user_mem + bvec->bv_offset, 0, bvec->bv_len);
+	if (is_partial_io(bvec))
+		memset(user_mem + bvec->bv_offset, 0, bvec->bv_len);
+	else
+		clear_page(user_mem);
 	kunmap_atomic(user_mem);
 
 	flush_dcache_page(page);
 }
 
-static void handle_uncompressed_page(struct zram *zram, struct bio_vec *bvec,
-				     u32 index, int offset)
+static void zram_free_page(struct zram *zram, size_t index)
 {
-	struct page *page = bvec->bv_page;
-	unsigned char *user_mem, *cmem;
+	struct zram_meta *meta = zram->meta;
+	unsigned long handle = meta->table[index].handle;
+	u16 size = meta->table[index].size;
 
-	user_mem = kmap_atomic(page);
-	cmem = kmap_atomic(zram->table[index].handle);
+	if (unlikely(!handle)) {
+		/*
+		 * No memory is allocated for zero filled pages.
+		 * Simply clear zero page flag.
+		 */
+		if (zram_test_flag(meta, index, ZRAM_ZERO)) {
+			zram_clear_flag(meta, index, ZRAM_ZERO);
+			zram->stats.pages_zero--;
+		}
+		return;
+	}
 
-	memcpy(user_mem + bvec->bv_offset, cmem + offset, bvec->bv_len);
-	kunmap_atomic(cmem);
-	kunmap_atomic(user_mem);
+	if (unlikely(size > max_zpage_size))
+		zram->stats.bad_compress--;
 
-	flush_dcache_page(page);
+	zs_free(meta->mem_pool, handle);
+
+	if (size <= PAGE_SIZE / 2)
+		zram->stats.good_compress--;
+
+	atomic64_sub(meta->table[index].size, &zram->stats.compr_size);
+	zram->stats.pages_stored--;
+
+	meta->table[index].handle = 0;
+	meta->table[index].size = 0;
 }
 
-static inline int is_partial_io(struct bio_vec *bvec)
+static int zram_decompress_page(struct zram *zram, char *mem, u32 index)
 {
-	return bvec->bv_len != PAGE_SIZE;
+	int ret = LZO_E_OK;
+	size_t clen = PAGE_SIZE;
+	unsigned char *cmem;
+	struct zram_meta *meta = zram->meta;
+	unsigned long handle = meta->table[index].handle;
+
+	if (!handle || zram_test_flag(meta, index, ZRAM_ZERO)) {
+		clear_page(mem);
+		return 0;
+	}
+
+	cmem = zs_map_object(meta->mem_pool, handle, ZS_MM_RO);
+	if (meta->table[index].size == PAGE_SIZE)
+		copy_page(mem, cmem);
+	else
+		ret = lzo1x_decompress_safe(cmem, meta->table[index].size,
+						mem, &clen);
+	zs_unmap_object(meta->mem_pool, handle);
+
+	/* Should NEVER happen. Return bio error if it does. */
+	if (unlikely(ret != LZO_E_OK)) {
+		pr_err("Decompression failed! err=%d, page=%u\n", ret, index);
+		atomic64_inc(&zram->stats.failed_reads);
+		return ret;
+	}
+
+	return 0;
 }
 
 static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
 			  u32 index, int offset, struct bio *bio)
 {
 	int ret;
-	size_t clen;
 	struct page *page;
-	struct zobj_header *zheader;
-	unsigned char *user_mem, *cmem, *uncmem = NULL;
-
+	unsigned char *user_mem, *uncmem = NULL;
+	struct zram_meta *meta = zram->meta;
 	page = bvec->bv_page;
 
-	if (zram_test_flag(zram, index, ZRAM_ZERO)) {
+	if (unlikely(!meta->table[index].handle) ||
+			zram_test_flag(meta, index, ZRAM_ZERO)) {
 		handle_zero_page(bvec);
 		return 0;
 	}
 
-	/* Requested page is not present in compressed area */
-	if (unlikely(!zram->table[index].handle)) {
-		pr_debug("Read before write: sector=%lu, size=%u",
-			 (ulong)(bio->bi_sector), bio->bi_size);
-		handle_zero_page(bvec);
-		return 0;
-	}
-
-	/* Page is stored uncompressed since it's incompressible */
-	if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) {
-		handle_uncompressed_page(zram, bvec, index, offset);
-		return 0;
-	}
-
-	if (is_partial_io(bvec)) {
+	if (is_partial_io(bvec))
 		/* Use  a temporary buffer to decompress the page */
-		uncmem = kmalloc(PAGE_SIZE, GFP_KERNEL);
-		if (!uncmem) {
-			pr_info("Error allocating temp memory!\n");
-			return -ENOMEM;
-		}
-	}
+		uncmem = kmalloc(PAGE_SIZE, GFP_NOIO);
 
 	user_mem = kmap_atomic(page);
 	if (!is_partial_io(bvec))
 		uncmem = user_mem;
-	clen = PAGE_SIZE;
 
-	cmem = zs_map_object(zram->mem_pool, zram->table[index].handle);
-
-	ret = lzo1x_decompress_safe(cmem + sizeof(*zheader),
-				    zram->table[index].size,
-				    uncmem, &clen);
-
-	if (is_partial_io(bvec)) {
-		memcpy(user_mem + bvec->bv_offset, uncmem + offset,
-		       bvec->bv_len);
-		kfree(uncmem);
+	if (!uncmem) {
+		pr_info("Unable to allocate temp memory\n");
+		ret = -ENOMEM;
+		goto out_cleanup;
 	}
 
-	zs_unmap_object(zram->mem_pool, zram->table[index].handle);
-	kunmap_atomic(user_mem);
-
+	ret = zram_decompress_page(zram, uncmem, index);
 	/* Should NEVER happen. Return bio error if it does. */
-	if (unlikely(ret != LZO_E_OK)) {
-		pr_err("Decompression failed! err=%d, page=%u\n", ret, index);
-		zram_stat64_inc(zram, &zram->stats.failed_reads);
-		return ret;
-	}
+	if (unlikely(ret != LZO_E_OK))
+		goto out_cleanup;
+
+	if (is_partial_io(bvec))
+		memcpy(user_mem + bvec->bv_offset, uncmem + offset,
+				bvec->bv_len);
 
 	flush_dcache_page(page);
-
-	return 0;
-}
-
-static int zram_read_before_write(struct zram *zram, char *mem, u32 index)
-{
-	int ret;
-	size_t clen = PAGE_SIZE;
-	struct zobj_header *zheader;
-	unsigned char *cmem;
-
-	if (zram_test_flag(zram, index, ZRAM_ZERO) ||
-	    !zram->table[index].handle) {
-		memset(mem, 0, PAGE_SIZE);
-		return 0;
-	}
-
-	cmem = zs_map_object(zram->mem_pool, zram->table[index].handle);
-
-	/* Page is stored uncompressed since it's incompressible */
-	if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) {
-		memcpy(mem, cmem, PAGE_SIZE);
-		kunmap_atomic(cmem);
-		return 0;
-	}
-
-	ret = lzo1x_decompress_safe(cmem + sizeof(*zheader),
-				    zram->table[index].size,
-				    mem, &clen);
-	zs_unmap_object(zram->mem_pool, zram->table[index].handle);
-
-	/* Should NEVER happen. Return bio error if it does. */
-	if (unlikely(ret != LZO_E_OK)) {
-		pr_err("Decompression failed! err=%d, page=%u\n", ret, index);
-		zram_stat64_inc(zram, &zram->stats.failed_reads);
-		return ret;
-	}
-
-	return 0;
+	ret = 0;
+out_cleanup:
+	kunmap_atomic(user_mem);
+	if (is_partial_io(bvec))
+		kfree(uncmem);
+	return ret;
 }
 
 static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
 			   int offset)
 {
-	int ret;
-	u32 store_offset;
+	int ret = 0;
 	size_t clen;
-	void *handle;
-	struct zobj_header *zheader;
-	struct page *page, *page_store;
+	unsigned long handle;
+	struct page *page;
 	unsigned char *user_mem, *cmem, *src, *uncmem = NULL;
+	struct zram_meta *meta = zram->meta;
 
 	page = bvec->bv_page;
-	src = zram->compress_buffer;
+	src = meta->compress_buffer;
 
 	if (is_partial_io(bvec)) {
 		/*
 		 * This is a partial IO. We need to read the full page
 		 * before to write the changes.
 		 */
-		uncmem = kmalloc(PAGE_SIZE, GFP_KERNEL);
+		uncmem = kmalloc(PAGE_SIZE, GFP_NOIO);
 		if (!uncmem) {
-			pr_info("Error allocating temp memory!\n");
 			ret = -ENOMEM;
 			goto out;
 		}
-		ret = zram_read_before_write(zram, uncmem, index);
-		if (ret) {
-			kfree(uncmem);
+		ret = zram_decompress_page(zram, uncmem, index);
+		if (ret)
 			goto out;
-		}
 	}
 
-	/*
-	 * System overwrites unused sectors. Free memory associated
-	 * with this sector now.
-	 */
-	if (zram->table[index].handle ||
-	    zram_test_flag(zram, index, ZRAM_ZERO))
-		zram_free_page(zram, index);
-
 	user_mem = kmap_atomic(page);
 
-	if (is_partial_io(bvec))
+	if (is_partial_io(bvec)) {
 		memcpy(uncmem + offset, user_mem + bvec->bv_offset,
 		       bvec->bv_len);
-	else
+		kunmap_atomic(user_mem);
+		user_mem = NULL;
+	} else {
 		uncmem = user_mem;
+	}
 
 	if (page_zero_filled(uncmem)) {
 		kunmap_atomic(user_mem);
-		if (is_partial_io(bvec))
-			kfree(uncmem);
-		zram_stat_inc(&zram->stats.pages_zero);
-		zram_set_flag(zram, index, ZRAM_ZERO);
+		/* Free memory associated with this sector now. */
+		zram_free_page(zram, index);
+
+		zram->stats.pages_zero++;
+		zram_set_flag(meta, index, ZRAM_ZERO);
 		ret = 0;
 		goto out;
 	}
 
-	ret = lzo1x_1_compress(uncmem, PAGE_SIZE, src, &clen,
-			       zram->compress_workmem);
+	/*
+	 * zram_slot_free_notify could miss free so that let's
+	 * double check.
+	 */
+	if (unlikely(meta->table[index].handle ||
+			zram_test_flag(meta, index, ZRAM_ZERO)))
+		zram_free_page(zram, index);
 
-	kunmap_atomic(user_mem);
-	if (is_partial_io(bvec))
-			kfree(uncmem);
+	ret = lzo1x_1_compress(uncmem, PAGE_SIZE, src, &clen,
+			       meta->compress_workmem);
+
+	if (!is_partial_io(bvec)) {
+		kunmap_atomic(user_mem);
+		user_mem = NULL;
+		uncmem = NULL;
+	}
 
 	if (unlikely(ret != LZO_E_OK)) {
 		pr_err("Compression failed! err=%d\n", ret);
 		goto out;
 	}
 
-	/*
-	 * Page is incompressible. Store it as-is (uncompressed)
-	 * since we do not want to return too many disk write
-	 * errors which has side effect of hanging the system.
-	 */
 	if (unlikely(clen > max_zpage_size)) {
+		zram->stats.bad_compress++;
 		clen = PAGE_SIZE;
-		page_store = alloc_page(GFP_NOIO | __GFP_HIGHMEM);
-		if (unlikely(!page_store)) {
-			pr_info("Error allocating memory for "
-				"incompressible page: %u\n", index);
-			ret = -ENOMEM;
-			goto out;
-		}
-
-		store_offset = 0;
-		zram_set_flag(zram, index, ZRAM_UNCOMPRESSED);
-		zram_stat_inc(&zram->stats.pages_expand);
-		handle = page_store;
-		src = kmap_atomic(page);
-		cmem = kmap_atomic(page_store);
-		goto memstore;
+		src = NULL;
+		if (is_partial_io(bvec))
+			src = uncmem;
 	}
 
-	handle = zs_malloc(zram->mem_pool, clen + sizeof(*zheader));
+	handle = zs_malloc(meta->mem_pool, clen);
 	if (!handle) {
-		pr_info("Error allocating memory for compressed "
-			"page: %u, size=%zu\n", index, clen);
+		pr_info("Error allocating memory for compressed page: %u, size=%zu\n",
+			index, clen);
 		ret = -ENOMEM;
 		goto out;
 	}
-	cmem = zs_map_object(zram->mem_pool, handle);
+	cmem = zs_map_object(meta->mem_pool, handle, ZS_MM_WO);
 
-memstore:
-#if 0
-	/* Back-reference needed for memory defragmentation */
-	if (!zram_test_flag(zram, index, ZRAM_UNCOMPRESSED)) {
-		zheader = (struct zobj_header *)cmem;
-		zheader->table_idx = index;
-		cmem += sizeof(*zheader);
-	}
-#endif
-
-	memcpy(cmem, src, clen);
-
-	if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) {
-		kunmap_atomic(cmem);
+	if ((clen == PAGE_SIZE) && !is_partial_io(bvec)) {
+		src = kmap_atomic(page);
+		copy_page(cmem, src);
 		kunmap_atomic(src);
 	} else {
-		zs_unmap_object(zram->mem_pool, handle);
+		memcpy(cmem, src, clen);
 	}
 
-	zram->table[index].handle = handle;
-	zram->table[index].size = clen;
+	zs_unmap_object(meta->mem_pool, handle);
+
+	/*
+	 * Free memory associated with this sector
+	 * before overwriting unused sectors.
+	 */
+	zram_free_page(zram, index);
+
+	meta->table[index].handle = handle;
+	meta->table[index].size = clen;
 
 	/* Update stats */
-	zram_stat64_add(zram, &zram->stats.compr_size, clen);
-	zram_stat_inc(&zram->stats.pages_stored);
+	atomic64_add(clen, &zram->stats.compr_size);
+	zram->stats.pages_stored++;
 	if (clen <= PAGE_SIZE / 2)
-		zram_stat_inc(&zram->stats.good_compress);
-
-	return 0;
+		zram->stats.good_compress++;
 
 out:
+	if (is_partial_io(bvec))
+		kfree(uncmem);
+
 	if (ret)
-		zram_stat64_inc(zram, &zram->stats.failed_writes);
+		atomic64_inc(&zram->stats.failed_writes);
 	return ret;
 }
 
+static void handle_pending_slot_free(struct zram *zram)
+{
+	struct zram_slot_free *free_rq;
+
+	spin_lock(&zram->slot_free_lock);
+	while (zram->slot_free_rq) {
+		free_rq = zram->slot_free_rq;
+		zram->slot_free_rq = free_rq->next;
+		zram_free_page(zram, free_rq->index);
+		kfree(free_rq);
+	}
+	spin_unlock(&zram->slot_free_lock);
+}
+
 static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index,
 			int offset, struct bio *bio, int rw)
 {
@@ -457,10 +534,12 @@
 
 	if (rw == READ) {
 		down_read(&zram->lock);
+		handle_pending_slot_free(zram);
 		ret = zram_bvec_read(zram, bvec, index, offset, bio);
 		up_read(&zram->lock);
 	} else {
 		down_write(&zram->lock);
+		handle_pending_slot_free(zram);
 		ret = zram_bvec_write(zram, bvec, index, offset);
 		up_write(&zram->lock);
 	}
@@ -468,11 +547,124 @@
 	return ret;
 }
 
-static void update_position(u32 *index, int *offset, struct bio_vec *bvec)
+static void zram_reset_device(struct zram *zram, bool reset_capacity)
 {
-	if (*offset + bvec->bv_len >= PAGE_SIZE)
-		(*index)++;
-	*offset = (*offset + bvec->bv_len) % PAGE_SIZE;
+	size_t index;
+	struct zram_meta *meta;
+
+	flush_work(&zram->free_work);
+
+	down_write(&zram->init_lock);
+	if (!zram->init_done) {
+		up_write(&zram->init_lock);
+		return;
+	}
+
+	meta = zram->meta;
+	zram->init_done = 0;
+
+	/* Free all pages that are still in this zram device */
+	for (index = 0; index < zram->disksize >> PAGE_SHIFT; index++) {
+		unsigned long handle = meta->table[index].handle;
+		if (!handle)
+			continue;
+
+		zs_free(meta->mem_pool, handle);
+	}
+
+	zram_meta_free(zram->meta);
+	zram->meta = NULL;
+	/* Reset stats */
+	memset(&zram->stats, 0, sizeof(zram->stats));
+
+	zram->disksize = 0;
+	if (reset_capacity)
+		set_capacity(zram->disk, 0);
+	up_write(&zram->init_lock);
+}
+
+static void zram_init_device(struct zram *zram, struct zram_meta *meta)
+{
+	if (zram->disksize > 2 * (totalram_pages << PAGE_SHIFT)) {
+		pr_info(
+		"There is little point creating a zram of greater than "
+		"twice the size of memory since we expect a 2:1 compression "
+		"ratio. Note that zram uses about 0.1%% of the size of "
+		"the disk when not in use so a huge zram is "
+		"wasteful.\n"
+		"\tMemory Size: %lu kB\n"
+		"\tSize you selected: %llu kB\n"
+		"Continuing anyway ...\n",
+		(totalram_pages << PAGE_SHIFT) >> 10, zram->disksize >> 10
+		);
+	}
+
+	/* zram devices sort of resembles non-rotational disks */
+	queue_flag_set_unlocked(QUEUE_FLAG_NONROT, zram->disk->queue);
+
+	zram->meta = meta;
+	zram->init_done = 1;
+
+	pr_debug("Initialization done!\n");
+}
+
+static ssize_t disksize_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t len)
+{
+	u64 disksize;
+	struct zram_meta *meta;
+	struct zram *zram = dev_to_zram(dev);
+
+	disksize = memparse(buf, NULL);
+	if (!disksize)
+		return -EINVAL;
+
+	disksize = PAGE_ALIGN(disksize);
+	meta = zram_meta_alloc(disksize);
+	down_write(&zram->init_lock);
+	if (zram->init_done) {
+		up_write(&zram->init_lock);
+		zram_meta_free(meta);
+		pr_info("Cannot change disksize for initialized device\n");
+		return -EBUSY;
+	}
+
+	zram->disksize = disksize;
+	set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT);
+	zram_init_device(zram, meta);
+	up_write(&zram->init_lock);
+
+	return len;
+}
+
+static ssize_t reset_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t len)
+{
+	int ret;
+	unsigned short do_reset;
+	struct zram *zram;
+	struct block_device *bdev;
+
+	zram = dev_to_zram(dev);
+	bdev = bdget_disk(zram->disk, 0);
+
+	/* Do not reset an active device! */
+	if (bdev->bd_holders)
+		return -EBUSY;
+
+	ret = kstrtou16(buf, 10, &do_reset);
+	if (ret)
+		return ret;
+
+	if (!do_reset)
+		return -EINVAL;
+
+	/* Make sure all pending I/O is finished */
+	if (bdev)
+		fsync_bdev(bdev);
+
+	zram_reset_device(zram, true);
+	return len;
 }
 
 static void __zram_make_request(struct zram *zram, struct bio *bio, int rw)
@@ -483,10 +675,10 @@
 
 	switch (rw) {
 	case READ:
-		zram_stat64_inc(zram, &zram->stats.num_reads);
+		atomic64_inc(&zram->stats.num_reads);
 		break;
 	case WRITE:
-		zram_stat64_inc(zram, &zram->stats.num_writes);
+		atomic64_inc(&zram->stats.num_writes);
 		break;
 	}
 
@@ -531,39 +723,19 @@
 }
 
 /*
- * Check if request is within bounds and aligned on zram logical blocks.
- */
-static inline int valid_io_request(struct zram *zram, struct bio *bio)
-{
-	if (unlikely(
-		(bio->bi_sector >= (zram->disksize >> SECTOR_SHIFT)) ||
-		(bio->bi_sector & (ZRAM_SECTOR_PER_LOGICAL_BLOCK - 1)) ||
-		(bio->bi_size & (ZRAM_LOGICAL_BLOCK_SIZE - 1)))) {
-
-		return 0;
-	}
-
-	/* I/O request is valid */
-	return 1;
-}
-
-/*
  * Handler function for all zram I/O requests.
  */
 static void zram_make_request(struct request_queue *queue, struct bio *bio)
 {
 	struct zram *zram = queue->queuedata;
 
-	if (unlikely(!zram->init_done) && zram_init_device(zram))
-		goto error;
-
 	down_read(&zram->init_lock);
 	if (unlikely(!zram->init_done))
-		goto error_unlock;
+		goto error;
 
 	if (!valid_io_request(zram, bio)) {
-		zram_stat64_inc(zram, &zram->stats.invalid_io);
-		goto error_unlock;
+		atomic64_inc(&zram->stats.invalid_io);
+		goto error;
 	}
 
 	__zram_make_request(zram, bio, bio_data_dir(bio));
@@ -571,129 +743,45 @@
 
 	return;
 
-error_unlock:
-	up_read(&zram->init_lock);
 error:
+	up_read(&zram->init_lock);
 	bio_io_error(bio);
 }
 
-void __zram_reset_device(struct zram *zram)
+static void zram_slot_free(struct work_struct *work)
 {
-	size_t index;
+	struct zram *zram;
 
-	zram->init_done = 0;
-
-	/* Free various per-device buffers */
-	kfree(zram->compress_workmem);
-	free_pages((unsigned long)zram->compress_buffer, 1);
-
-	zram->compress_workmem = NULL;
-	zram->compress_buffer = NULL;
-
-	/* Free all pages that are still in this zram device */
-	for (index = 0; index < zram->disksize >> PAGE_SHIFT; index++) {
-		void *handle = zram->table[index].handle;
-		if (!handle)
-			continue;
-
-		if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED)))
-			__free_page(handle);
-		else
-			zs_free(zram->mem_pool, handle);
-	}
-
-	vfree(zram->table);
-	zram->table = NULL;
-
-	zs_destroy_pool(zram->mem_pool);
-	zram->mem_pool = NULL;
-
-	/* Reset stats */
-	memset(&zram->stats, 0, sizeof(zram->stats));
-
-	zram->disksize = 0;
+	zram = container_of(work, struct zram, free_work);
+	down_write(&zram->lock);
+	handle_pending_slot_free(zram);
+	up_write(&zram->lock);
 }
 
-void zram_reset_device(struct zram *zram)
+static void add_slot_free(struct zram *zram, struct zram_slot_free *free_rq)
 {
-	down_write(&zram->init_lock);
-	__zram_reset_device(zram);
-	up_write(&zram->init_lock);
-}
-
-int zram_init_device(struct zram *zram)
-{
-	int ret;
-	size_t num_pages;
-
-	down_write(&zram->init_lock);
-
-	if (zram->init_done) {
-		up_write(&zram->init_lock);
-		return 0;
-	}
-
-	zram_set_disksize(zram, totalram_pages << PAGE_SHIFT);
-
-	zram->compress_workmem = kzalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL);
-	if (!zram->compress_workmem) {
-		pr_err("Error allocating compressor working memory!\n");
-		ret = -ENOMEM;
-		goto fail_no_table;
-	}
-
-	zram->compress_buffer =
-		(void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 1);
-	if (!zram->compress_buffer) {
-		pr_err("Error allocating compressor buffer space\n");
-		ret = -ENOMEM;
-		goto fail_no_table;
-	}
-
-	num_pages = zram->disksize >> PAGE_SHIFT;
-	zram->table = vzalloc(num_pages * sizeof(*zram->table));
-	if (!zram->table) {
-		pr_err("Error allocating zram address table\n");
-		ret = -ENOMEM;
-		goto fail_no_table;
-	}
-
-	set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT);
-
-	/* zram devices sort of resembles non-rotational disks */
-	queue_flag_set_unlocked(QUEUE_FLAG_NONROT, zram->disk->queue);
-
-	zram->mem_pool = zs_create_pool("zram", GFP_NOIO | __GFP_HIGHMEM);
-	if (!zram->mem_pool) {
-		pr_err("Error creating memory pool\n");
-		ret = -ENOMEM;
-		goto fail;
-	}
-
-	zram->init_done = 1;
-	up_write(&zram->init_lock);
-
-	pr_debug("Initialization done!\n");
-	return 0;
-
-fail_no_table:
-	/* To prevent accessing table entries during cleanup */
-	zram->disksize = 0;
-fail:
-	__zram_reset_device(zram);
-	up_write(&zram->init_lock);
-	pr_err("Initialization failed: err=%d\n", ret);
-	return ret;
+	spin_lock(&zram->slot_free_lock);
+	free_rq->next = zram->slot_free_rq;
+	zram->slot_free_rq = free_rq;
+	spin_unlock(&zram->slot_free_lock);
 }
 
 static void zram_slot_free_notify(struct block_device *bdev,
 				unsigned long index)
 {
 	struct zram *zram;
+	struct zram_slot_free *free_rq;
 
 	zram = bdev->bd_disk->private_data;
-	zram_free_page(zram, index);
-	zram_stat64_inc(zram, &zram->stats.notify_free);
+	atomic64_inc(&zram->stats.notify_free);
+
+	free_rq = kmalloc(sizeof(struct zram_slot_free), GFP_ATOMIC);
+	if (!free_rq)
+		return;
+
+	free_rq->index = index;
+	add_slot_free(zram, free_rq);
+	schedule_work(&zram->free_work);
 }
 
 static const struct block_device_operations zram_devops = {
@@ -701,19 +789,53 @@
 	.owner = THIS_MODULE
 };
 
+static DEVICE_ATTR(disksize, S_IRUGO | S_IWUSR,
+		disksize_show, disksize_store);
+static DEVICE_ATTR(initstate, S_IRUGO, initstate_show, NULL);
+static DEVICE_ATTR(reset, S_IWUSR, NULL, reset_store);
+static DEVICE_ATTR(num_reads, S_IRUGO, num_reads_show, NULL);
+static DEVICE_ATTR(num_writes, S_IRUGO, num_writes_show, NULL);
+static DEVICE_ATTR(invalid_io, S_IRUGO, invalid_io_show, NULL);
+static DEVICE_ATTR(notify_free, S_IRUGO, notify_free_show, NULL);
+static DEVICE_ATTR(zero_pages, S_IRUGO, zero_pages_show, NULL);
+static DEVICE_ATTR(orig_data_size, S_IRUGO, orig_data_size_show, NULL);
+static DEVICE_ATTR(compr_data_size, S_IRUGO, compr_data_size_show, NULL);
+static DEVICE_ATTR(mem_used_total, S_IRUGO, mem_used_total_show, NULL);
+
+static struct attribute *zram_disk_attrs[] = {
+	&dev_attr_disksize.attr,
+	&dev_attr_initstate.attr,
+	&dev_attr_reset.attr,
+	&dev_attr_num_reads.attr,
+	&dev_attr_num_writes.attr,
+	&dev_attr_invalid_io.attr,
+	&dev_attr_notify_free.attr,
+	&dev_attr_zero_pages.attr,
+	&dev_attr_orig_data_size.attr,
+	&dev_attr_compr_data_size.attr,
+	&dev_attr_mem_used_total.attr,
+	NULL,
+};
+
+static struct attribute_group zram_disk_attr_group = {
+	.attrs = zram_disk_attrs,
+};
+
 static int create_device(struct zram *zram, int device_id)
 {
-	int ret = 0;
+	int ret = -ENOMEM;
 
 	init_rwsem(&zram->lock);
 	init_rwsem(&zram->init_lock);
-	spin_lock_init(&zram->stat64_lock);
+
+	INIT_WORK(&zram->free_work, zram_slot_free);
+	spin_lock_init(&zram->slot_free_lock);
+	zram->slot_free_rq = NULL;
 
 	zram->queue = blk_alloc_queue(GFP_KERNEL);
 	if (!zram->queue) {
 		pr_err("Error allocating disk queue for device %d\n",
 			device_id);
-		ret = -ENOMEM;
 		goto out;
 	}
 
@@ -723,11 +845,9 @@
 	 /* gendisk structure */
 	zram->disk = alloc_disk(1);
 	if (!zram->disk) {
-		blk_cleanup_queue(zram->queue);
-		pr_warning("Error allocating disk structure for device %d\n",
+		pr_warn("Error allocating disk structure for device %d\n",
 			device_id);
-		ret = -ENOMEM;
-		goto out;
+		goto out_free_queue;
 	}
 
 	zram->disk->major = zram_major;
@@ -755,12 +875,18 @@
 	ret = sysfs_create_group(&disk_to_dev(zram->disk)->kobj,
 				&zram_disk_attr_group);
 	if (ret < 0) {
-		pr_warning("Error creating sysfs group");
-		goto out;
+		pr_warn("Error creating sysfs group");
+		goto out_free_disk;
 	}
 
 	zram->init_done = 0;
+	return 0;
 
+out_free_disk:
+	del_gendisk(zram->disk);
+	put_disk(zram->disk);
+out_free_queue:
+	blk_cleanup_queue(zram->queue);
 out:
 	return ret;
 }
@@ -779,17 +905,12 @@
 		blk_cleanup_queue(zram->queue);
 }
 
-unsigned int zram_get_num_devices(void)
-{
-	return num_devices;
-}
-
 static int __init zram_init(void)
 {
 	int ret, dev_id;
 
 	if (num_devices > max_num_devices) {
-		pr_warning("Invalid value for num_devices: %u\n",
+		pr_warn("Invalid value for num_devices: %u\n",
 				num_devices);
 		ret = -EINVAL;
 		goto out;
@@ -797,18 +918,12 @@
 
 	zram_major = register_blkdev(0, "zram");
 	if (zram_major <= 0) {
-		pr_warning("Unable to get major number\n");
+		pr_warn("Unable to get major number\n");
 		ret = -EBUSY;
 		goto out;
 	}
 
-	if (!num_devices) {
-		pr_info("num_devices not specified. Using default: 1\n");
-		num_devices = 1;
-	}
-
 	/* Allocate the device array and initialize each one */
-	pr_info("Creating %u devices ...\n", num_devices);
 	zram_devices = kzalloc(num_devices * sizeof(struct zram), GFP_KERNEL);
 	if (!zram_devices) {
 		ret = -ENOMEM;
@@ -821,6 +936,8 @@
 			goto free_devices;
 	}
 
+	pr_info("Created %u device(s) ...\n", num_devices);
+
 	return 0;
 
 free_devices:
@@ -842,8 +959,11 @@
 		zram = &zram_devices[i];
 
 		destroy_device(zram);
-		if (zram->init_done)
-			zram_reset_device(zram);
+		/*
+		 * Shouldn't access zram->disk after destroy_device
+		 * because destroy_device already released zram->disk.
+		 */
+		zram_reset_device(zram, false);
 	}
 
 	unregister_blkdev(zram_major, "zram");
@@ -852,12 +972,13 @@
 	pr_debug("Cleanup done!\n");
 }
 
-module_param(num_devices, uint, 0);
-MODULE_PARM_DESC(num_devices, "Number of zram devices");
-
 module_init(zram_init);
 module_exit(zram_exit);
 
+module_param(num_devices, uint, 0);
+MODULE_PARM_DESC(num_devices, "Number of zram devices");
+
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_AUTHOR("Nitin Gupta <ngupta@vflare.org>");
 MODULE_DESCRIPTION("Compressed RAM Block Device");
+MODULE_ALIAS("devname:zram");
diff --git a/drivers/staging/zram/zram_drv.h b/drivers/staging/zram/zram_drv.h
index fbe8ac9..97a3acf 100644
--- a/drivers/staging/zram/zram_drv.h
+++ b/drivers/staging/zram/zram_drv.h
@@ -26,23 +26,8 @@
  */
 static const unsigned max_num_devices = 32;
 
-/*
- * Stored at beginning of each compressed object.
- *
- * It stores back-reference to table entry which points to this
- * object. This is required to support memory defragmentation.
- */
-struct zobj_header {
-#if 0
-	u32 table_idx;
-#endif
-};
-
 /*-- Configurable parameters */
 
-/* Default zram disk size: 25% of total RAM */
-static const unsigned default_disksize_perc_ram = 25;
-
 /*
  * Pages that compress to size greater than this are stored
  * uncompressed in memory.
@@ -51,8 +36,8 @@
 
 /*
  * NOTE: max_zpage_size must be less than or equal to:
- *   ZS_MAX_ALLOC_SIZE - sizeof(struct zobj_header)
- * otherwise, xv_malloc() would always return failure.
+ *   ZS_MAX_ALLOC_SIZE. Otherwise, zs_malloc() would
+ * always return failure.
  */
 
 /*-- End of configurable params */
@@ -68,9 +53,6 @@
 
 /* Flags for zram pages (table[page_no].flags) */
 enum zram_pageflags {
-	/* Page is stored uncompressed */
-	ZRAM_UNCOMPRESSED,
-
 	/* Page consists entirely of zeros */
 	ZRAM_ZERO,
 
@@ -81,34 +63,51 @@
 
 /* Allocated for each disk page */
 struct table {
-	void *handle;
+	unsigned long handle;
 	u16 size;	/* object size (excluding header) */
 	u8 count;	/* object ref count (not yet used) */
 	u8 flags;
-} __attribute__((aligned(4)));
+} __aligned(4);
 
+/*
+ * All 64bit fields should only be manipulated by 64bit atomic accessors.
+ * All modifications to 32bit counter should be protected by zram->lock.
+ */
 struct zram_stats {
-	u64 compr_size;		/* compressed size of pages stored */
-	u64 num_reads;		/* failed + successful */
-	u64 num_writes;		/* --do-- */
-	u64 failed_reads;	/* should NEVER! happen */
-	u64 failed_writes;	/* can happen when memory is too low */
-	u64 invalid_io;		/* non-page-aligned I/O requests */
-	u64 notify_free;	/* no. of swap slot free notifications */
+	atomic64_t compr_size;	/* compressed size of pages stored */
+	atomic64_t num_reads;	/* failed + successful */
+	atomic64_t num_writes;	/* --do-- */
+	atomic64_t failed_reads;	/* should NEVER! happen */
+	atomic64_t failed_writes;	/* can happen when memory is too low */
+	atomic64_t invalid_io;	/* non-page-aligned I/O requests */
+	atomic64_t notify_free;	/* no. of swap slot free notifications */
 	u32 pages_zero;		/* no. of zero filled pages */
 	u32 pages_stored;	/* no. of pages currently stored */
 	u32 good_compress;	/* % of pages with compression ratio<=50% */
-	u32 pages_expand;	/* % of incompressible pages */
+	u32 bad_compress;	/* % of pages with compression ratio>=75% */
 };
 
-struct zram {
-	struct zs_pool *mem_pool;
+struct zram_meta {
 	void *compress_workmem;
 	void *compress_buffer;
 	struct table *table;
-	spinlock_t stat64_lock;	/* protect 64-bit stats */
-	struct rw_semaphore lock; /* protect compression buffers and table
-				   * against concurrent read and writes */
+	struct zs_pool *mem_pool;
+};
+
+struct zram_slot_free {
+	unsigned long index;
+	struct zram_slot_free *next;
+};
+
+struct zram {
+	struct zram_meta *meta;
+	struct rw_semaphore lock; /* protect compression buffers, table,
+				   * 32bit stat counters against concurrent
+				   * notifications, reads and writes */
+
+	struct work_struct free_work;  /* handle pending free request */
+	struct zram_slot_free *slot_free_rq; /* list head of free request */
+
 	struct request_queue *queue;
 	struct gendisk *disk;
 	int init_done;
@@ -119,17 +118,8 @@
 	 * we can store in a disk.
 	 */
 	u64 disksize;	/* bytes */
+	spinlock_t slot_free_lock;
 
 	struct zram_stats stats;
 };
-
-extern struct zram *zram_devices;
-unsigned int zram_get_num_devices(void);
-#ifdef CONFIG_SYSFS
-extern struct attribute_group zram_disk_attr_group;
-#endif
-
-extern int zram_init_device(struct zram *zram);
-extern void __zram_reset_device(struct zram *zram);
-
 #endif
diff --git a/drivers/staging/zram/zram_sysfs.c b/drivers/staging/zram/zram_sysfs.c
deleted file mode 100644
index a7f3771..0000000
--- a/drivers/staging/zram/zram_sysfs.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Compressed RAM block device
- *
- * Copyright (C) 2008, 2009, 2010  Nitin Gupta
- *
- * This code is released using a dual license strategy: BSD/GPL
- * You can choose the licence that better fits your requirements.
- *
- * Released under the terms of 3-clause BSD License
- * Released under the terms of GNU General Public License Version 2.0
- *
- * Project home: http://compcache.googlecode.com/
- */
-
-#include <linux/device.h>
-#include <linux/genhd.h>
-#include <linux/mm.h>
-
-#include "zram_drv.h"
-
-static u64 zram_stat64_read(struct zram *zram, u64 *v)
-{
-	u64 val;
-
-	spin_lock(&zram->stat64_lock);
-	val = *v;
-	spin_unlock(&zram->stat64_lock);
-
-	return val;
-}
-
-static struct zram *dev_to_zram(struct device *dev)
-{
-	int i;
-	struct zram *zram = NULL;
-
-	for (i = 0; i < zram_get_num_devices(); i++) {
-		zram = &zram_devices[i];
-		if (disk_to_dev(zram->disk) == dev)
-			break;
-	}
-
-	return zram;
-}
-
-static ssize_t disksize_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
-{
-	struct zram *zram = dev_to_zram(dev);
-
-	return sprintf(buf, "%llu\n", zram->disksize);
-}
-
-static ssize_t disksize_store(struct device *dev,
-		struct device_attribute *attr, const char *buf, size_t len)
-{
-	int ret;
-	u64 disksize;
-	struct zram *zram = dev_to_zram(dev);
-
-	ret = kstrtoull(buf, 10, &disksize);
-	if (ret)
-		return ret;
-
-	down_write(&zram->init_lock);
-	if (zram->init_done) {
-		up_write(&zram->init_lock);
-		pr_info("Cannot change disksize for initialized device\n");
-		return -EBUSY;
-	}
-
-	zram->disksize = PAGE_ALIGN(disksize);
-	set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT);
-	up_write(&zram->init_lock);
-
-	return len;
-}
-
-static ssize_t initstate_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
-{
-	struct zram *zram = dev_to_zram(dev);
-
-	return sprintf(buf, "%u\n", zram->init_done);
-}
-
-static ssize_t reset_store(struct device *dev,
-		struct device_attribute *attr, const char *buf, size_t len)
-{
-	int ret;
-	unsigned short do_reset;
-	struct zram *zram;
-	struct block_device *bdev;
-
-	zram = dev_to_zram(dev);
-	bdev = bdget_disk(zram->disk, 0);
-
-	/* Do not reset an active device! */
-	if (bdev->bd_holders)
-		return -EBUSY;
-
-	ret = kstrtou16(buf, 10, &do_reset);
-	if (ret)
-		return ret;
-
-	if (!do_reset)
-		return -EINVAL;
-
-	/* Make sure all pending I/O is finished */
-	if (bdev)
-		fsync_bdev(bdev);
-
-	down_write(&zram->init_lock);
-	if (zram->init_done)
-		__zram_reset_device(zram);
-	up_write(&zram->init_lock);
-
-	return len;
-}
-
-static ssize_t num_reads_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
-{
-	struct zram *zram = dev_to_zram(dev);
-
-	return sprintf(buf, "%llu\n",
-		zram_stat64_read(zram, &zram->stats.num_reads));
-}
-
-static ssize_t num_writes_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
-{
-	struct zram *zram = dev_to_zram(dev);
-
-	return sprintf(buf, "%llu\n",
-		zram_stat64_read(zram, &zram->stats.num_writes));
-}
-
-static ssize_t invalid_io_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
-{
-	struct zram *zram = dev_to_zram(dev);
-
-	return sprintf(buf, "%llu\n",
-		zram_stat64_read(zram, &zram->stats.invalid_io));
-}
-
-static ssize_t notify_free_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
-{
-	struct zram *zram = dev_to_zram(dev);
-
-	return sprintf(buf, "%llu\n",
-		zram_stat64_read(zram, &zram->stats.notify_free));
-}
-
-static ssize_t zero_pages_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
-{
-	struct zram *zram = dev_to_zram(dev);
-
-	return sprintf(buf, "%u\n", zram->stats.pages_zero);
-}
-
-static ssize_t orig_data_size_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
-{
-	struct zram *zram = dev_to_zram(dev);
-
-	return sprintf(buf, "%llu\n",
-		(u64)(zram->stats.pages_stored) << PAGE_SHIFT);
-}
-
-static ssize_t compr_data_size_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
-{
-	struct zram *zram = dev_to_zram(dev);
-
-	return sprintf(buf, "%llu\n",
-		zram_stat64_read(zram, &zram->stats.compr_size));
-}
-
-static ssize_t mem_used_total_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
-{
-	u64 val = 0;
-	struct zram *zram = dev_to_zram(dev);
-
-	if (zram->init_done) {
-		val = zs_get_total_size_bytes(zram->mem_pool) +
-			((u64)(zram->stats.pages_expand) << PAGE_SHIFT);
-	}
-
-	return sprintf(buf, "%llu\n", val);
-}
-
-static DEVICE_ATTR(disksize, S_IRUGO | S_IWUSR,
-		disksize_show, disksize_store);
-static DEVICE_ATTR(initstate, S_IRUGO, initstate_show, NULL);
-static DEVICE_ATTR(reset, S_IWUSR, NULL, reset_store);
-static DEVICE_ATTR(num_reads, S_IRUGO, num_reads_show, NULL);
-static DEVICE_ATTR(num_writes, S_IRUGO, num_writes_show, NULL);
-static DEVICE_ATTR(invalid_io, S_IRUGO, invalid_io_show, NULL);
-static DEVICE_ATTR(notify_free, S_IRUGO, notify_free_show, NULL);
-static DEVICE_ATTR(zero_pages, S_IRUGO, zero_pages_show, NULL);
-static DEVICE_ATTR(orig_data_size, S_IRUGO, orig_data_size_show, NULL);
-static DEVICE_ATTR(compr_data_size, S_IRUGO, compr_data_size_show, NULL);
-static DEVICE_ATTR(mem_used_total, S_IRUGO, mem_used_total_show, NULL);
-
-static struct attribute *zram_disk_attrs[] = {
-	&dev_attr_disksize.attr,
-	&dev_attr_initstate.attr,
-	&dev_attr_reset.attr,
-	&dev_attr_num_reads.attr,
-	&dev_attr_num_writes.attr,
-	&dev_attr_invalid_io.attr,
-	&dev_attr_notify_free.attr,
-	&dev_attr_zero_pages.attr,
-	&dev_attr_orig_data_size.attr,
-	&dev_attr_compr_data_size.attr,
-	&dev_attr_mem_used_total.attr,
-	NULL,
-};
-
-struct attribute_group zram_disk_attr_group = {
-	.attrs = zram_disk_attrs,
-};
diff --git a/drivers/staging/zsmalloc/Kconfig b/drivers/staging/zsmalloc/Kconfig
index a5ab720..7fab032 100644
--- a/drivers/staging/zsmalloc/Kconfig
+++ b/drivers/staging/zsmalloc/Kconfig
@@ -1,9 +1,5 @@
 config ZSMALLOC
-	tristate "Memory allocator for compressed pages"
-	# X86 dependency is because of the use of __flush_tlb_one and set_pte
-	# in zsmalloc-main.c.
-	# TODO: convert these to portable functions
-	depends on X86
+	bool "Memory allocator for compressed pages"
 	default n
 	help
 	  zsmalloc is a slab-based memory allocator designed to store
diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c
index 917461c..1a67537 100644
--- a/drivers/staging/zsmalloc/zsmalloc-main.c
+++ b/drivers/staging/zsmalloc/zsmalloc-main.c
@@ -10,6 +10,54 @@
  * Released under the terms of GNU General Public License Version 2.0
  */
 
+
+/*
+ * This allocator is designed for use with zcache and zram. Thus, the
+ * allocator is supposed to work well under low memory conditions. In
+ * particular, it never attempts higher order page allocation which is
+ * very likely to fail under memory pressure. On the other hand, if we
+ * just use single (0-order) pages, it would suffer from very high
+ * fragmentation -- any object of size PAGE_SIZE/2 or larger would occupy
+ * an entire page. This was one of the major issues with its predecessor
+ * (xvmalloc).
+ *
+ * To overcome these issues, zsmalloc allocates a bunch of 0-order pages
+ * and links them together using various 'struct page' fields. These linked
+ * pages act as a single higher-order page i.e. an object can span 0-order
+ * page boundaries. The code refers to these linked pages as a single entity
+ * called zspage.
+ *
+ * Following is how we use various fields and flags of underlying
+ * struct page(s) to form a zspage.
+ *
+ * Usage of struct page fields:
+ *	page->first_page: points to the first component (0-order) page
+ *	page->index (union with page->freelist): offset of the first object
+ *		starting in this page. For the first page, this is
+ *		always 0, so we use this field (aka freelist) to point
+ *		to the first free object in zspage.
+ *	page->lru: links together all component pages (except the first page)
+ *		of a zspage
+ *
+ *	For _first_ page only:
+ *
+ *	page->private (union with page->first_page): refers to the
+ *		component page after the first page
+ *	page->freelist: points to the first free object in zspage.
+ *		Free objects are linked together using in-place
+ *		metadata.
+ *	page->objects: maximum number of objects we can store in this
+ *		zspage (class->zspage_order * PAGE_SIZE / class->size)
+ *	page->lru: links together first pages of various zspages.
+ *		Basically forming list of zspages in a fullness group.
+ *	page->mapping: class index and fullness group of the zspage
+ *
+ * Usage of struct page flags:
+ *	PG_private: identifies the first component page
+ *	PG_private2: identifies the last component page
+ *
+ */
+
 #ifdef CONFIG_ZSMALLOC_DEBUG
 #define DEBUG
 #endif
@@ -27,9 +75,139 @@
 #include <linux/cpumask.h>
 #include <linux/cpu.h>
 #include <linux/vmalloc.h>
+#include <linux/hardirq.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
 
 #include "zsmalloc.h"
-#include "zsmalloc_int.h"
+
+/*
+ * This must be power of 2 and greater than of equal to sizeof(link_free).
+ * These two conditions ensure that any 'struct link_free' itself doesn't
+ * span more than 1 page which avoids complex case of mapping 2 pages simply
+ * to restore link_free pointer values.
+ */
+#define ZS_ALIGN		8
+
+/*
+ * A single 'zspage' is composed of up to 2^N discontiguous 0-order (single)
+ * pages. ZS_MAX_ZSPAGE_ORDER defines upper limit on N.
+ */
+#define ZS_MAX_ZSPAGE_ORDER 2
+#define ZS_MAX_PAGES_PER_ZSPAGE (_AC(1, UL) << ZS_MAX_ZSPAGE_ORDER)
+
+/*
+ * Object location (<PFN>, <obj_idx>) is encoded as
+ * as single (void *) handle value.
+ *
+ * Note that object index <obj_idx> is relative to system
+ * page <PFN> it is stored in, so for each sub-page belonging
+ * to a zspage, obj_idx starts with 0.
+ *
+ * This is made more complicated by various memory models and PAE.
+ */
+
+#ifndef MAX_PHYSMEM_BITS
+#ifdef CONFIG_HIGHMEM64G
+#define MAX_PHYSMEM_BITS 36
+#else /* !CONFIG_HIGHMEM64G */
+/*
+ * If this definition of MAX_PHYSMEM_BITS is used, OBJ_INDEX_BITS will just
+ * be PAGE_SHIFT
+ */
+#define MAX_PHYSMEM_BITS BITS_PER_LONG
+#endif
+#endif
+#define _PFN_BITS		(MAX_PHYSMEM_BITS - PAGE_SHIFT)
+#define OBJ_INDEX_BITS	(BITS_PER_LONG - _PFN_BITS)
+#define OBJ_INDEX_MASK	((_AC(1, UL) << OBJ_INDEX_BITS) - 1)
+
+#define MAX(a, b) ((a) >= (b) ? (a) : (b))
+/* ZS_MIN_ALLOC_SIZE must be multiple of ZS_ALIGN */
+#define ZS_MIN_ALLOC_SIZE \
+	MAX(32, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS))
+#define ZS_MAX_ALLOC_SIZE	PAGE_SIZE
+
+/*
+ * On systems with 4K page size, this gives 254 size classes! There is a
+ * trader-off here:
+ *  - Large number of size classes is potentially wasteful as free page are
+ *    spread across these classes
+ *  - Small number of size classes causes large internal fragmentation
+ *  - Probably its better to use specific size classes (empirically
+ *    determined). NOTE: all those class sizes must be set as multiple of
+ *    ZS_ALIGN to make sure link_free itself never has to span 2 pages.
+ *
+ *  ZS_MIN_ALLOC_SIZE and ZS_SIZE_CLASS_DELTA must be multiple of ZS_ALIGN
+ *  (reason above)
+ */
+#define ZS_SIZE_CLASS_DELTA	(PAGE_SIZE >> 8)
+#define ZS_SIZE_CLASSES		((ZS_MAX_ALLOC_SIZE - ZS_MIN_ALLOC_SIZE) / \
+					ZS_SIZE_CLASS_DELTA + 1)
+
+/*
+ * We do not maintain any list for completely empty or full pages
+ */
+enum fullness_group {
+	ZS_ALMOST_FULL,
+	ZS_ALMOST_EMPTY,
+	_ZS_NR_FULLNESS_GROUPS,
+
+	ZS_EMPTY,
+	ZS_FULL
+};
+
+/*
+ * We assign a page to ZS_ALMOST_EMPTY fullness group when:
+ *	n <= N / f, where
+ * n = number of allocated objects
+ * N = total number of objects zspage can store
+ * f = 1/fullness_threshold_frac
+ *
+ * Similarly, we assign zspage to:
+ *	ZS_ALMOST_FULL	when n > N / f
+ *	ZS_EMPTY	when n == 0
+ *	ZS_FULL		when n == N
+ *
+ * (see: fix_fullness_group())
+ */
+static const int fullness_threshold_frac = 4;
+
+struct size_class {
+	/*
+	 * Size of objects stored in this class. Must be multiple
+	 * of ZS_ALIGN.
+	 */
+	int size;
+	unsigned int index;
+
+	/* Number of PAGE_SIZE sized pages to combine to form a 'zspage' */
+	int pages_per_zspage;
+
+	spinlock_t lock;
+
+	/* stats */
+	u64 pages_allocated;
+
+	struct page *fullness_list[_ZS_NR_FULLNESS_GROUPS];
+};
+
+/*
+ * Placed within free objects to form a singly linked list.
+ * For every zspage, first_page->freelist gives head of this list.
+ *
+ * This must be power of 2 and less than or equal to ZS_ALIGN
+ */
+struct link_free {
+	/* Handle of next free chunk (encodes <PFN, obj_idx>) */
+	void *next;
+};
+
+struct zs_pool {
+	struct size_class size_class[ZS_SIZE_CLASSES];
+
+	gfp_t flags;	/* allocation flags used when growing pool */
+};
 
 /*
  * A zspage's class index and fullness group
@@ -40,17 +218,39 @@
 #define CLASS_IDX_MASK	((1 << CLASS_IDX_BITS) - 1)
 #define FULLNESS_MASK	((1 << FULLNESS_BITS) - 1)
 
+/*
+ * By default, zsmalloc uses a copy-based object mapping method to access
+ * allocations that span two pages. However, if a particular architecture
+ * performs VM mapping faster than copying, then it should be added here
+ * so that USE_PGTABLE_MAPPING is defined. This causes zsmalloc to use
+ * page table mapping rather than copying for object mapping.
+ */
+#if defined(CONFIG_ARM) && !defined(MODULE)
+#define USE_PGTABLE_MAPPING
+#endif
+
+struct mapping_area {
+#ifdef USE_PGTABLE_MAPPING
+	struct vm_struct *vm; /* vm area for mapping object that span pages */
+#else
+	char *vm_buf; /* copy buffer for objects that span pages */
+#endif
+	char *vm_addr; /* address of kmap_atomic()'ed pages */
+	enum zs_mapmode vm_mm; /* mapping mode */
+};
+
+
 /* per-cpu VM mapping areas for zspage accesses that cross page boundaries */
 static DEFINE_PER_CPU(struct mapping_area, zs_map_area);
 
 static int is_first_page(struct page *page)
 {
-	return test_bit(PG_private, &page->flags);
+	return PagePrivate(page);
 }
 
 static int is_last_page(struct page *page)
 {
-	return test_bit(PG_private_2, &page->flags);
+	return PagePrivate2(page);
 }
 
 static void get_zspage_mapping(struct page *page, unsigned int *class_idx,
@@ -180,7 +380,7 @@
  * link together 3 PAGE_SIZE sized pages to form a zspage
  * since then we can perfectly fit in 8 such objects.
  */
-static int get_zspage_order(int class_size)
+static int get_pages_per_zspage(int class_size)
 {
 	int i, max_usedpc = 0;
 	/* zspage order which gives maximum used size per KB */
@@ -223,7 +423,7 @@
 	if (is_last_page(page))
 		next = NULL;
 	else if (is_first_page(page))
-		next = (struct page *)page->private;
+		next = (struct page *)page_private(page);
 	else
 		next = list_entry(page->lru.next, struct page, lru);
 
@@ -247,13 +447,11 @@
 }
 
 /* Decode <page, obj_idx> pair from the given object handle */
-static void obj_handle_to_location(void *handle, struct page **page,
+static void obj_handle_to_location(unsigned long handle, struct page **page,
 				unsigned long *obj_idx)
 {
-	unsigned long hval = (unsigned long)handle;
-
-	*page = pfn_to_page(hval >> OBJ_INDEX_BITS);
-	*obj_idx = hval & OBJ_INDEX_MASK;
+	*page = pfn_to_page(handle >> OBJ_INDEX_BITS);
+	*obj_idx = handle & OBJ_INDEX_MASK;
 }
 
 static unsigned long obj_idx_to_offset(struct page *page,
@@ -274,7 +472,7 @@
 	set_page_private(page, 0);
 	page->mapping = NULL;
 	page->freelist = NULL;
-	reset_page_mapcount(page);
+	page_mapcount_reset(page);
 }
 
 static void free_zspage(struct page *first_page)
@@ -354,7 +552,7 @@
 static struct page *alloc_zspage(struct size_class *class, gfp_t flags)
 {
 	int i, error;
-	struct page *first_page = NULL;
+	struct page *first_page = NULL, *uninitialized_var(prev_page);
 
 	/*
 	 * Allocate individual pages and link them together as:
@@ -368,8 +566,8 @@
 	 * identify the last page.
 	 */
 	error = -ENOMEM;
-	for (i = 0; i < class->zspage_order; i++) {
-		struct page *page, *prev_page;
+	for (i = 0; i < class->pages_per_zspage; i++) {
+		struct page *page;
 
 		page = alloc_page(flags);
 		if (!page)
@@ -377,20 +575,19 @@
 
 		INIT_LIST_HEAD(&page->lru);
 		if (i == 0) {	/* first page */
-			set_bit(PG_private, &page->flags);
+			SetPagePrivate(page);
 			set_page_private(page, 0);
 			first_page = page;
 			first_page->inuse = 0;
 		}
 		if (i == 1)
-			first_page->private = (unsigned long)page;
+			set_page_private(first_page, (unsigned long)page);
 		if (i >= 1)
 			page->first_page = first_page;
 		if (i >= 2)
 			list_add(&page->lru, &prev_page->lru);
-		if (i == class->zspage_order - 1)	/* last page */
-			set_bit(PG_private_2, &page->flags);
-
+		if (i == class->pages_per_zspage - 1)	/* last page */
+			SetPagePrivate2(page);
 		prev_page = page;
 	}
 
@@ -398,7 +595,7 @@
 
 	first_page->freelist = obj_location_to_handle(first_page, 0);
 	/* Maximum number of objects we can store in this zspage */
-	first_page->objects = class->zspage_order * PAGE_SIZE / class->size;
+	first_page->objects = class->pages_per_zspage * PAGE_SIZE / class->size;
 
 	error = 0; /* Success */
 
@@ -425,34 +622,141 @@
 	return page;
 }
 
+#ifdef USE_PGTABLE_MAPPING
+static inline int __zs_cpu_up(struct mapping_area *area)
+{
+	/*
+	 * Make sure we don't leak memory if a cpu UP notification
+	 * and zs_init() race and both call zs_cpu_up() on the same cpu
+	 */
+	if (area->vm)
+		return 0;
+	area->vm = alloc_vm_area(PAGE_SIZE * 2, NULL);
+	if (!area->vm)
+		return -ENOMEM;
+	return 0;
+}
 
-/*
- * 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 inline void __zs_cpu_down(struct mapping_area *area)
+{
+	if (area->vm)
+		free_vm_area(area->vm);
+	area->vm = NULL;
+}
+
+static inline void *__zs_map_object(struct mapping_area *area,
+				struct page *pages[2], int off, int size)
+{
+	BUG_ON(map_vm_area(area->vm, PAGE_KERNEL, &pages));
+	area->vm_addr = area->vm->addr;
+	return area->vm_addr + off;
+}
+
+static inline void __zs_unmap_object(struct mapping_area *area,
+				struct page *pages[2], int off, int size)
+{
+	unsigned long addr = (unsigned long)area->vm_addr;
+
+	unmap_kernel_range(addr, PAGE_SIZE * 2);
+}
+
+#else /* USE_PGTABLE_MAPPING */
+
+static inline int __zs_cpu_up(struct mapping_area *area)
+{
+	/*
+	 * Make sure we don't leak memory if a cpu UP notification
+	 * and zs_init() race and both call zs_cpu_up() on the same cpu
+	 */
+	if (area->vm_buf)
+		return 0;
+	area->vm_buf = (char *)__get_free_page(GFP_KERNEL);
+	if (!area->vm_buf)
+		return -ENOMEM;
+	return 0;
+}
+
+static inline void __zs_cpu_down(struct mapping_area *area)
+{
+	if (area->vm_buf)
+		free_page((unsigned long)area->vm_buf);
+	area->vm_buf = NULL;
+}
+
+static void *__zs_map_object(struct mapping_area *area,
+			struct page *pages[2], int off, int size)
+{
+	int sizes[2];
+	void *addr;
+	char *buf = area->vm_buf;
+
+	/* disable page faults to match kmap_atomic() return conditions */
+	pagefault_disable();
+
+	/* no read fastpath */
+	if (area->vm_mm == ZS_MM_WO)
+		goto out;
+
+	sizes[0] = PAGE_SIZE - off;
+	sizes[1] = size - sizes[0];
+
+	/* copy object to per-cpu buffer */
+	addr = kmap_atomic(pages[0]);
+	memcpy(buf, addr + off, sizes[0]);
+	kunmap_atomic(addr);
+	addr = kmap_atomic(pages[1]);
+	memcpy(buf + sizes[0], addr, sizes[1]);
+	kunmap_atomic(addr);
+out:
+	return area->vm_buf;
+}
+
+static void __zs_unmap_object(struct mapping_area *area,
+			struct page *pages[2], int off, int size)
+{
+	int sizes[2];
+	void *addr;
+	char *buf = area->vm_buf;
+
+	/* no write fastpath */
+	if (area->vm_mm == ZS_MM_RO)
+		goto out;
+
+	sizes[0] = PAGE_SIZE - off;
+	sizes[1] = size - sizes[0];
+
+	/* copy per-cpu buffer to object */
+	addr = kmap_atomic(pages[0]);
+	memcpy(addr + off, buf, sizes[0]);
+	kunmap_atomic(addr);
+	addr = kmap_atomic(pages[1]);
+	memcpy(addr, buf + sizes[0], sizes[1]);
+	kunmap_atomic(addr);
+
+out:
+	/* enable page faults to match kunmap_atomic() return conditions */
+	pagefault_enable();
+}
+
+#endif /* USE_PGTABLE_MAPPING */
 
 static int zs_cpu_notifier(struct notifier_block *nb, unsigned long action,
 				void *pcpu)
 {
-	int cpu = (long)pcpu;
+	int ret, cpu = (long)pcpu;
 	struct mapping_area *area;
 
 	switch (action) {
 	case CPU_UP_PREPARE:
 		area = &per_cpu(zs_map_area, cpu);
-		if (area->vm)
-			break;
-		area->vm = alloc_vm_area(2 * PAGE_SIZE, area->vm_ptes);
-		if (!area->vm)
-			return notifier_from_errno(-ENOMEM);
+		ret = __zs_cpu_up(area);
+		if (ret)
+			return notifier_from_errno(ret);
 		break;
 	case CPU_DEAD:
 	case CPU_UP_CANCELED:
 		area = &per_cpu(zs_map_area, cpu);
-		if (area->vm)
-			free_vm_area(area->vm);
-		area->vm = NULL;
+		__zs_cpu_down(area);
 		break;
 	}
 
@@ -488,14 +792,21 @@
 	return notifier_to_errno(ret);
 }
 
-struct zs_pool *zs_create_pool(const char *name, gfp_t flags)
+/**
+ * zs_create_pool - Creates an allocation pool to work from.
+ * @flags: allocation flags used to allocate pool metadata
+ *
+ * This function must be called before anything when using
+ * the zsmalloc allocator.
+ *
+ * On success, a pointer to the newly created pool is returned,
+ * otherwise NULL.
+ */
+struct zs_pool *zs_create_pool(gfp_t flags)
 {
-	int i, error, ovhd_size;
+	int i, ovhd_size;
 	struct zs_pool *pool;
 
-	if (!name)
-		return NULL;
-
 	ovhd_size = roundup(sizeof(*pool), PAGE_SIZE);
 	pool = kzalloc(ovhd_size, GFP_KERNEL);
 	if (!pool)
@@ -513,31 +824,11 @@
 		class->size = size;
 		class->index = i;
 		spin_lock_init(&class->lock);
-		class->zspage_order = get_zspage_order(size);
+		class->pages_per_zspage = get_pages_per_zspage(size);
 
 	}
 
-	/*
-	 * 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;
 }
@@ -553,8 +844,7 @@
 
 		for (fg = 0; fg < _ZS_NR_FULLNESS_GROUPS; fg++) {
 			if (class->fullness_list[fg]) {
-				pr_info("Freeing non-empty class with size "
-					"%db, fullness group %d\n",
+				pr_info("Freeing non-empty class with size %db, fullness group %d\n",
 					class->size, fg);
 			}
 		}
@@ -567,18 +857,14 @@
  * zs_malloc - Allocate block of given size from pool.
  * @pool: pool to allocate from
  * @size: size of block to allocate
- * @page: page no. that holds the object
- * @offset: location of object within page
  *
- * On success, <page, offset> identifies block allocated
- * and 0 is returned. On failure, <page, offset> is set to
- * 0 and -ENOMEM is returned.
- *
+ * On success, handle to the allocated object is returned,
+ * otherwise 0.
  * Allocation requests with size > ZS_MAX_ALLOC_SIZE will fail.
  */
-void *zs_malloc(struct zs_pool *pool, size_t size)
+unsigned long zs_malloc(struct zs_pool *pool, size_t size)
 {
-	void *obj;
+	unsigned long obj;
 	struct link_free *link;
 	int class_idx;
 	struct size_class *class;
@@ -587,7 +873,7 @@
 	unsigned long m_objidx, m_offset;
 
 	if (unlikely(!size || size > ZS_MAX_ALLOC_SIZE))
-		return NULL;
+		return 0;
 
 	class_idx = get_size_class_index(size);
 	class = &pool->size_class[class_idx];
@@ -600,14 +886,14 @@
 		spin_unlock(&class->lock);
 		first_page = alloc_zspage(class, pool->flags);
 		if (unlikely(!first_page))
-			return NULL;
+			return 0;
 
 		set_zspage_mapping(first_page, class->index, ZS_EMPTY);
 		spin_lock(&class->lock);
-		class->pages_allocated += class->zspage_order;
+		class->pages_allocated += class->pages_per_zspage;
 	}
 
-	obj = first_page->freelist;
+	obj = (unsigned long)first_page->freelist;
 	obj_handle_to_location(obj, &m_page, &m_objidx);
 	m_offset = obj_idx_to_offset(m_page, m_objidx, class->size);
 
@@ -626,7 +912,7 @@
 }
 EXPORT_SYMBOL_GPL(zs_malloc);
 
-void zs_free(struct zs_pool *pool, void *obj)
+void zs_free(struct zs_pool *pool, unsigned long obj)
 {
 	struct link_free *link;
 	struct page *first_page, *f_page;
@@ -653,13 +939,13 @@
 							+ f_offset);
 	link->next = first_page->freelist;
 	kunmap_atomic(link);
-	first_page->freelist = obj;
+	first_page->freelist = (void *)obj;
 
 	first_page->inuse--;
 	fullness = fix_fullness_group(pool, first_page);
 
 	if (fullness == ZS_EMPTY)
-		class->pages_allocated -= class->zspage_order;
+		class->pages_allocated -= class->pages_per_zspage;
 
 	spin_unlock(&class->lock);
 
@@ -668,7 +954,22 @@
 }
 EXPORT_SYMBOL_GPL(zs_free);
 
-void *zs_map_object(struct zs_pool *pool, void *handle)
+/**
+ * zs_map_object - get address of allocated object from handle.
+ * @pool: pool from which the object was allocated
+ * @handle: handle returned from zs_malloc
+ *
+ * Before using an object allocated from zs_malloc, it must be mapped using
+ * this function. When done with the object, it must be unmapped using
+ * zs_unmap_object.
+ *
+ * Only one object can be mapped per cpu at a time. There is no protection
+ * against nested mappings.
+ *
+ * This function returns with preemption and page faults disabled.
+ */
+void *zs_map_object(struct zs_pool *pool, unsigned long handle,
+			enum zs_mapmode mm)
 {
 	struct page *page;
 	unsigned long obj_idx, off;
@@ -677,38 +978,40 @@
 	enum fullness_group fg;
 	struct size_class *class;
 	struct mapping_area *area;
+	struct page *pages[2];
 
 	BUG_ON(!handle);
 
+	/*
+	 * Because we use per-cpu mapping areas shared among the
+	 * pools/users, we can't allow mapping in interrupt context
+	 * because it can corrupt another users mappings.
+	 */
+	BUG_ON(in_interrupt());
+
 	obj_handle_to_location(handle, &page, &obj_idx);
 	get_zspage_mapping(get_first_page(page), &class_idx, &fg);
 	class = &pool->size_class[class_idx];
 	off = obj_idx_to_offset(page, obj_idx, class->size);
 
 	area = &get_cpu_var(zs_map_area);
+	area->vm_mm = mm;
 	if (off + class->size <= PAGE_SIZE) {
 		/* this object is contained entirely within a page */
 		area->vm_addr = kmap_atomic(page);
-	} else {
-		/* this object spans two pages */
-		struct page *nextp;
-
-		nextp = get_next_page(page);
-		BUG_ON(!nextp);
-
-
-		set_pte(area->vm_ptes[0], mk_pte(page, PAGE_KERNEL));
-		set_pte(area->vm_ptes[1], mk_pte(nextp, PAGE_KERNEL));
-
-		/* We pre-allocated VM area so mapping can never fail */
-		area->vm_addr = area->vm->addr;
+		return area->vm_addr + off;
 	}
 
-	return area->vm_addr + off;
+	/* this object spans two pages */
+	pages[0] = page;
+	pages[1] = get_next_page(page);
+	BUG_ON(!pages[1]);
+
+	return __zs_map_object(area, pages, off, class->size);
 }
 EXPORT_SYMBOL_GPL(zs_map_object);
 
-void zs_unmap_object(struct zs_pool *pool, void *handle)
+void zs_unmap_object(struct zs_pool *pool, unsigned long handle)
 {
 	struct page *page;
 	unsigned long obj_idx, off;
@@ -726,13 +1029,16 @@
 	off = obj_idx_to_offset(page, obj_idx, class->size);
 
 	area = &__get_cpu_var(zs_map_area);
-	if (off + class->size <= PAGE_SIZE) {
+	if (off + class->size <= PAGE_SIZE)
 		kunmap_atomic(area->vm_addr);
-	} else {
-		set_pte(area->vm_ptes[0], __pte(0));
-		set_pte(area->vm_ptes[1], __pte(0));
-		__flush_tlb_one((unsigned long)area->vm_addr);
-		__flush_tlb_one((unsigned long)area->vm_addr + PAGE_SIZE);
+	else {
+		struct page *pages[2];
+
+		pages[0] = page;
+		pages[1] = get_next_page(page);
+		BUG_ON(!pages[1]);
+
+		__zs_unmap_object(area, pages, off, class->size);
 	}
 	put_cpu_var(zs_map_area);
 }
@@ -749,3 +1055,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/staging/zsmalloc/zsmalloc.h b/drivers/staging/zsmalloc/zsmalloc.h
index 949384e..fbe6bec 100644
--- a/drivers/staging/zsmalloc/zsmalloc.h
+++ b/drivers/staging/zsmalloc/zsmalloc.h
@@ -15,16 +15,28 @@
 
 #include <linux/types.h>
 
+/*
+ * zsmalloc mapping modes
+ *
+ * NOTE: These only make a difference when a mapped object spans pages
+ */
+enum zs_mapmode {
+	ZS_MM_RW, /* normal read-write mapping */
+	ZS_MM_RO, /* read-only (no copy-out at unmap time) */
+	ZS_MM_WO /* write-only (no copy-in at map time) */
+};
+
 struct zs_pool;
 
-struct zs_pool *zs_create_pool(const char *name, gfp_t flags);
+struct zs_pool *zs_create_pool(gfp_t flags);
 void zs_destroy_pool(struct zs_pool *pool);
 
-void *zs_malloc(struct zs_pool *pool, size_t size);
-void zs_free(struct zs_pool *pool, void *obj);
+unsigned long zs_malloc(struct zs_pool *pool, size_t size);
+void zs_free(struct zs_pool *pool, unsigned long obj);
 
-void *zs_map_object(struct zs_pool *pool, void *handle);
-void zs_unmap_object(struct zs_pool *pool, void *handle);
+void *zs_map_object(struct zs_pool *pool, unsigned long handle,
+			enum zs_mapmode mm);
+void zs_unmap_object(struct zs_pool *pool, unsigned long handle);
 
 u64 zs_get_total_size_bytes(struct zs_pool *pool);
 
diff --git a/drivers/staging/zsmalloc/zsmalloc_int.h b/drivers/staging/zsmalloc/zsmalloc_int.h
deleted file mode 100644
index 92eefc6..0000000
--- a/drivers/staging/zsmalloc/zsmalloc_int.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * zsmalloc memory allocator
- *
- * Copyright (C) 2011  Nitin Gupta
- *
- * This code is released using a dual license strategy: BSD/GPL
- * You can choose the license that better fits your requirements.
- *
- * Released under the terms of 3-clause BSD License
- * Released under the terms of GNU General Public License Version 2.0
- */
-
-#ifndef _ZS_MALLOC_INT_H_
-#define _ZS_MALLOC_INT_H_
-
-#include <linux/kernel.h>
-#include <linux/spinlock.h>
-#include <linux/types.h>
-
-/*
- * This must be power of 2 and greater than of equal to sizeof(link_free).
- * These two conditions ensure that any 'struct link_free' itself doesn't
- * span more than 1 page which avoids complex case of mapping 2 pages simply
- * to restore link_free pointer values.
- */
-#define ZS_ALIGN		8
-
-/*
- * A single 'zspage' is composed of up to 2^N discontiguous 0-order (single)
- * pages. ZS_MAX_ZSPAGE_ORDER defines upper limit on N.
- */
-#define ZS_MAX_ZSPAGE_ORDER 2
-#define ZS_MAX_PAGES_PER_ZSPAGE (_AC(1, UL) << ZS_MAX_ZSPAGE_ORDER)
-
-/*
- * Object location (<PFN>, <obj_idx>) is encoded as
- * as single (void *) handle value.
- *
- * Note that object index <obj_idx> is relative to system
- * page <PFN> it is stored in, so for each sub-page belonging
- * to a zspage, obj_idx starts with 0.
- *
- * This is made more complicated by various memory models and PAE.
- */
-
-#ifndef MAX_PHYSMEM_BITS
-#ifdef CONFIG_HIGHMEM64G
-#define MAX_PHYSMEM_BITS 36
-#else /* !CONFIG_HIGHMEM64G */
-/*
- * If this definition of MAX_PHYSMEM_BITS is used, OBJ_INDEX_BITS will just
- * be PAGE_SHIFT
- */
-#define MAX_PHYSMEM_BITS BITS_PER_LONG
-#endif
-#endif
-#define _PFN_BITS		(MAX_PHYSMEM_BITS - PAGE_SHIFT)
-#define OBJ_INDEX_BITS	(BITS_PER_LONG - _PFN_BITS)
-#define OBJ_INDEX_MASK	((_AC(1, UL) << OBJ_INDEX_BITS) - 1)
-
-#define MAX(a, b) ((a) >= (b) ? (a) : (b))
-/* ZS_MIN_ALLOC_SIZE must be multiple of ZS_ALIGN */
-#define ZS_MIN_ALLOC_SIZE \
-	MAX(32, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS))
-#define ZS_MAX_ALLOC_SIZE	PAGE_SIZE
-
-/*
- * On systems with 4K page size, this gives 254 size classes! There is a
- * trader-off here:
- *  - Large number of size classes is potentially wasteful as free page are
- *    spread across these classes
- *  - Small number of size classes causes large internal fragmentation
- *  - Probably its better to use specific size classes (empirically
- *    determined). NOTE: all those class sizes must be set as multiple of
- *    ZS_ALIGN to make sure link_free itself never has to span 2 pages.
- *
- *  ZS_MIN_ALLOC_SIZE and ZS_SIZE_CLASS_DELTA must be multiple of ZS_ALIGN
- *  (reason above)
- */
-#define ZS_SIZE_CLASS_DELTA	16
-#define ZS_SIZE_CLASSES		((ZS_MAX_ALLOC_SIZE - ZS_MIN_ALLOC_SIZE) / \
-					ZS_SIZE_CLASS_DELTA + 1)
-
-/*
- * We do not maintain any list for completely empty or full pages
- */
-enum fullness_group {
-	ZS_ALMOST_FULL,
-	ZS_ALMOST_EMPTY,
-	_ZS_NR_FULLNESS_GROUPS,
-
-	ZS_EMPTY,
-	ZS_FULL
-};
-
-/*
- * We assign a page to ZS_ALMOST_EMPTY fullness group when:
- *	n <= N / f, where
- * n = number of allocated objects
- * N = total number of objects zspage can store
- * f = 1/fullness_threshold_frac
- *
- * Similarly, we assign zspage to:
- *	ZS_ALMOST_FULL	when n > N / f
- *	ZS_EMPTY	when n == 0
- *	ZS_FULL		when n == N
- *
- * (see: fix_fullness_group())
- */
-static const int fullness_threshold_frac = 4;
-
-struct mapping_area {
-	struct vm_struct *vm;
-	pte_t *vm_ptes[2];
-	char *vm_addr;
-};
-
-struct size_class {
-	/*
-	 * Size of objects stored in this class. Must be multiple
-	 * of ZS_ALIGN.
-	 */
-	int size;
-	unsigned int index;
-
-	/* Number of PAGE_SIZE sized pages to combine to form a 'zspage' */
-	int zspage_order;
-
-	spinlock_t lock;
-
-	/* stats */
-	u64 pages_allocated;
-
-	struct page *fullness_list[_ZS_NR_FULLNESS_GROUPS];
-};
-
-/*
- * Placed within free objects to form a singly linked list.
- * For every zspage, first_page->freelist gives head of this list.
- *
- * This must be power of 2 and less than or equal to ZS_ALIGN
- */
-struct link_free {
-	/* Handle of next free chunk (encodes <PFN, obj_idx>) */
-	void *next;
-};
-
-struct zs_pool {
-	struct size_class size_class[ZS_SIZE_CLASSES];
-
-	gfp_t flags;	/* allocation flags used when growing pool */
-	const char *name;
-};
-
-#endif
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 98c6884..90dd115 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -153,8 +153,7 @@
 	reg |= DWC3_GCTL_CORESOFTRESET;
 	dwc3_writel(dwc->regs, DWC3_GCTL, reg);
 
-	if (dwc->revision >= DWC3_REVISION_230A)
-		dwc3_notify_event(dwc, DWC3_CONTROLLER_RESET_EVENT);
+	dwc3_notify_event(dwc, DWC3_CONTROLLER_RESET_EVENT);
 
 	/* Assert USB3 PHY reset */
 	reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
@@ -185,8 +184,7 @@
 	reg &= ~DWC3_GCTL_CORESOFTRESET;
 	dwc3_writel(dwc->regs, DWC3_GCTL, reg);
 
-	if (dwc->revision >= DWC3_REVISION_230A)
-		dwc3_notify_event(dwc, DWC3_CONTROLLER_POST_RESET_EVENT);
+	dwc3_notify_event(dwc, DWC3_CONTROLLER_POST_RESET_EVENT);
 }
 
 /**
@@ -503,6 +501,7 @@
 {
 	dwc3_core_init(dwc);
 	dwc3_gadget_restart(dwc);
+	dwc3_notify_event(dwc, DWC3_CONTROLLER_POST_INITIALIZATION_EVENT);
 }
 
 static void (*notify_event) (struct dwc3 *, unsigned);
@@ -682,6 +681,8 @@
 		goto err2;
 	}
 
+	dwc3_notify_event(dwc, DWC3_CONTROLLER_POST_INITIALIZATION_EVENT);
+
 	return 0;
 
 err2:
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 068dd5f..1be2550 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -649,6 +649,7 @@
 #define DWC3_CONTROLLER_ERROR_EVENT			0
 #define DWC3_CONTROLLER_RESET_EVENT			1
 #define DWC3_CONTROLLER_POST_RESET_EVENT		2
+#define DWC3_CONTROLLER_POST_INITIALIZATION_EVENT	3
 /**
  * struct dwc3 - representation of our controller
  * @ctrl_req: usb control request which is used for ep0
diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c
index 784ff3f..554cce8 100644
--- a/drivers/usb/dwc3/dwc3-msm.c
+++ b/drivers/usb/dwc3/dwc3-msm.c
@@ -1505,6 +1505,9 @@
 {
 	struct dwc3_msm *mdwc = dev_get_drvdata(dwc->dev->parent);
 
+	if (dwc->revision < DWC3_REVISION_230A)
+		return;
+
 	switch (event) {
 	case DWC3_CONTROLLER_ERROR_EVENT:
 		dev_info(mdwc->dev, "DWC3_CONTROLLER_ERROR_EVENT received\n");
@@ -1526,6 +1529,10 @@
 					DWC3_CONTROLLER_POST_RESET_EVENT);
 		dwc->tx_fifo_size = mdwc->tx_fifo_size;
 		break;
+	case DWC3_CONTROLLER_POST_INITIALIZATION_EVENT:
+		/* clear LANE0_PWR_PRESENT bit after initialization is done */
+		dwc3_msm_write_readback(mdwc->base, SS_PHY_CTRL_REG, (1 << 24),
+									0x0);
 	default:
 		dev_dbg(mdwc->dev, "unknown dwc3 event\n");
 		break;
diff --git a/drivers/usb/gadget/f_qdss.c b/drivers/usb/gadget/f_qdss.c
index f649248..dcfa2bc 100644
--- a/drivers/usb/gadget/f_qdss.c
+++ b/drivers/usb/gadget/f_qdss.c
@@ -605,7 +605,7 @@
 
 	spin_lock_irqsave(&d_lock, flags);
 	list_for_each_entry(ch, &usb_qdss_ch_list, list) {
-		if (!strncmp(name, ch->name, sizeof(ch->name))) {
+		if (!strcmp(name, ch->name)) {
 			found = 1;
 			break;
 		}
@@ -767,7 +767,7 @@
 	spin_lock_irqsave(&d_lock, flags);
 	/* Check if we already have a channel with this name */
 	list_for_each_entry(ch, &usb_qdss_ch_list, list) {
-		if (!strncmp(name, ch->name, sizeof(ch->name))) {
+		if (!strcmp(name, ch->name)) {
 			found = 1;
 			break;
 		}
diff --git a/drivers/usb/host/ehci-msm-hsic.c b/drivers/usb/host/ehci-msm-hsic.c
index 5d58f16..5f20ad1 100644
--- a/drivers/usb/host/ehci-msm-hsic.c
+++ b/drivers/usb/host/ehci-msm-hsic.c
@@ -1947,7 +1947,6 @@
 	if (pdev->dev.of_node) {
 		dev_dbg(&pdev->dev, "device tree enabled\n");
 		pdev->dev.platform_data = msm_hsic_dt_to_pdata(pdev);
-		dev_set_name(&pdev->dev, ehci_msm_hsic_driver.driver.name);
 	} else {
 		/* explicitly pass wakeup_irq flag for !DT */
 		wakeup_irq_flags = IRQF_TRIGGER_HIGH;
diff --git a/drivers/video/msm/mdss/dsi_host_v2.c b/drivers/video/msm/mdss/dsi_host_v2.c
index e416a55..7d57f64 100644
--- a/drivers/video/msm/mdss/dsi_host_v2.c
+++ b/drivers/video/msm/mdss/dsi_host_v2.c
@@ -77,7 +77,7 @@
 
 	if (status) {
 		MIPI_OUTP(ctrl_base + DSI_ACK_ERR_STATUS, status);
-		pr_debug("%s: status=%x\n", __func__, status);
+		pr_err("%s: status=%x\n", __func__, status);
 	}
 }
 
@@ -88,7 +88,7 @@
 	status = MIPI_INP(ctrl_base + DSI_TIMEOUT_STATUS);
 	if (status & 0x0111) {
 		MIPI_OUTP(ctrl_base + DSI_TIMEOUT_STATUS, status);
-		pr_debug("%s: status=%x\n", __func__, status);
+		pr_err("%s: status=%x\n", __func__, status);
 	}
 }
 
@@ -100,7 +100,7 @@
 
 	if (status & 0x011111) {
 		MIPI_OUTP(ctrl_base + DSI_DLN0_PHY_ERR, status);
-		pr_debug("%s: status=%x\n", __func__, status);
+		pr_err("%s: status=%x\n", __func__, status);
 	}
 }
 
@@ -112,7 +112,7 @@
 
 	if (status & 0x44444489) {
 		MIPI_OUTP(ctrl_base + DSI_FIFO_STATUS, status);
-		pr_debug("%s: status=%x\n", __func__, status);
+		pr_err("%s: status=%x\n", __func__, status);
 	}
 }
 
@@ -124,7 +124,7 @@
 
 	if (status & 0x80000000) {
 		MIPI_OUTP(ctrl_base + DSI_STATUS, status);
-		pr_debug("%s: status=%x\n", __func__, status);
+		pr_err("%s: status=%x\n", __func__, status);
 	}
 }
 
diff --git a/drivers/video/msm/mdss/mdp3.c b/drivers/video/msm/mdss/mdp3.c
index 638fcb3..fe8c528 100644
--- a/drivers/video/msm/mdss/mdp3.c
+++ b/drivers/video/msm/mdss/mdp3.c
@@ -1859,6 +1859,52 @@
 			mdp3_res->underrun_cnt);
 }
 
+static ssize_t mdp3_show_capabilities(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	size_t len = PAGE_SIZE;
+	int cnt = 0;
+
+#define SPRINT(fmt, ...) \
+		(cnt += scnprintf(buf + cnt, len - cnt, fmt, ##__VA_ARGS__))
+
+	SPRINT("mdp_version=3\n");
+	SPRINT("hw_rev=%d\n", 304);
+	SPRINT("dma_pipes=%d\n", 1);
+	SPRINT("\n");
+
+	return cnt;
+}
+
+static DEVICE_ATTR(caps, S_IRUGO, mdp3_show_capabilities, NULL);
+
+static struct attribute *mdp3_fs_attrs[] = {
+	&dev_attr_caps.attr,
+	NULL
+};
+
+static struct attribute_group mdp3_fs_attr_group = {
+	.attrs = mdp3_fs_attrs
+};
+
+static int mdp3_register_sysfs(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	int rc;
+
+	rc = sysfs_create_group(&dev->kobj, &mdp3_fs_attr_group);
+
+	return rc;
+}
+
+int mdp3_create_sysfs_link(struct device *dev)
+{
+	int rc;
+	rc = sysfs_create_link_nowarn(&dev->kobj,
+			&mdp3_res->pdev->dev.kobj, "mdp");
+
+	return rc;
+}
 
 static int mdp3_probe(struct platform_device *pdev)
 {
@@ -1918,6 +1964,10 @@
 		goto probe_done;
 	}
 
+	rc = mdp3_register_sysfs(pdev);
+	if (rc)
+		pr_err("unable to register mdp sysfs nodes\n");
+
 	rc = mdss_fb_register_mdp_instance(&mdp3_interface);
 	if (rc)
 		pr_err("unable to register mdp instance\n");
diff --git a/drivers/video/msm/mdss/mdp3.h b/drivers/video/msm/mdss/mdp3.h
index 4480c20..e66b5ac 100644
--- a/drivers/video/msm/mdss/mdp3.h
+++ b/drivers/video/msm/mdss/mdp3.h
@@ -186,6 +186,7 @@
 void mdp3_free(void);
 int mdp3_parse_dt_splash(struct msm_fb_data_type *mfd);
 void mdp3_release_splash_memory(void);
+int mdp3_create_sysfs_link(struct device *dev);
 
 #define MDP3_REG_WRITE(addr, val) writel_relaxed(val, mdp3_res->mdp_base + addr)
 #define MDP3_REG_READ(addr) readl_relaxed(mdp3_res->mdp_base + addr)
diff --git a/drivers/video/msm/mdss/mdp3_ctrl.c b/drivers/video/msm/mdss/mdp3_ctrl.c
index 9c909bf..994e3e0 100644
--- a/drivers/video/msm/mdss/mdp3_ctrl.c
+++ b/drivers/video/msm/mdss/mdp3_ctrl.c
@@ -1355,7 +1355,7 @@
 	int rc = -EINVAL;
 	struct mdp3_session_data *mdp3_session;
 	struct msmfb_metadata metadata;
-	struct mdp_overlay req;
+	struct mdp_overlay *req = NULL;
 	struct msmfb_overlay_data ov_data;
 	int val;
 
@@ -1363,7 +1363,9 @@
 	if (!mdp3_session)
 		return -ENODEV;
 
-	if (!mdp3_session->status) {
+	req = &mdp3_session->req_overlay;
+
+	if (!mdp3_session->status && cmd != MSMFB_METADATA_GET) {
 		pr_err("mdp3_ctrl_ioctl_handler, display off!\n");
 		return -EPERM;
 	}
@@ -1402,23 +1404,23 @@
 			rc = copy_to_user(argp, &metadata, sizeof(metadata));
 		break;
 	case MSMFB_OVERLAY_GET:
-		rc = copy_from_user(&req, argp, sizeof(req));
+		rc = copy_from_user(req, argp, sizeof(*req));
 		if (!rc) {
-			rc = mdp3_overlay_get(mfd, &req);
+			rc = mdp3_overlay_get(mfd, req);
 
 		if (!IS_ERR_VALUE(rc))
-			rc = copy_to_user(argp, &req, sizeof(req));
+			rc = copy_to_user(argp, req, sizeof(*req));
 		}
 		if (rc)
 			pr_err("OVERLAY_GET failed (%d)\n", rc);
 		break;
 	case MSMFB_OVERLAY_SET:
-		rc = copy_from_user(&req, argp, sizeof(req));
+		rc = copy_from_user(req, argp, sizeof(*req));
 		if (!rc) {
-			rc = mdp3_overlay_set(mfd, &req);
+			rc = mdp3_overlay_set(mfd, req);
 
 		if (!IS_ERR_VALUE(rc))
-			rc = copy_to_user(argp, &req, sizeof(req));
+			rc = copy_to_user(argp, req, sizeof(*req));
 		}
 		if (rc)
 			pr_err("OVERLAY_SET failed (%d)\n", rc);
@@ -1525,6 +1527,10 @@
 		goto init_done;
 	}
 
+	rc = mdp3_create_sysfs_link(dev);
+	if (rc)
+		pr_warn("problem creating link to mdp sysfs\n");
+
 	kobject_uevent(&dev->kobj, KOBJ_ADD);
 	pr_debug("vsync kobject_uevent(KOBJ_ADD)\n");
 
diff --git a/drivers/video/msm/mdss/mdp3_ctrl.h b/drivers/video/msm/mdss/mdp3_ctrl.h
index 7c4f6ac..66ed3d5 100644
--- a/drivers/video/msm/mdss/mdp3_ctrl.h
+++ b/drivers/video/msm/mdss/mdp3_ctrl.h
@@ -45,6 +45,7 @@
 	int vsync_period;
 	struct sysfs_dirent *vsync_event_sd;
 	struct mdp_overlay overlay;
+	struct mdp_overlay req_overlay;
 	struct mdp3_buffer_queue bufq_in;
 	struct mdp3_buffer_queue bufq_out;
 	int histo_status;
diff --git a/drivers/video/msm/mdss/mdp3_hwio.h b/drivers/video/msm/mdss/mdp3_hwio.h
index 4afa37c..90ee357 100644
--- a/drivers/video/msm/mdss/mdp3_hwio.h
+++ b/drivers/video/msm/mdss/mdp3_hwio.h
@@ -111,11 +111,11 @@
 #define MDP3_REG_DMA_P_DCVS_STATUS			0x90084
 
 /*DMA_S*/
-#define MDP3_REG_DMA_S_CONFIG				0x90000
-#define MDP3_REG_DMA_S_SIZE				0x90004
-#define MDP3_REG_DMA_S_IBUF_ADDR			0x90008
-#define MDP3_REG_DMA_S_IBUF_Y_STRIDE			0x9000C
-#define MDP3_REG_DMA_S_OUT_XY				0x90010
+#define MDP3_REG_DMA_S_CONFIG				0xA0000
+#define MDP3_REG_DMA_S_SIZE				0xA0004
+#define MDP3_REG_DMA_S_IBUF_ADDR			0xA0008
+#define MDP3_REG_DMA_S_IBUF_Y_STRIDE			0xA000C
+#define MDP3_REG_DMA_S_OUT_XY				0xA0010
 
 /*interface*/
 #define MDP3_REG_LCDC_EN				0xE0000
diff --git a/drivers/video/msm/mdss/mdss_dsi.c b/drivers/video/msm/mdss/mdss_dsi.c
index 865775a..927cfa9 100644
--- a/drivers/video/msm/mdss/mdss_dsi.c
+++ b/drivers/video/msm/mdss/mdss_dsi.c
@@ -1216,7 +1216,8 @@
 		}
 	}
 
-	if (gpio_is_valid(ctrl_pdata->disp_te_gpio)) {
+	if (gpio_is_valid(ctrl_pdata->disp_te_gpio) &&
+					pinfo->type == MIPI_CMD_PANEL) {
 		rc = gpio_request(ctrl_pdata->disp_te_gpio, "disp_te");
 		if (rc) {
 			pr_err("request TE gpio failed, rc=%d\n",
diff --git a/drivers/video/msm/mdss/mdss_dsi_panel.c b/drivers/video/msm/mdss/mdss_dsi_panel.c
index 9932186..890066e 100644
--- a/drivers/video/msm/mdss/mdss_dsi_panel.c
+++ b/drivers/video/msm/mdss/mdss_dsi_panel.c
@@ -293,6 +293,15 @@
 	ctrl_pdata = container_of(pdata, struct mdss_dsi_ctrl_pdata,
 				panel_data);
 
+	/*
+	 * Some backlight controllers specify a minimum duty cycle
+	 * for the backlight brightness. If the brightness is less
+	 * than it, the controller can malfunction.
+	 */
+
+	if ((bl_level < pdata->panel_info.bl_min) && (bl_level != 0))
+		bl_level = pdata->panel_info.bl_min;
+
 	switch (ctrl_pdata->bklt_ctrl) {
 	case BL_WLED:
 		led_trigger_event(bl_led_trigger, bl_level);
diff --git a/drivers/video/msm/mdss/mdss_fb.c b/drivers/video/msm/mdss/mdss_fb.c
index 105dd1a..047c0f0 100644
--- a/drivers/video/msm/mdss/mdss_fb.c
+++ b/drivers/video/msm/mdss/mdss_fb.c
@@ -616,11 +616,11 @@
 		 * scaling fraction (x/1024)
 		 */
 		temp = (temp * mfd->bl_scale) / 1024;
-	}
-	/*if less than minimum level, use min level*/
-	else if ((temp < mfd->bl_min_lvl) && (0 != temp))
-		temp = mfd->bl_min_lvl;
 
+		/*if less than minimum level, use min level*/
+		if (temp < mfd->bl_min_lvl)
+			temp = mfd->bl_min_lvl;
+	}
 	pr_debug("output = %d", temp);
 
 	(*bl_lvl) = temp;
@@ -635,11 +635,8 @@
 
 	if (((!mfd->panel_power_on && mfd->dcm_state != DCM_ENTER)
 		|| !mfd->bl_updated) && !IS_CALIB_MODE_BL(mfd)) {
-			if (bkl_lvl < mfd->bl_min_lvl)
-				mfd->unset_bl_level = mfd->bl_min_lvl;
-			else
-				mfd->unset_bl_level = bkl_lvl;
-			return;
+		mfd->unset_bl_level = bkl_lvl;
+		return;
 	} else {
 		mfd->unset_bl_level = 0;
 	}
@@ -1972,7 +1969,8 @@
 		return -EINVAL;
 	mfd = (struct msm_fb_data_type *)info->par;
 	mdss_fb_power_setting_idle(mfd);
-	if ((cmd != MSMFB_VSYNC_CTRL) && (cmd != MSMFB_OVERLAY_VSYNC_CTRL))
+	if ((cmd != MSMFB_VSYNC_CTRL) && (cmd != MSMFB_OVERLAY_VSYNC_CTRL) &&
+			(cmd != MSMFB_ASYNC_BLIT) && (cmd != MSMFB_BLIT))
 		mdss_fb_pan_idle(mfd);
 
 	switch (cmd) {
diff --git a/drivers/video/msm/mdss/mdss_hdmi_edid.c b/drivers/video/msm/mdss/mdss_hdmi_edid.c
index cf0c287..5174cab 100644
--- a/drivers/video/msm/mdss/mdss_hdmi_edid.c
+++ b/drivers/video/msm/mdss/mdss_hdmi_edid.c
@@ -16,6 +16,13 @@
 #include "mdss_hdmi_edid.h"
 
 #define DBC_START_OFFSET 4
+
+/*
+ * As per CEA-861-E specification 7.5.2, there can be
+ * upto 31 bytes following any tag (data block type).
+ */
+#define MAX_DATA_BLOCK_SIZE 31
+
 #define HDMI_VSDB_3D_EVF_DATA_OFFSET(vsd) \
 	(!((vsd)[8] & BIT(7)) ? 9 : (!((vsd)[8] & BIT(6)) ? 11 : 13))
 
@@ -32,6 +39,19 @@
 /* Support for first 5 EDID blocks */
 #define MAX_EDID_BLOCK_SIZE (0x80 * 5)
 
+#define BUFF_SIZE_3D 128
+
+enum data_block_types {
+	RESERVED,
+	AUDIO_DATA_BLOCK,
+	VIDEO_DATA_BLOCK,
+	VENDOR_SPECIFIC_DATA_BLOCK,
+	SPEAKER_ALLOCATION_DATA_BLOCK,
+	VESA_DTC_DATA_BLOCK,
+	RESERVED2,
+	USE_EXTENDED_TAG
+};
+
 struct hdmi_edid_sink_data {
 	u32 disp_mode_list[HDMI_VFRMT_MAX];
 	u32 disp_3d_mode_list[HDMI_VFRMT_MAX];
@@ -524,7 +544,8 @@
 	}
 
 	/* A Tage code of 7 identifies extended data blocks */
-	etag = hdmi_edid_find_block(in_buf, start_offset, 7, &len);
+	etag = hdmi_edid_find_block(in_buf, start_offset, USE_EXTENDED_TAG,
+		&len);
 
 	while (etag != NULL) {
 		/* The extended data block should at least be 2 bytes long */
@@ -570,7 +591,8 @@
 
 		/* There could be more that one extended data block */
 		start_offset = etag - in_buf + len + 1;
-		etag = hdmi_edid_find_block(in_buf, start_offset, 7, &len);
+		etag = hdmi_edid_find_block(in_buf, start_offset,
+			USE_EXTENDED_TAG, &len);
 	}
 } /* hdmi_edid_extract_extended_data_blocks */
 
@@ -585,11 +607,12 @@
 		return;
 	}
 
-	vsd = hdmi_edid_find_block(in_buf, DBC_START_OFFSET, 3, &len);
+	vsd = hdmi_edid_find_block(in_buf, DBC_START_OFFSET,
+		VENDOR_SPECIFIC_DATA_BLOCK, &len);
 
 	edid_ctrl->present_3d = 0;
-	if (vsd == NULL || len < 9) {
-		DEV_DBG("%s: blk-id 3 not found or not long enough\n",
+	if (vsd == NULL || len == 0 || len > MAX_DATA_BLOCK_SIZE) {
+		DEV_DBG("%s: No/Invalid vendor Specific Data Block\n",
 			__func__);
 		return;
 	}
@@ -616,9 +639,13 @@
 		return;
 	}
 
-	adb = hdmi_edid_find_block(in_buf, DBC_START_OFFSET, 1, &len);
-	if ((adb == NULL) || (len > MAX_AUDIO_DATA_BLOCK_SIZE))
+	adb = hdmi_edid_find_block(in_buf, DBC_START_OFFSET, AUDIO_DATA_BLOCK,
+		&len);
+	if ((adb == NULL) || (len > MAX_AUDIO_DATA_BLOCK_SIZE)) {
+		DEV_DBG("%s: No/Invalid Audio Data Block\n",
+			__func__);
 		return;
+	}
 
 	memcpy(edid_ctrl->audio_data_block, adb + 1, len);
 	edid_ctrl->adb_size = len;
@@ -644,9 +671,13 @@
 		return;
 	}
 
-	sadb = hdmi_edid_find_block(in_buf, DBC_START_OFFSET, 4, &len);
-	if ((sadb == NULL) || (len != MAX_SPKR_ALLOC_DATA_BLOCK_SIZE))
+	sadb = hdmi_edid_find_block(in_buf, DBC_START_OFFSET,
+		SPEAKER_ALLOCATION_DATA_BLOCK, &len);
+	if ((sadb == NULL) || (len != MAX_SPKR_ALLOC_DATA_BLOCK_SIZE)) {
+		DEV_DBG("%s: No/Invalid Speaker Allocation Data Block\n",
+			__func__);
 		return;
+	}
 
 	memcpy(edid_ctrl->spkr_alloc_data_block, sadb + 1, len);
 	edid_ctrl->sadb_size = len;
@@ -673,9 +704,11 @@
 		return;
 	}
 
-	vsd = hdmi_edid_find_block(in_buf, DBC_START_OFFSET, 3, &len);
+	vsd = hdmi_edid_find_block(in_buf, DBC_START_OFFSET,
+		VENDOR_SPECIFIC_DATA_BLOCK, &len);
 
-	if (vsd == NULL || len < 12 || !(vsd[8] & BIT(7))) {
+	if (vsd == NULL || len == 0 || len > MAX_DATA_BLOCK_SIZE ||
+		!(vsd[8] & BIT(7))) {
 		edid_ctrl->video_latency = (u16)-1;
 		edid_ctrl->audio_latency = (u16)-1;
 		DEV_DBG("%s: EDID: No audio/video latency present\n", __func__);
@@ -699,9 +732,14 @@
 		return 0;
 	}
 
-	vsd = hdmi_edid_find_block(in_buf, DBC_START_OFFSET, 3, &len);
-	if (vsd == NULL || len < 8)
+	vsd = hdmi_edid_find_block(in_buf, DBC_START_OFFSET,
+		VENDOR_SPECIFIC_DATA_BLOCK, &len);
+
+	if (vsd == NULL || len == 0 || len > MAX_DATA_BLOCK_SIZE) {
+		DEV_DBG("%s: No/Invalid Vendor Specific Data Block\n",
+			__func__);
 		return 0;
+	}
 
 	DEV_DBG("%s: EDID: VSD PhyAddr=%04x, MaxTMDS=%dMHz\n", __func__,
 		((u32)vsd[4] << 8) + (u32)vsd[5], (u32)vsd[7] * 5);
@@ -898,11 +936,14 @@
 	u16 structure_all, structure_mask;
 	const u8 *vsd = num_of_cea_blocks ?
 		hdmi_edid_find_block(data_buf+0x80, DBC_START_OFFSET,
-				3, &len) : NULL;
+			VENDOR_SPECIFIC_DATA_BLOCK, &len) : NULL;
 	int i;
 
-	if (!vsd)
+	if (vsd == NULL || len == 0 || len > MAX_DATA_BLOCK_SIZE) {
+		DEV_DBG("%s: No/Invalid Vendor Specific Data Block\n",
+			__func__);
 		return -ENXIO;
+	}
 
 	offset = HDMI_VSDB_3D_EVF_DATA_OFFSET(vsd);
 	if (offset >= len - 1)
@@ -1044,10 +1085,11 @@
 		return;
 	}
 
-	vsd = hdmi_edid_find_block(in_buf, DBC_START_OFFSET, 3, &db_len);
+	vsd = hdmi_edid_find_block(in_buf, DBC_START_OFFSET,
+		VENDOR_SPECIFIC_DATA_BLOCK, &db_len);
 
-	if (vsd == NULL || db_len < 9) {
-		DEV_DBG("%s: blk-id 3 not found or not long enough\n",
+	if (vsd == NULL || db_len == 0 || db_len > MAX_DATA_BLOCK_SIZE) {
+		DEV_DBG("%s: No/Invalid Vendor Specific Data Block\n",
 			__func__);
 		return;
 	}
@@ -1097,8 +1139,14 @@
 	edid_blk0 = &data_buf[0x0];
 	edid_blk1 = &data_buf[0x80];
 	svd = num_of_cea_blocks ?
-		hdmi_edid_find_block(data_buf+0x80, DBC_START_OFFSET, 2,
-			&len) : NULL;
+		hdmi_edid_find_block(data_buf+0x80, DBC_START_OFFSET,
+			VIDEO_DATA_BLOCK, &len) : NULL;
+
+	if (svd == NULL || len == 0 || len > MAX_DATA_BLOCK_SIZE) {
+		DEV_DBG("%s: No/Invalid Video Data Block\n",
+			__func__);
+		return;
+	}
 
 	sink_data = &edid_ctrl->sink_data;
 
diff --git a/drivers/video/msm/mdss/mdss_hdmi_hdcp.c b/drivers/video/msm/mdss/mdss_hdmi_hdcp.c
index 80b27ed..ca21b51 100644
--- a/drivers/video/msm/mdss/mdss_hdmi_hdcp.c
+++ b/drivers/video/msm/mdss/mdss_hdmi_hdcp.c
@@ -289,6 +289,10 @@
 	}
 	DEV_DBG("%s: %s: BCAPS=%02x\n", __func__, HDCP_STATE_NAME, bcaps);
 
+	/* receiver (0), repeater (1) */
+	hdcp_ctrl->current_tp.ds_type =
+		(bcaps & BIT(6)) >> 6 ? DS_REPEATER : DS_RECEIVER;
+
 	/*
 	 * HDCP setup prior to enabling HDCP_CTRL.
 	 * Setup seed values for random number An.
@@ -644,40 +648,12 @@
 	memset(ksv_fifo, 0,
 		sizeof(hdcp_ctrl->current_tp.ksv_list));
 
-	/* Read BCAPS at offset 0x40 */
-	memset(&ddc_data, 0, sizeof(ddc_data));
-	ddc_data.dev_addr = 0x74;
-	ddc_data.offset = 0x40;
-	ddc_data.data_buf = &bcaps;
-	ddc_data.data_len = 1;
-	ddc_data.request_len = 1;
-	ddc_data.retry = 5;
-	ddc_data.what = "Bcaps";
-	ddc_data.no_align = false;
-	rc = hdmi_ddc_read(hdcp_ctrl->init_data.ddc_ctrl, &ddc_data);
-	if (rc) {
-		DEV_ERR("%s: %s: BCAPS read failed\n", __func__,
-			HDCP_STATE_NAME);
-		goto error;
-	}
-	DEV_DBG("%s: %s: BCAPS=%02x (%s)\n", __func__, HDCP_STATE_NAME, bcaps,
-		(bcaps & BIT(6)) ? "repeater" : "no repeater");
-
-	/* receiver (0), repeater (1) */
-	hdcp_ctrl->current_tp.ds_type =
-		(bcaps & BIT(6)) >> 6 ? DS_REPEATER : DS_RECEIVER;
-
-	/* if REPEATER (Bit 6), perform Part2 Authentication */
-	if (!(bcaps & BIT(6))) {
-		DEV_INFO("%s: %s: auth part II skipped, no repeater\n",
-			__func__, HDCP_STATE_NAME);
-		return 0;
-	}
-
-	/* Wait until READY bit is set in BCAPS */
+	/*
+	 * Wait until READY bit is set in BCAPS, as per HDCP specifications
+	 * maximum permitted time to check for READY bit is five seconds.
+	 */
 	timeout_count = 50;
-	while (!(bcaps & BIT(5)) && timeout_count) {
-		msleep(100);
+	do {
 		timeout_count--;
 		/* Read BCAPS at offset 0x40 */
 		memset(&ddc_data, 0, sizeof(ddc_data));
@@ -695,7 +671,8 @@
 				HDCP_STATE_NAME);
 			goto error;
 		}
-	}
+		msleep(100);
+	} while (!(bcaps & BIT(5)) && timeout_count);
 
 	/* Read BSTATUS at offset 0x41 */
 	memset(&ddc_data, 0, sizeof(ddc_data));
@@ -976,11 +953,15 @@
 		goto error;
 	}
 
-	rc = hdmi_hdcp_authentication_part2(hdcp_ctrl);
-	if (rc) {
-		DEV_DBG("%s: %s: HDCP Auth Part II failed\n", __func__,
-			HDCP_STATE_NAME);
-		goto error;
+	if (hdcp_ctrl->current_tp.ds_type == DS_REPEATER) {
+		rc = hdmi_hdcp_authentication_part2(hdcp_ctrl);
+		if (rc) {
+			DEV_DBG("%s: %s: HDCP Auth Part II failed\n", __func__,
+				HDCP_STATE_NAME);
+			goto error;
+		}
+	} else {
+		DEV_INFO("%s: Downstream device is not a repeater\n", __func__);
 	}
 	/* Disabling software DDC before going into part3 to make sure
 	 * there is no Arbitration between software and hardware for DDC */
diff --git a/drivers/video/msm/mdss/mdss_hdmi_tx.c b/drivers/video/msm/mdss/mdss_hdmi_tx.c
index e46e361..abb72ad 100644
--- a/drivers/video/msm/mdss/mdss_hdmi_tx.c
+++ b/drivers/video/msm/mdss/mdss_hdmi_tx.c
@@ -2456,6 +2456,10 @@
 	mutex_unlock(&hdmi_ctrl->mutex);
 
 	DEV_INFO("%s: HDMI Core: OFF\n", __func__);
+
+	if (hdmi_ctrl->hdmi_tx_hpd_done)
+		hdmi_ctrl->hdmi_tx_hpd_done(
+			hdmi_ctrl->downstream_data);
 } /* hdmi_tx_power_off_work */
 
 static int hdmi_tx_power_off(struct mdss_panel_data *panel_data)
@@ -2558,6 +2562,9 @@
 
 	hdmi_tx_hpd_polarity_setup(hdmi_ctrl, HPD_DISCONNECT_POLARITY);
 
+	if (hdmi_ctrl->hdmi_tx_hpd_done)
+		hdmi_ctrl->hdmi_tx_hpd_done(hdmi_ctrl->downstream_data);
+
 	return 0;
 } /* hdmi_tx_power_on */
 
diff --git a/drivers/video/msm/mdss/mdss_hdmi_tx.h b/drivers/video/msm/mdss/mdss_hdmi_tx.h
index fd95582..c4d0326 100644
--- a/drivers/video/msm/mdss/mdss_hdmi_tx.h
+++ b/drivers/video/msm/mdss/mdss_hdmi_tx.h
@@ -84,6 +84,9 @@
 
 	struct hdmi_tx_ddc_ctrl ddc_ctrl;
 
+	void (*hdmi_tx_hpd_done) (void *data);
+	void *downstream_data;
+
 	void *feature_data[HDMI_TX_FEAT_MAX];
 };
 
diff --git a/drivers/video/msm/mdss/mdss_mdp.h b/drivers/video/msm/mdss/mdss_mdp.h
index d8dc6ca..a9667a4 100644
--- a/drivers/video/msm/mdss/mdss_mdp.h
+++ b/drivers/video/msm/mdss/mdss_mdp.h
@@ -374,7 +374,6 @@
 
 struct mdss_mdp_writeback_arg {
 	struct mdss_mdp_data *data;
-	void (*callback_fnc) (void *arg);
 	void *priv_data;
 };
 
diff --git a/drivers/video/msm/mdss/mdss_mdp_ctl.c b/drivers/video/msm/mdss/mdss_mdp_ctl.c
index 82937e3..aa7c4dd 100644
--- a/drivers/video/msm/mdss/mdss_mdp_ctl.c
+++ b/drivers/video/msm/mdss/mdss_mdp_ctl.c
@@ -28,7 +28,7 @@
 #define MDSS_MDP_BUS_FUDGE_FACTOR_IB(val) (((val) / 2) * 3)
 #define MDSS_MDP_BUS_FUDGE_FACTOR_HIGH_IB(val) (val << 1)
 #define MDSS_MDP_BUS_FUDGE_FACTOR_AB(val) (val << 1)
-#define MDSS_MDP_BUS_FLOOR_BW (3200000000ULL >> MDSS_MDP_BUS_FACTOR_SHIFT)
+#define MDSS_MDP_BUS_FLOOR_BW (1600000000ULL >> MDSS_MDP_BUS_FACTOR_SHIFT)
 
 /* 1.25 clock fudge factor */
 #define MDSS_MDP_CLK_FUDGE_FACTOR(val) (((val) * 5) / 4)
@@ -1560,9 +1560,17 @@
 struct mdss_mdp_mixer *mdss_mdp_mixer_get(struct mdss_mdp_ctl *ctl, int mux)
 {
 	struct mdss_mdp_mixer *mixer = NULL;
-	struct mdss_overlay_private *mdp5_data = mfd_to_mdp5_data(ctl->mfd);
-	if (!ctl)
+	struct mdss_overlay_private *mdp5_data = NULL;
+	if (!ctl || !ctl->mfd) {
+		pr_err("ctl not initialized\n");
 		return NULL;
+	}
+
+	mdp5_data = mfd_to_mdp5_data(ctl->mfd);
+	if (!mdp5_data) {
+		pr_err("ctl not initialized\n");
+		return NULL;
+	}
 
 	switch (mux) {
 	case MDSS_MDP_MIXER_MUX_DEFAULT:
diff --git a/drivers/video/msm/mdss/mdss_mdp_intf_video.c b/drivers/video/msm/mdss/mdss_mdp_intf_video.c
index 7c79ceb..bd1c3eb 100644
--- a/drivers/video/msm/mdss/mdss_mdp_intf_video.c
+++ b/drivers/video/msm/mdss/mdss_mdp_intf_video.c
@@ -294,6 +294,7 @@
 	struct mdss_mdp_video_ctx *ctx;
 	struct mdss_mdp_vsync_handler *tmp, *handle;
 	int rc;
+	u32 frame_rate = 0;
 
 	pr_debug("stop ctl=%d\n", ctl->num);
 
@@ -313,6 +314,14 @@
 		WARN(rc, "intf %d blank error (%d)\n", ctl->intf_num, rc);
 
 		mdp_video_write(ctx, MDSS_MDP_REG_INTF_TIMING_ENGINE_EN, 0);
+		/* wait for at least one VSYNC on HDMI intf for proper TG OFF */
+		if (MDSS_INTF_HDMI == ctx->intf_type) {
+			frame_rate = mdss_panel_get_framerate
+					(&(ctl->panel_data->panel_info));
+			if (!(frame_rate >= 24 && frame_rate <= 240))
+				frame_rate = 24;
+			msleep((1000/frame_rate) + 1);
+		}
 		mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF, false);
 		ctx->timegen_en = false;
 
@@ -429,10 +438,9 @@
 		} else {
 			rc = 0;
 		}
-
-		mdss_mdp_ctl_notify(ctl,
-			rc ? MDP_NOTIFY_FRAME_TIMEOUT : MDP_NOTIFY_FRAME_DONE);
 	}
+	mdss_mdp_ctl_notify(ctl,
+			rc ? MDP_NOTIFY_FRAME_TIMEOUT : MDP_NOTIFY_FRAME_DONE);
 
 	if (ctx->wait_pending) {
 		ctx->wait_pending = 0;
diff --git a/drivers/video/msm/mdss/mdss_mdp_intf_writeback.c b/drivers/video/msm/mdss/mdss_mdp_intf_writeback.c
index 3929501..ff55c57 100644
--- a/drivers/video/msm/mdss/mdss_mdp_intf_writeback.c
+++ b/drivers/video/msm/mdss/mdss_mdp_intf_writeback.c
@@ -46,8 +46,6 @@
 
 	struct mdss_mdp_plane_sizes dst_planes;
 
-	void (*callback_fnc) (void *arg);
-	void *callback_arg;
 	spinlock_t wb_lock;
 	struct list_head vsync_handlers;
 };
@@ -365,6 +363,8 @@
 		mdss_mdp_set_intr_callback(ctx->intr_type, ctx->intf_num,
 				NULL, NULL);
 
+		complete_all(&ctx->wb_comp);
+
 		ctl->priv_data = NULL;
 		ctx->ref_cnt--;
 	}
@@ -389,9 +389,6 @@
 
 	mdss_mdp_irq_disable_nosync(ctx->intr_type, ctx->intf_num);
 
-	if (ctx->callback_fnc)
-		ctx->callback_fnc(ctx->callback_arg);
-
 	spin_lock(&ctx->wb_lock);
 	list_for_each_entry(tmp, &ctx->vsync_handlers, list) {
 		tmp->vsync_handler(ctl, vsync_time);
@@ -467,9 +464,6 @@
 	mdss_mdp_set_intr_callback(ctx->intr_type, ctx->intf_num,
 		   mdss_mdp_writeback_intr_done, ctl);
 
-	ctx->callback_fnc = wb_args->callback_fnc;
-	ctx->callback_arg = wb_args->priv_data;
-
 	flush_bits = BIT(16); /* WB */
 	mdp_wb_write(ctx, MDSS_MDP_REG_WB_DST_ADDR_SW_STATUS, ctl->is_secure);
 	mdss_mdp_ctl_write(ctl, MDSS_MDP_REG_CTL_FLUSH, flush_bits);
@@ -529,6 +523,8 @@
 
 int mdss_mdp_writeback_display_commit(struct mdss_mdp_ctl *ctl, void *arg)
 {
+	int ret = 0;
+
 	if (ctl->shared_lock && !mutex_is_locked(ctl->shared_lock)) {
 		pr_err("shared mutex is not locked before commit on ctl=%d\n",
 			ctl->num);
@@ -542,5 +538,10 @@
 			ctl->mixer_right->params_changed++;
 	}
 
-	return mdss_mdp_display_commit(ctl, arg);
+	ret = mdss_mdp_display_commit(ctl, arg);
+
+	if (!IS_ERR_VALUE(ret))
+		mdss_mdp_display_wait4comp(ctl);
+
+	return ret;
 }
diff --git a/drivers/video/msm/mdss/mdss_mdp_rotator.c b/drivers/video/msm/mdss/mdss_mdp_rotator.c
index 1d172f3..057914b 100644
--- a/drivers/video/msm/mdss/mdss_mdp_rotator.c
+++ b/drivers/video/msm/mdss/mdss_mdp_rotator.c
@@ -137,7 +137,6 @@
 {
 	int ret;
 	struct mdss_mdp_writeback_arg wb_args = {
-		.callback_fnc = NULL,
 		.data = dst_data,
 		.priv_data = rot,
 	};
diff --git a/drivers/video/msm/mdss/mdss_mdp_wb.c b/drivers/video/msm/mdss/mdss_mdp_wb.c
index 58acb8e..c4e1956 100644
--- a/drivers/video/msm/mdss/mdss_mdp_wb.c
+++ b/drivers/video/msm/mdss/mdss_mdp_wb.c
@@ -476,23 +476,13 @@
 	return ret;
 }
 
-static void mdss_mdp_wb_callback(void *arg)
-{
-	if (arg)
-		complete((struct completion *) arg);
-}
-
 int mdss_mdp_wb_kickoff(struct msm_fb_data_type *mfd)
 {
 	struct mdss_mdp_wb *wb = mfd_to_wb(mfd);
 	struct mdss_mdp_ctl *ctl = mfd_to_ctl(mfd);
 	struct mdss_mdp_wb_data *node = NULL;
 	int ret = 0;
-	DECLARE_COMPLETION_ONSTACK(comp);
-	struct mdss_mdp_writeback_arg wb_args = {
-		.callback_fnc = mdss_mdp_wb_callback,
-		.priv_data = &comp,
-	};
+	struct mdss_mdp_writeback_arg wb_args;
 
 	if (!ctl->power_on)
 		return 0;
@@ -534,12 +524,6 @@
 		goto kickoff_fail;
 	}
 
-	ret = wait_for_completion_timeout(&comp, KOFF_TIMEOUT);
-	if (ret == 0)
-		WARN(1, "wfd kick off time out=%d ctl=%d", ret, ctl->num);
-	else
-		ret = 0;
-
 	if (wb && node) {
 		mutex_lock(&wb->lock);
 		list_add_tail(&node->active_entry, &wb->busy_queue);
diff --git a/drivers/video/msm/mdss/mhl_sii8334.c b/drivers/video/msm/mdss/mhl_sii8334.c
index a759e86..ab01566 100644
--- a/drivers/video/msm/mdss/mhl_sii8334.c
+++ b/drivers/video/msm/mdss/mhl_sii8334.c
@@ -1463,7 +1463,7 @@
 	static struct regulator *reg_8941_l02;
 	static struct regulator *reg_8941_smps3a;
 	static struct regulator *reg_8941_vdda;
-	int rc;
+	int rc = -EINVAL;
 
 	pr_debug("%s\n", __func__);
 	if (!reg_8941_l24) {
diff --git a/include/linux/diagchar.h b/include/linux/diagchar.h
index 0739ece..d525e84 100644
--- a/include/linux/diagchar.h
+++ b/include/linux/diagchar.h
@@ -726,25 +726,27 @@
 };
 
 /* LOG CODES */
+static const uint32_t log_code_last_tbl[] = {
+	0x0,	/* EQUIP ID 0 */
+	0x182F,	/* EQUIP ID 1 */
+	0x0,	/* EQUIP ID 2 */
+	0x0,	/* EQUIP ID 3 */
+	0x4910,	/* EQUIP ID 4 */
+	0x5420,	/* EQUIP ID 5 */
+	0x0,	/* EQUIP ID 6 */
+	0x74FF,	/* EQUIP ID 7 */
+	0x0,	/* EQUIP ID 8 */
+	0x0,	/* EQUIP ID 9 */
+	0xA38A,	/* EQUIP ID 10 */
+	0xB201,	/* EQUIP ID 11 */
+	0x0,	/* EQUIP ID 12 */
+	0x0,	/* EQUIP ID 13 */
+	0x0,	/* EQUIP ID 14 */
+	0x0,	/* EQUIP ID 15 */
+};
 
-#define LOG_0	0x0
-#define LOG_1	0x1808
-#define LOG_2	0x0
-#define LOG_3	0x0
-#define LOG_4	0x4910
-#define LOG_5	0x5420
-#define LOG_6	0x0
-#define LOG_7	0x74FF
-#define LOG_8	0x0
-#define LOG_9	0x0
-#define LOG_10	0xA38A
-#define LOG_11	0xB201
-#define LOG_12	0x0
-#define LOG_13	0x0
-#define LOG_14	0x0
-#define LOG_15	0x0
-
-#define LOG_GET_ITEM_NUM(xx_code) (xx_code & 0x0FFF)
-#define LOG_GET_EQUIP_ID(xx_code) ((xx_code & 0xF000) >> 12)
+#define LOG_GET_ITEM_NUM(xx_code)	(xx_code & 0x0FFF)
+#define LOG_GET_EQUIP_ID(xx_code)	((xx_code & 0xF000) >> 12)
+#define LOG_ITEMS_TO_SIZE(num_items)	((num_items+7)/8)
 
 #endif
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a5fa304..2218ac4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -806,6 +806,17 @@
 	return (void *)((unsigned long)page->mapping & ~PAGE_MAPPING_FLAGS);
 }
 
+extern struct address_space *__page_file_mapping(struct page *);
+
+static inline
+struct address_space *page_file_mapping(struct page *page)
+{
+	if (unlikely(PageSwapCache(page)))
+		return __page_file_mapping(page);
+
+	return page->mapping;
+}
+
 static inline int PageAnon(struct page *page)
 {
 	return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
@@ -822,6 +833,20 @@
 	return page->index;
 }
 
+extern pgoff_t __page_file_index(struct page *page);
+
+/*
+ * Return the file index of the page. Regular pagecache pages use ->index
+ * whereas swapcache pages use swp_offset(->private)
+ */
+static inline pgoff_t page_file_index(struct page *page)
+{
+	if (unlikely(PageSwapCache(page)))
+		return __page_file_index(page);
+
+	return page->index;
+}
+
 /*
  * Return true if this page is mapped into pagetables.
  */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index d0ad3e4..1bcfd28 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -219,6 +219,7 @@
 	MMC_BLK_NEW_REQUEST,
 	MMC_BLK_URGENT,
 	MMC_BLK_URGENT_DONE,
+	MMC_BLK_NO_REQ_TO_STOP,
 };
 
 struct mmc_wr_pack_stats {
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 0844dc3..696ca39 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -295,6 +295,11 @@
 	return ((loff_t)page->index) << PAGE_CACHE_SHIFT;
 }
 
+static inline loff_t page_file_offset(struct page *page)
+{
+	return ((loff_t)page_file_index(page)) << PAGE_CACHE_SHIFT;
+}
+
 extern pgoff_t linear_hugepage_index(struct vm_area_struct *vma,
 				     unsigned long address);
 
diff --git a/include/linux/swap.h b/include/linux/swap.h
index a67c48a..c1fcf34 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -372,6 +372,8 @@
 extern unsigned int count_swap_pages(int, int);
 extern sector_t map_swap_page(struct page *, struct block_device **);
 extern sector_t swapdev_block(int, pgoff_t);
+extern int page_swapcount(struct page *);
+extern struct swap_info_struct *page_swap_info(struct page *);
 extern int reuse_swap_page(struct page *);
 extern int try_to_free_swap(struct page *);
 struct backing_dev_info;
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index fed2e0a..4a606af 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -442,6 +442,11 @@
 	snd_soc_dapm_siggen,		/* signal generator */
 };
 
+enum snd_soc_dapm_subclass {
+	SND_SOC_DAPM_CLASS_INIT	= 0,
+	SND_SOC_DAPM_CLASS_PCM	= 1,
+};
+
 /*
  * DAPM audio route definition.
  *
diff --git a/mm/page_io.c b/mm/page_io.c
index dc76b4d..e60e43f 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -1,3 +1,4 @@
+
 /*
  *  linux/mm/page_io.c
  *
@@ -18,6 +19,7 @@
 #include <linux/bio.h>
 #include <linux/swapops.h>
 #include <linux/writeback.h>
+#include <linux/blkdev.h>
 #include <asm/pgtable.h>
 
 static struct bio *get_swap_bio(gfp_t gfp_flags,
@@ -78,9 +80,54 @@
 				imajor(bio->bi_bdev->bd_inode),
 				iminor(bio->bi_bdev->bd_inode),
 				(unsigned long long)bio->bi_sector);
-	} else {
-		SetPageUptodate(page);
+		goto out;
 	}
+
+	SetPageUptodate(page);
+
+	/*
+	 * There is no guarantee that the page is in swap cache - the software
+	 * suspend code (at least) uses end_swap_bio_read() against a non-
+	 * swapcache page.  So we must check PG_swapcache before proceeding with
+	 * this optimization.
+	 */
+	if (likely(PageSwapCache(page))) {
+		struct swap_info_struct *sis;
+
+		sis = page_swap_info(page);
+		if (sis->flags & SWP_BLKDEV) {
+			/*
+			 * The swap subsystem performs lazy swap slot freeing,
+			 * expecting that the page will be swapped out again.
+			 * So we can avoid an unnecessary write if the page
+			 * isn't redirtied.
+			 * This is good for real swap storage because we can
+			 * reduce unnecessary I/O and enhance wear-leveling
+			 * if an SSD is used as the as swap device.
+			 * But if in-memory swap device (eg zram) is used,
+			 * this causes a duplicated copy between uncompressed
+			 * data in VM-owned memory and compressed data in
+			 * zram-owned memory.  So let's free zram-owned memory
+			 * and make the VM-owned decompressed page *dirty*,
+			 * so the page should be swapped out somewhere again if
+			 * we again wish to reclaim it.
+			 */
+			struct gendisk *disk = sis->bdev->bd_disk;
+			if (disk->fops->swap_slot_free_notify) {
+				swp_entry_t entry;
+				unsigned long offset;
+
+				entry.val = page_private(page);
+				offset = swp_offset(entry);
+
+				SetPageDirty(page);
+				disk->fops->swap_slot_free_notify(sis->bdev,
+						offset);
+			}
+		}
+	}
+
+out:
 	unlock_page(page);
 	bio_put(bio);
 }
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 5f62c5f..9ae4c8d 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -31,6 +31,7 @@
 #include <linux/memcontrol.h>
 #include <linux/poll.h>
 #include <linux/oom.h>
+#include <linux/export.h>
 
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
@@ -650,7 +651,7 @@
  * This does not give an exact answer when swap count is continued,
  * but does include the high COUNT_CONTINUED flag to allow for that.
  */
-static inline int page_swapcount(struct page *page)
+int page_swapcount(struct page *page)
 {
 	int count = 0;
 	struct swap_info_struct *p;
@@ -2350,6 +2351,31 @@
 	return __swap_duplicate(entry, SWAP_HAS_CACHE);
 }
 
+struct swap_info_struct *page_swap_info(struct page *page)
+{
+	swp_entry_t swap = { .val = page_private(page) };
+	BUG_ON(!PageSwapCache(page));
+	return swap_info[swp_type(swap)];
+}
+
+/*
+ * out-of-line __page_file_ methods to avoid include hell.
+ */
+struct address_space *__page_file_mapping(struct page *page)
+{
+	VM_BUG_ON(!PageSwapCache(page));
+	return page_swap_info(page)->swap_file->f_mapping;
+}
+EXPORT_SYMBOL_GPL(__page_file_mapping);
+
+pgoff_t __page_file_index(struct page *page)
+{
+	swp_entry_t swap = { .val = page_private(page) };
+	VM_BUG_ON(!PageSwapCache(page));
+	return swp_offset(swap);
+}
+EXPORT_SYMBOL_GPL(__page_file_index);
+
 /*
  * add_swap_count_continuation - called when a swap count is duplicated
  * beyond SWAP_MAP_MAX, it allocates a new page and links that to the entry's
diff --git a/sound/soc/codecs/wcd9306.c b/sound/soc/codecs/wcd9306.c
index da99254..aaa132e 100644
--- a/sound/soc/codecs/wcd9306.c
+++ b/sound/soc/codecs/wcd9306.c
@@ -3154,13 +3154,27 @@
 		struct snd_soc_dai *dai)
 {
 	struct wcd9xxx *tapan_core = dev_get_drvdata(dai->codec->dev->parent);
+	struct tapan_priv *tapan = snd_soc_codec_get_drvdata(dai->codec);
+	u32 active = 0;
+
 	dev_dbg(dai->codec->dev, "%s(): substream = %s  stream = %d\n",
 		 __func__, substream->name, substream->stream);
+
+	if (dai->id <= NUM_CODEC_DAIS) {
+		if (tapan->dai[dai->id].ch_mask) {
+			active = 1;
+			dev_dbg(dai->codec->dev, "%s(): Codec DAI: chmask[%d] = 0x%lx\n",
+				 __func__, dai->id,
+				 tapan->dai[dai->id].ch_mask);
+		}
+	}
 	if ((tapan_core != NULL) &&
 	    (tapan_core->dev != NULL) &&
-	    (tapan_core->dev->parent != NULL)) {
+	    (tapan_core->dev->parent != NULL) &&
+	    (active == 0)) {
 		pm_runtime_mark_last_busy(tapan_core->dev->parent);
 		pm_runtime_put(tapan_core->dev->parent);
+		dev_dbg(dai->codec->dev, "%s: unvote requested", __func__);
 	}
 }
 
@@ -3920,6 +3934,13 @@
 			dev_dbg(codec->dev, "%s: Disconnect RX port, ret = %d\n",
 				 __func__, ret);
 		}
+		if ((core != NULL) &&
+		    (core->dev != NULL) &&
+		    (core->dev->parent != NULL)) {
+			pm_runtime_mark_last_busy(core->dev->parent);
+			pm_runtime_put(core->dev->parent);
+			dev_dbg(codec->dev, "%s: unvote requested", __func__);
+		}
 		break;
 	}
 	return ret;
@@ -3967,6 +3988,13 @@
 			dev_dbg(codec->dev, "%s: Disconnect RX port, ret = %d\n",
 				 __func__, ret);
 		}
+		if ((core != NULL) &&
+		    (core->dev != NULL) &&
+		    (core->dev->parent != NULL)) {
+			pm_runtime_mark_last_busy(core->dev->parent);
+			pm_runtime_put(core->dev->parent);
+			dev_dbg(codec->dev, "%s: unvote requested", __func__);
+		}
 		break;
 	}
 	return ret;
diff --git a/sound/soc/codecs/wcd9310.c b/sound/soc/codecs/wcd9310.c
index 673b634..725c51f 100644
--- a/sound/soc/codecs/wcd9310.c
+++ b/sound/soc/codecs/wcd9310.c
@@ -1235,49 +1235,49 @@
 	SOC_SINGLE_TLV("HPHR Volume", TABLA_A_RX_HPH_R_GAIN, 0, 12, 1,
 		line_gain),
 
-	SOC_SINGLE_S8_TLV("RX1 Digital Volume", TABLA_A_CDC_RX1_VOL_CTL_B2_CTL,
-		-84, 40, digital_gain),
-	SOC_SINGLE_S8_TLV("RX2 Digital Volume", TABLA_A_CDC_RX2_VOL_CTL_B2_CTL,
-		-84, 40, digital_gain),
-	SOC_SINGLE_S8_TLV("RX3 Digital Volume", TABLA_A_CDC_RX3_VOL_CTL_B2_CTL,
-		-84, 40, digital_gain),
-	SOC_SINGLE_S8_TLV("RX4 Digital Volume", TABLA_A_CDC_RX4_VOL_CTL_B2_CTL,
-		-84, 40, digital_gain),
-	SOC_SINGLE_S8_TLV("RX5 Digital Volume", TABLA_A_CDC_RX5_VOL_CTL_B2_CTL,
-		-84, 40, digital_gain),
-	SOC_SINGLE_S8_TLV("RX6 Digital Volume", TABLA_A_CDC_RX6_VOL_CTL_B2_CTL,
-		-84, 40, digital_gain),
-	SOC_SINGLE_S8_TLV("RX7 Digital Volume", TABLA_A_CDC_RX7_VOL_CTL_B2_CTL,
-		-84, 40, digital_gain),
+	SOC_SINGLE_SX_TLV("RX1 Digital Volume", TABLA_A_CDC_RX1_VOL_CTL_B2_CTL,
+		0, -84, 40, digital_gain),
+	SOC_SINGLE_SX_TLV("RX2 Digital Volume", TABLA_A_CDC_RX2_VOL_CTL_B2_CTL,
+		0, -84, 40, digital_gain),
+	SOC_SINGLE_SX_TLV("RX3 Digital Volume", TABLA_A_CDC_RX3_VOL_CTL_B2_CTL,
+		0, -84, 40, digital_gain),
+	SOC_SINGLE_SX_TLV("RX4 Digital Volume", TABLA_A_CDC_RX4_VOL_CTL_B2_CTL,
+		0, -84, 40, digital_gain),
+	SOC_SINGLE_SX_TLV("RX5 Digital Volume", TABLA_A_CDC_RX5_VOL_CTL_B2_CTL,
+		0, -84, 40, digital_gain),
+	SOC_SINGLE_SX_TLV("RX6 Digital Volume", TABLA_A_CDC_RX6_VOL_CTL_B2_CTL,
+		0, -84, 40, digital_gain),
+	SOC_SINGLE_SX_TLV("RX7 Digital Volume", TABLA_A_CDC_RX7_VOL_CTL_B2_CTL,
+		0, -84, 40, digital_gain),
 
-	SOC_SINGLE_S8_TLV("DEC1 Volume", TABLA_A_CDC_TX1_VOL_CTL_GAIN, -84, 40,
-		digital_gain),
-	SOC_SINGLE_S8_TLV("DEC2 Volume", TABLA_A_CDC_TX2_VOL_CTL_GAIN, -84, 40,
-		digital_gain),
-	SOC_SINGLE_S8_TLV("DEC3 Volume", TABLA_A_CDC_TX3_VOL_CTL_GAIN, -84, 40,
-		digital_gain),
-	SOC_SINGLE_S8_TLV("DEC4 Volume", TABLA_A_CDC_TX4_VOL_CTL_GAIN, -84, 40,
-		digital_gain),
-	SOC_SINGLE_S8_TLV("DEC5 Volume", TABLA_A_CDC_TX5_VOL_CTL_GAIN, -84, 40,
-		digital_gain),
-	SOC_SINGLE_S8_TLV("DEC6 Volume", TABLA_A_CDC_TX6_VOL_CTL_GAIN, -84, 40,
-		digital_gain),
-	SOC_SINGLE_S8_TLV("DEC7 Volume", TABLA_A_CDC_TX7_VOL_CTL_GAIN, -84, 40,
-		digital_gain),
-	SOC_SINGLE_S8_TLV("DEC8 Volume", TABLA_A_CDC_TX8_VOL_CTL_GAIN, -84, 40,
-		digital_gain),
-	SOC_SINGLE_S8_TLV("DEC9 Volume", TABLA_A_CDC_TX9_VOL_CTL_GAIN, -84, 40,
-		digital_gain),
-	SOC_SINGLE_S8_TLV("DEC10 Volume", TABLA_A_CDC_TX10_VOL_CTL_GAIN, -84,
+	SOC_SINGLE_SX_TLV("DEC1 Volume", TABLA_A_CDC_TX1_VOL_CTL_GAIN, 0, -84,
 		40, digital_gain),
-	SOC_SINGLE_S8_TLV("IIR1 INP1 Volume", TABLA_A_CDC_IIR1_GAIN_B1_CTL, -84,
+	SOC_SINGLE_SX_TLV("DEC2 Volume", TABLA_A_CDC_TX2_VOL_CTL_GAIN, 0, -84,
 		40, digital_gain),
-	SOC_SINGLE_S8_TLV("IIR1 INP2 Volume", TABLA_A_CDC_IIR1_GAIN_B2_CTL, -84,
+	SOC_SINGLE_SX_TLV("DEC3 Volume", TABLA_A_CDC_TX3_VOL_CTL_GAIN, 0, -84,
 		40, digital_gain),
-	SOC_SINGLE_S8_TLV("IIR1 INP3 Volume", TABLA_A_CDC_IIR1_GAIN_B3_CTL, -84,
+	SOC_SINGLE_SX_TLV("DEC4 Volume", TABLA_A_CDC_TX4_VOL_CTL_GAIN, 0, -84,
 		40, digital_gain),
-	SOC_SINGLE_S8_TLV("IIR1 INP4 Volume", TABLA_A_CDC_IIR1_GAIN_B4_CTL, -84,
+	SOC_SINGLE_SX_TLV("DEC5 Volume", TABLA_A_CDC_TX5_VOL_CTL_GAIN, 0, -84,
 		40, digital_gain),
+	SOC_SINGLE_SX_TLV("DEC6 Volume", TABLA_A_CDC_TX6_VOL_CTL_GAIN, 0, -84,
+		40, digital_gain),
+	SOC_SINGLE_SX_TLV("DEC7 Volume", TABLA_A_CDC_TX7_VOL_CTL_GAIN, 0, -84,
+		40, digital_gain),
+	SOC_SINGLE_SX_TLV("DEC8 Volume", TABLA_A_CDC_TX8_VOL_CTL_GAIN, 0, -84,
+		40, digital_gain),
+	SOC_SINGLE_SX_TLV("DEC9 Volume", TABLA_A_CDC_TX9_VOL_CTL_GAIN, 0, -84,
+		40, digital_gain),
+	SOC_SINGLE_SX_TLV("DEC10 Volume", TABLA_A_CDC_TX10_VOL_CTL_GAIN, 0,
+		-84, 40, digital_gain),
+	SOC_SINGLE_SX_TLV("IIR1 INP1 Volume", TABLA_A_CDC_IIR1_GAIN_B1_CTL, 0,
+		-84, 40, digital_gain),
+	SOC_SINGLE_SX_TLV("IIR1 INP2 Volume", TABLA_A_CDC_IIR1_GAIN_B2_CTL, 0,
+		-84, 40, digital_gain),
+	SOC_SINGLE_SX_TLV("IIR1 INP3 Volume", TABLA_A_CDC_IIR1_GAIN_B3_CTL, 0,
+		-84, 40, digital_gain),
+	SOC_SINGLE_SX_TLV("IIR1 INP4 Volume", TABLA_A_CDC_IIR1_GAIN_B4_CTL, 0,
+		-84, 40, digital_gain),
 	SOC_SINGLE_TLV("ADC1 Volume", TABLA_A_TX_1_2_EN, 5, 3, 0, analog_gain),
 	SOC_SINGLE_TLV("ADC2 Volume", TABLA_A_TX_1_2_EN, 1, 3, 0, analog_gain),
 	SOC_SINGLE_TLV("ADC3 Volume", TABLA_A_TX_3_4_EN, 5, 3, 0, analog_gain),
@@ -2155,7 +2155,7 @@
 		goto err;
 	}
 rtn:
-	snd_soc_dapm_mux_update_power(widget, kcontrol, 1, widget->value, e);
+	snd_soc_dapm_mux_update_power(widget, kcontrol, widget->value, e);
 	mutex_unlock(&codec->mutex);
 	return 0;
 err:
diff --git a/sound/soc/codecs/wcd9320.c b/sound/soc/codecs/wcd9320.c
index 9cad1e5..bc02513 100644
--- a/sound/soc/codecs/wcd9320.c
+++ b/sound/soc/codecs/wcd9320.c
@@ -4974,12 +4974,6 @@
 		/*Enable spkr VI clocks*/
 		snd_soc_update_bits(codec,
 		TAIKO_A_CDC_CLK_TX_CLK_EN_B2_CTL, 0xC, 0xC);
-		/*Enable Voltage Decimator*/
-		snd_soc_update_bits(codec,
-		TAIKO_A_CDC_CONN_TX_SB_B9_CTL, 0x1F, 0x12);
-		/*Enable Current Decimator*/
-		snd_soc_update_bits(codec,
-		TAIKO_A_CDC_CONN_TX_SB_B10_CTL, 0x1F, 0x13);
 		(void) taiko_codec_enable_slim_chmask(dai, true);
 		ret = wcd9xxx_cfg_slim_sch_tx(core, &dai->wcd9xxx_ch_list,
 					dai->rate, dai->bit_width,
@@ -4991,13 +4985,6 @@
 		if (ret)
 			pr_err("%s error in close_slim_sch_tx %d\n",
 				__func__, ret);
-		/*Disable Voltage decimator*/
-		snd_soc_update_bits(codec,
-		TAIKO_A_CDC_CONN_TX_SB_B9_CTL, 0x1F, 0x0);
-		/*Disable Current decimator*/
-		snd_soc_update_bits(codec,
-		TAIKO_A_CDC_CONN_TX_SB_B10_CTL, 0x1F, 0x0);
-		/*Disable spkr VI clocks*/
 		snd_soc_update_bits(codec, TAIKO_A_CDC_CLK_TX_CLK_EN_B2_CTL,
 				0xC, 0x0);
 		/*Disable V&I sensing*/
diff --git a/sound/soc/codecs/wcd9xxx-mbhc.c b/sound/soc/codecs/wcd9xxx-mbhc.c
index 8d6c4bc..ec99c5f 100644
--- a/sound/soc/codecs/wcd9xxx-mbhc.c
+++ b/sound/soc/codecs/wcd9xxx-mbhc.c
@@ -222,6 +222,19 @@
 		pr_debug("Polling is not active, do not start polling\n");
 		return;
 	}
+
+	/*
+	 * setup internal micbias if codec uses internal micbias for
+	 * headset detection
+	 */
+	if (mbhc->mbhc_cfg->use_int_rbias && !mbhc->int_rbias_on) {
+		if (mbhc->mbhc_cb && mbhc->mbhc_cb->setup_int_rbias)
+			mbhc->mbhc_cb->setup_int_rbias(codec, true);
+		else
+			pr_err("%s: internal bias requested but codec did not provide callback\n",
+				__func__);
+	}
+
 	snd_soc_write(codec, WCD9XXX_A_MBHC_SCALING_MUX_1, 0x04);
 	if (mbhc->mbhc_cb && mbhc->mbhc_cb->enable_mux_bias_block)
 		mbhc->mbhc_cb->enable_mux_bias_block(codec);
@@ -1090,12 +1103,12 @@
 	 * setup internal micbias if codec uses internal micbias for
 	 * headset detection
 	 */
-	if (mbhc->mbhc_cfg->use_int_rbias) {
+	if (mbhc->mbhc_cfg->use_int_rbias && !mbhc->int_rbias_on) {
 		if (mbhc->mbhc_cb && mbhc->mbhc_cb->setup_int_rbias)
 			mbhc->mbhc_cb->setup_int_rbias(codec, true);
 	else
-		pr_err("%s: internal bias is requested but codec did not provide callback\n",
-			 __func__);
+		pr_err("%s: internal bias requested but codec did not provide callback\n",
+			__func__);
 	}
 
 	snd_soc_update_bits(codec, WCD9XXX_A_CLK_BUFF_EN1, 0x05, 0x01);
@@ -1289,6 +1302,7 @@
 	const struct wcd9xxx_mbhc_plug_type_cfg *plug_type =
 	    WCD9XXX_MBHC_CAL_PLUG_TYPE_PTR(mbhc->mbhc_cfg->calibration);
 	s16 hs_max, no_mic, dce_z;
+	int highhph_cnt = 0;
 
 	pr_debug("%s: enter\n", __func__);
 	pr_debug("%s: event_state 0x%lx\n", __func__, event_state);
@@ -1313,9 +1327,10 @@
 		d->_vdces = vdce;
 		if (d->_vdces < no_mic)
 			d->_type = PLUG_TYPE_HEADPHONE;
-		else if (d->_vdces >= hs_max)
+		else if (d->_vdces >= hs_max) {
 			d->_type = PLUG_TYPE_HIGH_HPH;
-		else
+			highhph_cnt++;
+		} else
 			d->_type = PLUG_TYPE_HEADSET;
 
 		pr_debug("%s: DCE #%d, %04x, V %04d(%04d), HPHL %d TYPE %d\n",
@@ -1350,7 +1365,8 @@
 		goto exit;
 	}
 
-	delta_thr = highhph ? WCD9XXX_MB_MEAS_DELTA_MAX_MV :
+	delta_thr = ((highhph_cnt == sz) || highhph) ?
+			      WCD9XXX_MB_MEAS_DELTA_MAX_MV :
 			      WCD9XXX_CS_MEAS_DELTA_MAX_MV;
 
 	for (i = 0, d = dt; i < sz; i++, d++) {
@@ -2842,6 +2858,10 @@
 	if (wcd9xxx_cancel_btn_work(mbhc))
 		pr_debug("%s: button press is canceled\n", __func__);
 
+	/* cancel detect plug */
+	wcd9xxx_cancel_hs_detect_plug(mbhc,
+				      &mbhc->correct_plug_swch);
+
 	insert = !wcd9xxx_swch_level_remove(mbhc);
 	pr_debug("%s: Current plug type %d, insert %d\n", __func__,
 		 mbhc->current_plug, insert);
@@ -2849,9 +2869,6 @@
 		mbhc->lpi_enabled = false;
 		wmb();
 
-		/* cancel detect plug */
-		wcd9xxx_cancel_hs_detect_plug(mbhc,
-					      &mbhc->correct_plug_swch);
 		if ((mbhc->current_plug != PLUG_TYPE_NONE) &&
 		    !(snd_soc_read(codec, WCD9XXX_A_MBHC_INSERT_DETECT) &
 				   (1 << 1)))
@@ -2866,10 +2883,6 @@
 		mbhc->lpi_enabled = false;
 		wmb();
 
-		/* cancel detect plug */
-		wcd9xxx_cancel_hs_detect_plug(mbhc,
-					      &mbhc->correct_plug_swch);
-
 		if (mbhc->current_plug == PLUG_TYPE_HEADPHONE) {
 			wcd9xxx_report_plug(mbhc, 0, SND_JACK_HEADPHONE);
 			is_removed = true;
@@ -3171,6 +3184,19 @@
 		goto done;
 	}
 
+	/*
+	 * setup internal micbias if codec uses internal micbias for
+	 * headset detection
+	 */
+	if (mbhc->mbhc_cfg->use_int_rbias && !mbhc->int_rbias_on) {
+		if (mbhc->mbhc_cb && mbhc->mbhc_cb->setup_int_rbias)
+			mbhc->mbhc_cb->setup_int_rbias(codec, true);
+		else
+			pr_err("%s: internal bias requested but codec did not provide callback\n",
+				__func__);
+	}
+
+
 	/* Measure scaled HW DCE */
 	vddio = (mbhc->mbhc_data.micb_mv != VDDIO_MICBIAS_MV &&
 		 mbhc->mbhc_micbias_switched);
@@ -3991,11 +4017,13 @@
 	 * headset detection
 	 */
 	if (mbhc->mbhc_cfg->use_int_rbias) {
-		if (mbhc->mbhc_cb && mbhc->mbhc_cb->setup_int_rbias)
+		if (mbhc->mbhc_cb && mbhc->mbhc_cb->setup_int_rbias) {
 			mbhc->mbhc_cb->setup_int_rbias(codec, true);
-		else
-			pr_info("%s: internal bias is requested but codec did not provide callback\n",
+			mbhc->int_rbias_on = true;
+		} else {
+			pr_info("%s: internal bias requested but codec did not provide callback\n",
 				__func__);
+		}
 	}
 
 	/*
@@ -4150,6 +4178,7 @@
 	case WCD9XXX_EVENT_PRE_MICBIAS_2_ON:
 	case WCD9XXX_EVENT_PRE_MICBIAS_3_ON:
 	case WCD9XXX_EVENT_PRE_MICBIAS_4_ON:
+		mbhc->int_rbias_on = true;
 		if (mbhc->mbhc_cfg && mbhc->mbhc_cfg->micbias ==
 		    wcd9xxx_event_to_micbias(event)) {
 			wcd9xxx_switch_micbias(mbhc, 0);
@@ -4177,6 +4206,7 @@
 	case WCD9XXX_EVENT_POST_MICBIAS_2_OFF:
 	case WCD9XXX_EVENT_POST_MICBIAS_3_OFF:
 	case WCD9XXX_EVENT_POST_MICBIAS_4_OFF:
+		mbhc->int_rbias_on = false;
 		if (mbhc->mbhc_cfg && mbhc->mbhc_cfg->micbias ==
 		    wcd9xxx_event_to_micbias(event)) {
 			if (mbhc->event_state &
@@ -4472,6 +4502,7 @@
 	mbhc->mbhc_cb = mbhc_cb;
 	mbhc->intr_ids = mbhc_cdc_intr_ids;
 	mbhc->impedance_detect = impedance_det_en;
+	mbhc->int_rbias_on = false;
 
 	if (mbhc->intr_ids == NULL) {
 		pr_err("%s: Interrupt mapping not provided\n", __func__);
diff --git a/sound/soc/codecs/wcd9xxx-mbhc.h b/sound/soc/codecs/wcd9xxx-mbhc.h
index 9d0afe9..7fe9538 100644
--- a/sound/soc/codecs/wcd9xxx-mbhc.h
+++ b/sound/soc/codecs/wcd9xxx-mbhc.h
@@ -336,7 +336,7 @@
 	u32 rco_clk_rate;
 
 	bool update_z;
-
+	bool int_rbias_on;
 	/* Holds codec specific interrupt mapping */
 	const struct wcd9xxx_mbhc_intr *intr_ids;
 
diff --git a/sound/soc/msm/msm-pcm-host-voice.c b/sound/soc/msm/msm-pcm-host-voice.c
index 2eafc1d..1b68bcf 100644
--- a/sound/soc/msm/msm-pcm-host-voice.c
+++ b/sound/soc/msm/msm-pcm-host-voice.c
@@ -989,7 +989,7 @@
 			spin_unlock_irqrestore(&dai_data->dsp_lock, dsp_flags);
 			ret = copy_to_user(buf,
 					   &buf_node->frame.voc_pkt,
-					   count);
+					   buf_node->frame.len);
 			if (ret) {
 				pr_err("%s: Copy to user retuned %d\n",
 					__func__, ret);
diff --git a/sound/soc/msm/msm8974.c b/sound/soc/msm/msm8974.c
index d7ddca2..7f8736c 100644
--- a/sound/soc/msm/msm8974.c
+++ b/sound/soc/msm/msm8974.c
@@ -58,16 +58,9 @@
 #define LO_2_SPK_AMP	0x4
 #define LO_4_SPK_AMP	0x8
 
-#define LPAIF_OFFSET 0xFE000000
-#define LPAIF_PRI_MODE_MUXSEL (LPAIF_OFFSET + 0x2B000)
-#define LPAIF_SEC_MODE_MUXSEL (LPAIF_OFFSET + 0x2C000)
-#define LPAIF_TER_MODE_MUXSEL (LPAIF_OFFSET + 0x2D000)
-#define LPAIF_QUAD_MODE_MUXSEL (LPAIF_OFFSET + 0x2E000)
-
 #define I2S_PCM_SEL 1
 #define I2S_PCM_SEL_OFFSET 1
 
-
 #define WCD9XXX_MBHC_DEF_BUTTONS 8
 #define WCD9XXX_MBHC_DEF_RLOADS 5
 #define TAIKO_EXT_CLK_RATE 9600000
@@ -146,6 +139,7 @@
 struct msm_auxpcm_ctrl {
 	struct msm_auxpcm_gpio *pin_data;
 	u32 cnt;
+	void __iomem *mux;
 };
 
 struct msm8974_asoc_mach_data {
@@ -173,9 +167,6 @@
 	{"SEC_AUXPCM_DOUT",      "qcom,sec-auxpcm-gpio-dout"},
 };
 
-void *lpaif_pri_muxsel_virt_addr;
-void *lpaif_sec_muxsel_virt_addr;
-
 struct msm8974_liquid_dock_dev {
 	int dock_plug_gpio;
 	int dock_plug_irq;
@@ -1192,12 +1183,14 @@
 		goto err;
 	}
 	if (atomic_inc_return(&prim_auxpcm_rsc_ref) == 1) {
-		if (lpaif_pri_muxsel_virt_addr != NULL)
+		if (auxpcm_ctrl->mux != NULL) {
 			iowrite32(I2S_PCM_SEL << I2S_PCM_SEL_OFFSET,
-				lpaif_pri_muxsel_virt_addr);
-		else
-			pr_err("%s lpaif_pri_muxsel_virt_addr is NULL\n",
-				 __func__);
+				  auxpcm_ctrl->mux);
+		} else {
+			pr_err("%s: Pri AUXPCM MUX addr is NULL\n", __func__);
+			ret = -EINVAL;
+			goto err;
+		}
 		ret = msm_aux_pcm_get_gpios(auxpcm_ctrl);
 	}
 	if (ret < 0) {
@@ -1247,12 +1240,14 @@
 		goto err;
 	}
 	if (atomic_inc_return(&sec_auxpcm_rsc_ref) == 1) {
-		if (lpaif_sec_muxsel_virt_addr != NULL)
+		if (auxpcm_ctrl->mux != NULL) {
 			iowrite32(I2S_PCM_SEL << I2S_PCM_SEL_OFFSET,
-				lpaif_sec_muxsel_virt_addr);
-		else
-			pr_err("%s lpaif_sec_muxsel_virt_addr is NULL\n",
-				 __func__);
+				  auxpcm_ctrl->mux);
+		} else {
+			pr_err("%s Sec AUXPCM MUX addr is NULL\n", __func__);
+			ret = -EINVAL;
+			goto err;
+		}
 		ret = msm_aux_pcm_get_gpios(auxpcm_ctrl);
 	}
 	if (ret < 0) {
@@ -2667,6 +2662,8 @@
 	int ret;
 	const char *auxpcm_pri_gpio_set = NULL;
 	const char *prop_name_ult_lo_gpio = "qcom,ext-ult-lo-amp-gpio";
+	struct resource	*pri_muxsel;
+	struct resource	*sec_muxsel;
 
 	if (!pdev->dev.of_node) {
 		dev_err(&pdev->dev, "No platform supplied from device tree\n");
@@ -2794,7 +2791,6 @@
 		}
 	}
 
-
 	pdata->us_euro_gpio = of_get_named_gpio(pdev->dev.of_node,
 				"qcom,us-euro-gpios", 0);
 	if (pdata->us_euro_gpio < 0) {
@@ -2821,28 +2817,49 @@
 		goto err1;
 	}
 	if (!strcmp(auxpcm_pri_gpio_set, "prim-gpio-prim")) {
-		lpaif_pri_muxsel_virt_addr = ioremap(LPAIF_PRI_MODE_MUXSEL, 4);
+		pri_muxsel = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+						"lpaif_pri_mode_muxsel");
 	} else if (!strcmp(auxpcm_pri_gpio_set, "prim-gpio-tert")) {
-		lpaif_pri_muxsel_virt_addr = ioremap(LPAIF_TER_MODE_MUXSEL, 4);
+		pri_muxsel = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+						"lpaif_tert_mode_muxsel");
 	} else {
 		dev_err(&pdev->dev, "Invalid value %s for AUXPCM GPIO set\n",
 			auxpcm_pri_gpio_set);
 		ret = -EINVAL;
 		goto err1;
 	}
-	if (lpaif_pri_muxsel_virt_addr == NULL) {
-		pr_err("%s Pri muxsel virt addr is null\n", __func__);
-		ret = -EINVAL;
-		goto err1;
+	if (!pri_muxsel) {
+		dev_err(&pdev->dev, "MUX addr invalid for primary AUXPCM\n");
+			ret = -ENODEV;
+			goto err1;
+	} else {
+		pdata->pri_auxpcm_ctrl->mux = ioremap(pri_muxsel->start,
+						    resource_size(pri_muxsel));
+		if (pdata->pri_auxpcm_ctrl->mux == NULL) {
+			pr_err("%s Pri muxsel virt addr is null\n", __func__);
+			ret = -EINVAL;
+			goto err1;
+		}
 	}
-	lpaif_sec_muxsel_virt_addr = ioremap(LPAIF_SEC_MODE_MUXSEL, 4);
-	if (lpaif_sec_muxsel_virt_addr == NULL) {
+
+	sec_muxsel = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+						"lpaif_sec_mode_muxsel");
+	if (!sec_muxsel) {
+		dev_err(&pdev->dev, "MUX addr invalid for secondary AUXPCM\n");
+		ret = -ENODEV;
+		goto err2;
+	}
+	pdata->sec_auxpcm_ctrl->mux = ioremap(sec_muxsel->start,
+					     resource_size(sec_muxsel));
+	if (pdata->sec_auxpcm_ctrl->mux == NULL) {
 		pr_err("%s Sec muxsel virt addr is null\n", __func__);
 		ret = -EINVAL;
-		goto err1;
+		goto err2;
 	}
 	return 0;
 
+err2:
+	iounmap(pdata->pri_auxpcm_ctrl->mux);
 err1:
 	if (ext_ult_lo_amp_gpio >= 0)
 		gpio_free(ext_ult_lo_amp_gpio);
@@ -2896,8 +2913,8 @@
 		msm8974_liquid_dock_dev = NULL;
 	}
 
-	iounmap(lpaif_pri_muxsel_virt_addr);
-	iounmap(lpaif_sec_muxsel_virt_addr);
+	iounmap(pdata->pri_auxpcm_ctrl->mux);
+	iounmap(pdata->sec_auxpcm_ctrl->mux);
 	snd_soc_unregister_card(card);
 
 	return 0;
diff --git a/sound/soc/msm/qdsp6v2/audio_acdb.c b/sound/soc/msm/qdsp6v2/audio_acdb.c
index 01422cf..8187616 100644
--- a/sound/soc/msm/qdsp6v2/audio_acdb.c
+++ b/sound/soc/msm/qdsp6v2/audio_acdb.c
@@ -38,64 +38,60 @@
 
 #define MAX_HW_DELAY_ENTRIES	25
 
-struct sidetone_atomic_cal {
-	atomic_t	enable;
-	atomic_t	gain;
-};
-
-
 struct acdb_data {
+	uint32_t		usage_count;
+
 	struct mutex		acdb_mutex;
 
 	/* ANC Cal */
-	struct acdb_atomic_cal_block	anc_cal;
+	struct acdb_cal_block		anc_cal;
 
 	/* AANC Cal */
-	struct acdb_atomic_cal_block    aanc_cal;
+	struct acdb_cal_block		aanc_cal;
 
 	/* LSM Cal */
-	struct acdb_atomic_cal_block	lsm_cal;
+	struct acdb_cal_block		lsm_cal;
 
 	/* AudProc Cal */
-	atomic_t			asm_topology;
-	atomic_t			adm_topology[MAX_AUDPROC_TYPES];
-	struct acdb_atomic_cal_block	audproc_cal[MAX_AUDPROC_TYPES];
-	struct acdb_atomic_cal_block	audstrm_cal[MAX_AUDPROC_TYPES];
-	struct acdb_atomic_cal_block	audvol_cal[MAX_AUDPROC_TYPES];
+	uint32_t			asm_topology;
+	uint32_t			adm_topology[MAX_AUDPROC_TYPES];
+	struct acdb_cal_block		audproc_cal[MAX_AUDPROC_TYPES];
+	struct acdb_cal_block		audstrm_cal[MAX_AUDPROC_TYPES];
+	struct acdb_cal_block		audvol_cal[MAX_AUDPROC_TYPES];
 
 	/* VocProc Cal */
-	atomic_t			voice_rx_topology;
-	atomic_t			voice_tx_topology;
-	struct acdb_atomic_cal_block	vocproc_cal;
-	struct acdb_atomic_cal_block	vocstrm_cal;
-	struct acdb_atomic_cal_block	vocvol_cal;
+	uint32_t			voice_rx_topology;
+	uint32_t			voice_tx_topology;
+	struct acdb_cal_block		vocproc_cal;
+	struct acdb_cal_block		vocstrm_cal;
+	struct acdb_cal_block		vocvol_cal;
 
 	/* Voice Column data */
-	struct acdb_atomic_cal_block	vocproc_col_cal[MAX_VOCPROC_TYPES];
+	struct acdb_cal_block		vocproc_col_cal[MAX_VOCPROC_TYPES];
 	uint32_t			*col_data[MAX_VOCPROC_TYPES];
 
 	/* VocProc dev cfg cal*/
-	struct acdb_atomic_cal_block	vocproc_dev_cal;
+	struct acdb_cal_block		vocproc_dev_cal;
 
 	/* Custom topology */
-	struct acdb_atomic_cal_block	adm_custom_topology;
-	struct acdb_atomic_cal_block	asm_custom_topology;
-	atomic_t			valid_adm_custom_top;
-	atomic_t			valid_asm_custom_top;
+	struct acdb_cal_block		adm_custom_topology;
+	struct acdb_cal_block		asm_custom_topology;
+	uint32_t			valid_adm_custom_top;
+	uint32_t			valid_asm_custom_top;
 
 	/* AFE cal */
-	struct acdb_atomic_cal_block	afe_cal[MAX_AUDPROC_TYPES];
+	struct acdb_cal_block		afe_cal[MAX_AUDPROC_TYPES];
 
 	/* Sidetone Cal */
-	struct sidetone_atomic_cal	sidetone_cal;
+	struct sidetone_cal		sidetone_cal;
 
 	/* Allocation information */
 	struct ion_client		*ion_client;
 	struct ion_handle		*ion_handle;
-	atomic_t			map_handle;
-	atomic64_t			paddr;
-	atomic64_t			kvaddr;
-	atomic64_t			mem_len;
+	uint32_t			map_handle;
+	uint64_t			paddr;
+	uint64_t			kvaddr;
+	uint64_t			mem_len;
 
 	/* Speaker protection */
 	struct msm_spk_prot_cfg spk_prot_cfg;
@@ -106,62 +102,63 @@
 };
 
 static struct acdb_data		acdb_data;
-static atomic_t usage_count;
 
 uint32_t get_voice_rx_topology(void)
 {
-	return atomic_read(&acdb_data.voice_rx_topology);
+	return acdb_data.voice_rx_topology;
 }
 
 void store_voice_rx_topology(uint32_t topology)
 {
-	atomic_set(&acdb_data.voice_rx_topology, topology);
+	acdb_data.voice_rx_topology = topology;
 }
 
 uint32_t get_voice_tx_topology(void)
 {
-	return atomic_read(&acdb_data.voice_tx_topology);
+	return acdb_data.voice_tx_topology;
 }
 
 void store_voice_tx_topology(uint32_t topology)
 {
-	atomic_set(&acdb_data.voice_tx_topology, topology);
+	acdb_data.voice_tx_topology = topology;
 }
 
 uint32_t get_adm_rx_topology(void)
 {
-	return atomic_read(&acdb_data.adm_topology[RX_CAL]);
+	return acdb_data.adm_topology[RX_CAL];
 }
 
 void store_adm_rx_topology(uint32_t topology)
 {
-	atomic_set(&acdb_data.adm_topology[RX_CAL], topology);
+	acdb_data.adm_topology[RX_CAL] = topology;
 }
 
 uint32_t get_adm_tx_topology(void)
 {
-	return atomic_read(&acdb_data.adm_topology[TX_CAL]);
+	return acdb_data.adm_topology[TX_CAL];
 }
 
 void store_adm_tx_topology(uint32_t topology)
 {
-	atomic_set(&acdb_data.adm_topology[TX_CAL], topology);
+	acdb_data.adm_topology[TX_CAL] = topology;
 }
 
 uint32_t get_asm_topology(void)
 {
-	return atomic_read(&acdb_data.asm_topology);
+	return acdb_data.asm_topology;
 }
 
 void store_asm_topology(uint32_t topology)
 {
-	atomic_set(&acdb_data.asm_topology, topology);
+	acdb_data.asm_topology = topology;
 }
 
 void reset_custom_topology_flags(void)
 {
-	atomic_set(&acdb_data.valid_adm_custom_top, 1);
-	atomic_set(&acdb_data.valid_asm_custom_top, 1);
+	mutex_lock(&acdb_data.acdb_mutex);
+	acdb_data.valid_adm_custom_top = 1;
+	acdb_data.valid_asm_custom_top = 1;
+	mutex_unlock(&acdb_data.acdb_mutex);
 }
 
 int get_adm_custom_topology(struct acdb_cal_block *cal_block)
@@ -175,19 +172,19 @@
 		goto done;
 	}
 
+	mutex_lock(&acdb_data.acdb_mutex);
 	/* Only return allow one access after memory registered */
-	if (atomic_read(&acdb_data.valid_adm_custom_top) == 0) {
+	if (acdb_data.valid_adm_custom_top == 0) {
 		cal_block->cal_size = 0;
-		goto done;
+		goto unlock;
 	}
-	atomic_set(&acdb_data.valid_adm_custom_top, 0);
+	acdb_data.valid_adm_custom_top = 0;
 
-	cal_block->cal_size =
-		atomic_read(&acdb_data.adm_custom_topology.cal_size);
-	cal_block->cal_paddr =
-		atomic_read(&acdb_data.adm_custom_topology.cal_paddr);
-	cal_block->cal_kvaddr =
-		atomic_read(&acdb_data.adm_custom_topology.cal_kvaddr);
+	cal_block->cal_size = acdb_data.adm_custom_topology.cal_size;
+	cal_block->cal_paddr = acdb_data.adm_custom_topology.cal_paddr;
+	cal_block->cal_kvaddr = acdb_data.adm_custom_topology.cal_kvaddr;
+unlock:
+	mutex_unlock(&acdb_data.acdb_mutex);
 done:
 	return result;
 }
@@ -197,21 +194,18 @@
 	int result = 0;
 	pr_debug("%s,\n", __func__);
 
-	if (cal_block->cal_offset > atomic64_read(&acdb_data.mem_len)) {
-		pr_err("%s: offset %d is > mem_len %ld\n",
-			__func__, cal_block->cal_offset,
-			(long)atomic64_read(&acdb_data.mem_len));
+	if (cal_block->cal_offset > acdb_data.mem_len) {
+		pr_err("%s: offset %d is > mem_len %llu\n",
+			__func__, cal_block->cal_offset, acdb_data.mem_len);
 		result = -EINVAL;
 		goto done;
 	}
 
-	atomic_set(&acdb_data.adm_custom_topology.cal_size,
-		cal_block->cal_size);
-	atomic_set(&acdb_data.adm_custom_topology.cal_paddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.paddr));
-	atomic_set(&acdb_data.adm_custom_topology.cal_kvaddr,
-		cal_block->cal_offset +
-		atomic64_read(&acdb_data.kvaddr));
+	acdb_data.adm_custom_topology.cal_size = cal_block->cal_size;
+	acdb_data.adm_custom_topology.cal_paddr =
+		cal_block->cal_offset + acdb_data.paddr;
+	acdb_data.adm_custom_topology.cal_kvaddr =
+		cal_block->cal_offset + acdb_data.kvaddr;
 done:
 	return result;
 }
@@ -227,19 +221,19 @@
 		goto done;
 	}
 
+	mutex_lock(&acdb_data.acdb_mutex);
 	/* Only return allow one access after memory registered */
-	if (atomic_read(&acdb_data.valid_asm_custom_top) == 0) {
+	if (acdb_data.valid_asm_custom_top == 0) {
 		cal_block->cal_size = 0;
-		goto done;
+		goto unlock;
 	}
-	atomic_set(&acdb_data.valid_asm_custom_top, 0);
+	acdb_data.valid_asm_custom_top = 0;
 
-	cal_block->cal_size =
-		atomic_read(&acdb_data.asm_custom_topology.cal_size);
-	cal_block->cal_paddr =
-		atomic_read(&acdb_data.asm_custom_topology.cal_paddr);
-	cal_block->cal_kvaddr =
-		atomic_read(&acdb_data.asm_custom_topology.cal_kvaddr);
+	cal_block->cal_size = acdb_data.asm_custom_topology.cal_size;
+	cal_block->cal_paddr = acdb_data.asm_custom_topology.cal_paddr;
+	cal_block->cal_kvaddr = acdb_data.asm_custom_topology.cal_kvaddr;
+unlock:
+	mutex_unlock(&acdb_data.acdb_mutex);
 done:
 	return result;
 }
@@ -249,21 +243,18 @@
 	int result = 0;
 	pr_debug("%s,\n", __func__);
 
-	if (cal_block->cal_offset > atomic64_read(&acdb_data.mem_len)) {
-		pr_err("%s: offset %d is > mem_len %ld\n",
-			__func__, cal_block->cal_offset,
-			(long)atomic64_read(&acdb_data.mem_len));
+	if (cal_block->cal_offset > acdb_data.mem_len) {
+		pr_err("%s: offset %d is > mem_len %llu\n",
+			__func__, cal_block->cal_offset, acdb_data.mem_len);
 		result = -EINVAL;
 		goto done;
 	}
 
-	atomic_set(&acdb_data.asm_custom_topology.cal_size,
-		cal_block->cal_size);
-	atomic_set(&acdb_data.asm_custom_topology.cal_paddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.paddr));
-	atomic_set(&acdb_data.asm_custom_topology.cal_kvaddr,
-		cal_block->cal_offset +
-		atomic64_read(&acdb_data.kvaddr));
+	acdb_data.asm_custom_topology.cal_size = cal_block->cal_size;
+	acdb_data.asm_custom_topology.cal_paddr =
+		cal_block->cal_offset + acdb_data.paddr;
+	acdb_data.asm_custom_topology.cal_kvaddr =
+		cal_block->cal_offset + acdb_data.kvaddr;
 done:
 	return result;
 }
@@ -280,10 +271,8 @@
 	}
 
 	cal_block->cal_size = ACDB_TOTAL_VOICE_ALLOCATION;
-	cal_block->cal_paddr =
-		atomic_read(&acdb_data.vocproc_cal.cal_paddr);
-	cal_block->cal_kvaddr =
-		atomic_read(&acdb_data.vocproc_cal.cal_kvaddr);
+	cal_block->cal_paddr = acdb_data.vocproc_cal.cal_paddr;
+	cal_block->cal_kvaddr = acdb_data.vocproc_cal.cal_kvaddr;
 done:
 	return result;
 }
@@ -299,12 +288,9 @@
 		goto done;
 	}
 
-	cal_block->cal_size =
-		atomic_read(&acdb_data.aanc_cal.cal_size);
-	cal_block->cal_paddr =
-		atomic_read(&acdb_data.aanc_cal.cal_paddr);
-	cal_block->cal_kvaddr =
-		atomic_read(&acdb_data.aanc_cal.cal_kvaddr);
+	cal_block->cal_size = acdb_data.aanc_cal.cal_size;
+	cal_block->cal_paddr = acdb_data.aanc_cal.cal_paddr;
+	cal_block->cal_kvaddr = acdb_data.aanc_cal.cal_kvaddr;
 done:
 	return result;
 }
@@ -314,20 +300,18 @@
 	int result = 0;
 	pr_debug("%s,\n", __func__);
 
-	if (cal_block->cal_offset > atomic64_read(&acdb_data.mem_len)) {
-		pr_err("%s: offset %d is > mem_len %ld\n",
-		 __func__, cal_block->cal_offset,
-		(long)atomic64_read(&acdb_data.mem_len));
+	if (cal_block->cal_offset > acdb_data.mem_len) {
+		pr_err("%s: offset %d is > mem_len %llu\n",
+		 __func__, cal_block->cal_offset, acdb_data.mem_len);
 		result = -EINVAL;
 		goto done;
 	}
 
-	atomic_set(&acdb_data.aanc_cal.cal_size,
-		cal_block->cal_size);
-	atomic_set(&acdb_data.aanc_cal.cal_paddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.paddr));
-	atomic_set(&acdb_data.aanc_cal.cal_kvaddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.kvaddr));
+	acdb_data.aanc_cal.cal_size = cal_block->cal_size;
+	acdb_data.aanc_cal.cal_paddr =
+		cal_block->cal_offset + acdb_data.paddr;
+	acdb_data.aanc_cal.cal_kvaddr =
+		cal_block->cal_offset + acdb_data.kvaddr;
 done:
 	return result;
 }
@@ -343,12 +327,9 @@
 		goto done;
 	}
 
-	cal_block->cal_size =
-		atomic_read(&acdb_data.lsm_cal.cal_size);
-	cal_block->cal_paddr =
-		atomic_read(&acdb_data.lsm_cal.cal_paddr);
-	cal_block->cal_kvaddr =
-		atomic_read(&acdb_data.lsm_cal.cal_kvaddr);
+	cal_block->cal_size = acdb_data.lsm_cal.cal_size;
+	cal_block->cal_paddr = acdb_data.lsm_cal.cal_paddr;
+	cal_block->cal_kvaddr = acdb_data.lsm_cal.cal_kvaddr;
 done:
 	return result;
 }
@@ -358,20 +339,18 @@
 	int result = 0;
 	pr_debug("%s,\n", __func__);
 
-	if (cal_block->cal_offset > atomic64_read(&acdb_data.mem_len)) {
-		pr_err("%s: offset %d is > mem_len %ld\n",
-			__func__, cal_block->cal_offset,
-			(long)atomic64_read(&acdb_data.mem_len));
+	if (cal_block->cal_offset > acdb_data.mem_len) {
+		pr_err("%s: offset %d is > mem_len %llu\n",
+			__func__, cal_block->cal_offset, acdb_data.mem_len);
 		result = -EINVAL;
 		goto done;
 	}
 
-	atomic_set(&acdb_data.lsm_cal.cal_size,
-		cal_block->cal_size);
-	atomic_set(&acdb_data.lsm_cal.cal_paddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.paddr));
-	atomic_set(&acdb_data.lsm_cal.cal_kvaddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.kvaddr));
+	acdb_data.lsm_cal.cal_size = cal_block->cal_size;
+	acdb_data.lsm_cal.cal_paddr =
+		cal_block->cal_offset + acdb_data.paddr;
+	acdb_data.lsm_cal.cal_kvaddr =
+		cal_block->cal_offset + acdb_data.kvaddr;
 done:
 	return result;
 }
@@ -470,7 +449,6 @@
 	pr_debug("ACDB=> %s : Path = %d num_entries = %d\n",
 		 __func__, path, delay.num_entries);
 
-	mutex_lock(&acdb_data.acdb_mutex);
 	if (path == RX_CAL)
 		delay_dest = &acdb_data.hw_delay_rx;
 	else if (path == TX_CAL)
@@ -487,7 +465,6 @@
 		       __func__, result, path);
 		result = -EFAULT;
 	}
-	mutex_unlock(&acdb_data.acdb_mutex);
 done:
 	return result;
 }
@@ -503,12 +480,9 @@
 		goto done;
 	}
 
-	cal_block->cal_size =
-		atomic_read(&acdb_data.anc_cal.cal_size);
-	cal_block->cal_paddr =
-		atomic_read(&acdb_data.anc_cal.cal_paddr);
-	cal_block->cal_kvaddr =
-		atomic_read(&acdb_data.anc_cal.cal_kvaddr);
+	cal_block->cal_size = acdb_data.anc_cal.cal_size;
+	cal_block->cal_paddr = acdb_data.anc_cal.cal_paddr;
+	cal_block->cal_kvaddr = acdb_data.anc_cal.cal_kvaddr;
 done:
 	return result;
 }
@@ -518,20 +492,18 @@
 	int result = 0;
 	pr_debug("%s,\n", __func__);
 
-	if (cal_block->cal_offset > atomic64_read(&acdb_data.mem_len)) {
-		pr_err("%s: offset %d is > mem_len %ld\n",
-			__func__, cal_block->cal_offset,
-			(long)atomic64_read(&acdb_data.mem_len));
+	if (cal_block->cal_offset > acdb_data.mem_len) {
+		pr_err("%s: offset %d is > mem_len %llu\n",
+			__func__, cal_block->cal_offset, acdb_data.mem_len);
 		result = -EINVAL;
 		goto done;
 	}
 
-	atomic_set(&acdb_data.anc_cal.cal_size,
-		cal_block->cal_size);
-	atomic_set(&acdb_data.anc_cal.cal_paddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.paddr));
-	atomic_set(&acdb_data.anc_cal.cal_kvaddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.kvaddr));
+	acdb_data.anc_cal.cal_size = cal_block->cal_size;
+	acdb_data.anc_cal.cal_paddr =
+		cal_block->cal_offset + acdb_data.paddr;
+	acdb_data.anc_cal.cal_kvaddr =
+		cal_block->cal_offset + acdb_data.kvaddr;
 done:
 	return result;
 }
@@ -541,10 +513,9 @@
 	int result = 0;
 	pr_debug("%s, path = %d\n", __func__, path);
 
-	if (cal_block->cal_offset > atomic64_read(&acdb_data.mem_len)) {
-		pr_err("%s: offset %d is > mem_len %ld\n",
-			__func__, cal_block->cal_offset,
-			(long)atomic64_read(&acdb_data.mem_len));
+	if (cal_block->cal_offset > acdb_data.mem_len) {
+		pr_err("%s: offset %d is > mem_len %llu\n",
+			__func__, cal_block->cal_offset, acdb_data.mem_len);
 		result = -EINVAL;
 		goto done;
 	}
@@ -555,12 +526,11 @@
 		goto done;
 	}
 
-	atomic_set(&acdb_data.afe_cal[path].cal_size,
-		cal_block->cal_size);
-	atomic_set(&acdb_data.afe_cal[path].cal_paddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.paddr));
-	atomic_set(&acdb_data.afe_cal[path].cal_kvaddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.kvaddr));
+	acdb_data.afe_cal[path].cal_size = cal_block->cal_size;
+	acdb_data.afe_cal[path].cal_paddr =
+		cal_block->cal_offset + acdb_data.paddr;
+	acdb_data.afe_cal[path].cal_kvaddr =
+		cal_block->cal_offset + acdb_data.kvaddr;
 done:
 	return result;
 }
@@ -582,12 +552,9 @@
 		goto done;
 	}
 
-	cal_block->cal_size =
-		atomic_read(&acdb_data.afe_cal[path].cal_size);
-	cal_block->cal_paddr =
-		atomic_read(&acdb_data.afe_cal[path].cal_paddr);
-	cal_block->cal_kvaddr =
-		atomic_read(&acdb_data.afe_cal[path].cal_kvaddr);
+	cal_block->cal_size = acdb_data.afe_cal[path].cal_size;
+	cal_block->cal_paddr = acdb_data.afe_cal[path].cal_paddr;
+	cal_block->cal_kvaddr = acdb_data.afe_cal[path].cal_kvaddr;
 done:
 	return result;
 }
@@ -597,10 +564,9 @@
 	int result = 0;
 	pr_debug("%s, path = %d\n", __func__, path);
 
-	if (cal_block->cal_offset > atomic64_read(&acdb_data.mem_len)) {
-		pr_err("%s: offset %d is > mem_len %ld\n",
-			__func__, cal_block->cal_offset,
-			(long)atomic64_read(&acdb_data.mem_len));
+	if (cal_block->cal_offset > acdb_data.mem_len) {
+		pr_err("%s: offset %d is > mem_len %llu\n",
+			__func__, cal_block->cal_offset, acdb_data.mem_len);
 		result = -EINVAL;
 		goto done;
 	}
@@ -611,12 +577,11 @@
 		goto done;
 	}
 
-	atomic_set(&acdb_data.audproc_cal[path].cal_size,
-		cal_block->cal_size);
-	atomic_set(&acdb_data.audproc_cal[path].cal_paddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.paddr));
-	atomic_set(&acdb_data.audproc_cal[path].cal_kvaddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.kvaddr));
+	acdb_data.audproc_cal[path].cal_size = cal_block->cal_size;
+	acdb_data.audproc_cal[path].cal_paddr =
+		cal_block->cal_offset + acdb_data.paddr;
+	acdb_data.audproc_cal[path].cal_kvaddr =
+		cal_block->cal_offset + acdb_data.kvaddr;
 done:
 	return result;
 }
@@ -638,12 +603,9 @@
 		goto done;
 	}
 
-	cal_block->cal_size =
-		atomic_read(&acdb_data.audproc_cal[path].cal_size);
-	cal_block->cal_paddr =
-		atomic_read(&acdb_data.audproc_cal[path].cal_paddr);
-	cal_block->cal_kvaddr =
-		atomic_read(&acdb_data.audproc_cal[path].cal_kvaddr);
+	cal_block->cal_size = acdb_data.audproc_cal[path].cal_size;
+	cal_block->cal_paddr = acdb_data.audproc_cal[path].cal_paddr;
+	cal_block->cal_kvaddr = acdb_data.audproc_cal[path].cal_kvaddr;
 done:
 	return result;
 }
@@ -653,10 +615,9 @@
 	int result = 0;
 	pr_debug("%s, path = %d\n", __func__, path);
 
-	if (cal_block->cal_offset > atomic64_read(&acdb_data.mem_len)) {
-		pr_err("%s: offset %d is > mem_len %ld\n",
-			__func__, cal_block->cal_offset,
-			(long)atomic64_read(&acdb_data.mem_len));
+	if (cal_block->cal_offset > acdb_data.mem_len) {
+		pr_err("%s: offset %d is > mem_len %llu\n",
+			__func__, cal_block->cal_offset, acdb_data.mem_len);
 		result = -EINVAL;
 		goto done;
 	}
@@ -667,12 +628,11 @@
 		goto done;
 	}
 
-	atomic_set(&acdb_data.audstrm_cal[path].cal_size,
-		cal_block->cal_size);
-	atomic_set(&acdb_data.audstrm_cal[path].cal_paddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.paddr));
-	atomic_set(&acdb_data.audstrm_cal[path].cal_kvaddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.kvaddr));
+	acdb_data.audstrm_cal[path].cal_size = cal_block->cal_size;
+	acdb_data.audstrm_cal[path].cal_paddr =
+		cal_block->cal_offset + acdb_data.paddr;
+	acdb_data.audstrm_cal[path].cal_kvaddr =
+		cal_block->cal_offset + acdb_data.kvaddr;
 done:
 	return result;
 }
@@ -694,12 +654,9 @@
 		goto done;
 	}
 
-	cal_block->cal_size =
-		atomic_read(&acdb_data.audstrm_cal[path].cal_size);
-	cal_block->cal_paddr =
-		atomic_read(&acdb_data.audstrm_cal[path].cal_paddr);
-	cal_block->cal_kvaddr =
-		atomic_read(&acdb_data.audstrm_cal[path].cal_kvaddr);
+	cal_block->cal_size = acdb_data.audstrm_cal[path].cal_size;
+	cal_block->cal_paddr = acdb_data.audstrm_cal[path].cal_paddr;
+	cal_block->cal_kvaddr = acdb_data.audstrm_cal[path].cal_kvaddr;
 done:
 	return result;
 }
@@ -709,10 +666,9 @@
 	int result = 0;
 	pr_debug("%s, path = %d\n", __func__, path);
 
-	if (cal_block->cal_offset > atomic64_read(&acdb_data.mem_len)) {
-		pr_err("%s: offset %d is > mem_len %ld\n",
-			__func__, cal_block->cal_offset,
-			(long)atomic64_read(&acdb_data.mem_len));
+	if (cal_block->cal_offset > acdb_data.mem_len) {
+		pr_err("%s: offset %d is > mem_len %llu\n",
+			__func__, cal_block->cal_offset, acdb_data.mem_len);
 		result = -EINVAL;
 		goto done;
 	}
@@ -723,12 +679,11 @@
 		goto done;
 	}
 
-	atomic_set(&acdb_data.audvol_cal[path].cal_size,
-		cal_block->cal_size);
-	atomic_set(&acdb_data.audvol_cal[path].cal_paddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.paddr));
-	atomic_set(&acdb_data.audvol_cal[path].cal_kvaddr,
-		cal_block->cal_offset + atomic64_read(&acdb_data.kvaddr));
+	acdb_data.audvol_cal[path].cal_size = cal_block->cal_size;
+	acdb_data.audvol_cal[path].cal_paddr =
+		cal_block->cal_offset + acdb_data.paddr;
+	acdb_data.audvol_cal[path].cal_kvaddr =
+		cal_block->cal_offset + acdb_data.kvaddr;
 done:
 	return result;
 }
@@ -750,12 +705,9 @@
 		goto done;
 	}
 
-	cal_block->cal_size =
-		atomic_read(&acdb_data.audvol_cal[path].cal_size);
-	cal_block->cal_paddr =
-		atomic_read(&acdb_data.audvol_cal[path].cal_paddr);
-	cal_block->cal_kvaddr =
-		atomic_read(&acdb_data.audvol_cal[path].cal_kvaddr);
+	cal_block->cal_size = acdb_data.audvol_cal[path].cal_size;
+	cal_block->cal_paddr = acdb_data.audvol_cal[path].cal_paddr;
+	cal_block->cal_kvaddr = acdb_data.audvol_cal[path].cal_kvaddr;
 done:
 	return result;
 }
@@ -767,21 +719,18 @@
 	pr_debug("%s,\n", __func__);
 
 	if (cal_size > MAX_COL_SIZE) {
-		pr_err("%s: col size is to big %d\n", __func__,
-				cal_size);
+		pr_err("%s: col size is to big %d\n", __func__, cal_size);
 		result = -EINVAL;
 		goto done;
 	}
 	if (copy_from_user(acdb_data.col_data[vocproc_type],
 			(void *)((uint8_t *)cal_block + sizeof(cal_size)),
 			cal_size)) {
-		pr_err("%s: fail to copy col size %d\n",
-			__func__, cal_size);
+		pr_err("%s: fail to copy col size %d\n", __func__, cal_size);
 		result = -EINVAL;
 		goto done;
 	}
-	atomic_set(&acdb_data.vocproc_col_cal[vocproc_type].cal_size,
-		cal_size);
+	acdb_data.vocproc_col_cal[vocproc_type].cal_size = cal_size;
 done:
 	return result;
 }
@@ -798,12 +747,12 @@
 		goto done;
 	}
 
-	cal_block->cal_size = atomic_read(&acdb_data.
-				vocproc_col_cal[vocproc_type].cal_size);
-	cal_block->cal_paddr = atomic_read(&acdb_data.
-				vocproc_col_cal[vocproc_type].cal_paddr);
-	cal_block->cal_kvaddr = atomic_read(&acdb_data.
-				vocproc_col_cal[vocproc_type].cal_kvaddr);
+	cal_block->cal_size = acdb_data.
+		vocproc_col_cal[vocproc_type].cal_size;
+	cal_block->cal_paddr = acdb_data.
+		vocproc_col_cal[vocproc_type].cal_paddr;
+	cal_block->cal_kvaddr = acdb_data.
+		vocproc_col_cal[vocproc_type].cal_kvaddr;
 done:
 	return result;
 }
@@ -815,24 +764,19 @@
 
 
 	if (cal_block->cal_offset >
-				atomic64_read(&acdb_data.mem_len)) {
-		pr_err("%s: offset %d is > mem_len %ld\n",
-			__func__, cal_block->cal_offset,
-			(long)atomic64_read(&acdb_data.mem_len));
-		atomic_set(&acdb_data.vocproc_dev_cal.cal_size, 0);
+				acdb_data.mem_len) {
+		pr_err("%s: offset %d is > mem_len %llu\n",
+			__func__, cal_block->cal_offset, acdb_data.mem_len);
+		acdb_data.vocproc_dev_cal.cal_size = 0;
 		result = -EINVAL;
 		goto done;
 	}
 
-	atomic_set(&acdb_data.vocproc_dev_cal.cal_size,
-		cal_block->cal_size);
-	atomic_set(&acdb_data.vocproc_dev_cal.cal_paddr,
-		cal_block->cal_offset +
-	atomic64_read(&acdb_data.paddr));
-			atomic_set(&acdb_data.vocproc_dev_cal.cal_kvaddr,
-			cal_block->cal_offset +
-			atomic64_read(&acdb_data.kvaddr));
-
+	acdb_data.vocproc_dev_cal.cal_size = cal_block->cal_size;
+	acdb_data.vocproc_dev_cal.cal_paddr =
+		cal_block->cal_offset + acdb_data.paddr;
+	acdb_data.vocproc_dev_cal.cal_kvaddr =
+		cal_block->cal_offset + acdb_data.kvaddr;
 done:
 	return result;
 }
@@ -848,12 +792,9 @@
 		goto done;
 	}
 
-	cal_block->cal_size =
-		atomic_read(&acdb_data.vocproc_dev_cal.cal_size);
-	cal_block->cal_paddr =
-		atomic_read(&acdb_data.vocproc_dev_cal.cal_paddr);
-	cal_block->cal_kvaddr =
-		atomic_read(&acdb_data.vocproc_dev_cal.cal_kvaddr);
+	cal_block->cal_size = acdb_data.vocproc_dev_cal.cal_size;
+	cal_block->cal_paddr = acdb_data.vocproc_dev_cal.cal_paddr;
+	cal_block->cal_kvaddr = acdb_data.vocproc_dev_cal.cal_kvaddr;
 done:
 	return result;
 }
@@ -866,24 +807,19 @@
 	pr_debug("%s,\n", __func__);
 
 	if (cal_block->cal_offset >
-				atomic64_read(&acdb_data.mem_len)) {
-		pr_err("%s: offset %d is > mem_len %ld\n",
-			__func__, cal_block->cal_offset,
-			(long)atomic64_read(&acdb_data.mem_len));
-		atomic_set(&acdb_data.vocproc_cal.cal_size, 0);
+				acdb_data.mem_len) {
+		pr_err("%s: offset %d is > mem_len %llu\n",
+			__func__, cal_block->cal_offset, acdb_data.mem_len);
+		acdb_data.vocproc_cal.cal_size = 0;
 		result = -EINVAL;
 		goto done;
 	}
 
-	atomic_set(&acdb_data.vocproc_cal.cal_size,
-		cal_block->cal_size);
-	atomic_set(&acdb_data.vocproc_cal.cal_paddr,
-		cal_block->cal_offset +
-		atomic64_read(&acdb_data.paddr));
-	atomic_set(&acdb_data.vocproc_cal.cal_kvaddr,
-		cal_block->cal_offset +
-		atomic64_read(&acdb_data.kvaddr));
-
+	acdb_data.vocproc_cal.cal_size = cal_block->cal_size;
+	acdb_data.vocproc_cal.cal_paddr =
+		cal_block->cal_offset + acdb_data.paddr;
+	acdb_data.vocproc_cal.cal_kvaddr =
+		cal_block->cal_offset + acdb_data.kvaddr;
 done:
 	return result;
 }
@@ -899,12 +835,9 @@
 		goto done;
 	}
 
-	cal_block->cal_size =
-		atomic_read(&acdb_data.vocproc_cal.cal_size);
-	cal_block->cal_paddr =
-		atomic_read(&acdb_data.vocproc_cal.cal_paddr);
-	cal_block->cal_kvaddr =
-		atomic_read(&acdb_data.vocproc_cal.cal_kvaddr);
+	cal_block->cal_size = acdb_data.vocproc_cal.cal_size;
+	cal_block->cal_paddr = acdb_data.vocproc_cal.cal_paddr;
+	cal_block->cal_kvaddr = acdb_data.vocproc_cal.cal_kvaddr;
 done:
 	return result;
 }
@@ -915,24 +848,19 @@
 	pr_debug("%s,\n", __func__);
 
 	if (cal_block->cal_offset >
-			atomic64_read(&acdb_data.mem_len)) {
-		pr_err("%s: offset %d is > mem_len %ld\n",
-			__func__, cal_block->cal_offset,
-			(long)atomic64_read(&acdb_data.mem_len));
-		atomic_set(&acdb_data.vocstrm_cal.cal_size, 0);
+			acdb_data.mem_len) {
+		pr_err("%s: offset %d is > mem_len %llu\n",
+			__func__, cal_block->cal_offset, acdb_data.mem_len);
+		acdb_data.vocstrm_cal.cal_size = 0;
 		result = -EINVAL;
 		goto done;
 	}
 
-	atomic_set(&acdb_data.vocstrm_cal.cal_size,
-		cal_block->cal_size);
-	atomic_set(&acdb_data.vocstrm_cal.cal_paddr,
-		cal_block->cal_offset +
-		atomic64_read(&acdb_data.paddr));
-	atomic_set(&acdb_data.vocstrm_cal.cal_kvaddr,
-		cal_block->cal_offset +
-		atomic64_read(&acdb_data.kvaddr));
-
+	acdb_data.vocstrm_cal.cal_size = cal_block->cal_size;
+	acdb_data.vocstrm_cal.cal_paddr =
+		cal_block->cal_offset + acdb_data.paddr;
+	acdb_data.vocstrm_cal.cal_kvaddr =
+		cal_block->cal_offset + acdb_data.kvaddr;
 done:
 	return result;
 }
@@ -948,12 +876,9 @@
 		goto done;
 	}
 
-	cal_block->cal_size =
-		atomic_read(&acdb_data.vocstrm_cal.cal_size);
-	cal_block->cal_paddr =
-		atomic_read(&acdb_data.vocstrm_cal.cal_paddr);
-	cal_block->cal_kvaddr =
-		atomic_read(&acdb_data.vocstrm_cal.cal_kvaddr);
+	cal_block->cal_size = acdb_data.vocstrm_cal.cal_size;
+	cal_block->cal_paddr = acdb_data.vocstrm_cal.cal_paddr;
+	cal_block->cal_kvaddr = acdb_data.vocstrm_cal.cal_kvaddr;
 done:
 	return result;
 }
@@ -963,25 +888,19 @@
 	int result = 0;
 	pr_debug("%s,\n", __func__);
 
-	if (cal_block->cal_offset >
-			atomic64_read(&acdb_data.mem_len)) {
-		pr_err("%s: offset %d is > mem_len %ld\n",
-			__func__, cal_block->cal_offset,
-			(long)atomic64_read(&acdb_data.mem_len));
-		atomic_set(&acdb_data.vocvol_cal.cal_size, 0);
+	if (cal_block->cal_offset > acdb_data.mem_len) {
+		pr_err("%s: offset %d is > mem_len %llu\n",
+			__func__, cal_block->cal_offset, acdb_data.mem_len);
+		acdb_data.vocvol_cal.cal_size = 0;
 		result = -EINVAL;
 		goto done;
 	}
 
-	atomic_set(&acdb_data.vocvol_cal.cal_size,
-		cal_block->cal_size);
-	atomic_set(&acdb_data.vocvol_cal.cal_paddr,
-		cal_block->cal_offset +
-		atomic64_read(&acdb_data.paddr));
-	atomic_set(&acdb_data.vocvol_cal.cal_kvaddr,
-		cal_block->cal_offset +
-		atomic64_read(&acdb_data.kvaddr));
-
+	acdb_data.vocvol_cal.cal_size = cal_block->cal_size;
+	acdb_data.vocvol_cal.cal_paddr =
+		cal_block->cal_offset + acdb_data.paddr;
+	acdb_data.vocvol_cal.cal_kvaddr =
+		cal_block->cal_offset + acdb_data.kvaddr;
 done:
 	return result;
 }
@@ -997,12 +916,9 @@
 		goto done;
 	}
 
-	cal_block->cal_size =
-		atomic_read(&acdb_data.vocvol_cal.cal_size);
-	cal_block->cal_paddr =
-		atomic_read(&acdb_data.vocvol_cal.cal_paddr);
-	cal_block->cal_kvaddr =
-		atomic_read(&acdb_data.vocvol_cal.cal_kvaddr);
+	cal_block->cal_size = acdb_data.vocvol_cal.cal_size;
+	cal_block->cal_paddr = acdb_data.vocvol_cal.cal_paddr;
+	cal_block->cal_kvaddr = acdb_data.vocvol_cal.cal_kvaddr;
 done:
 	return result;
 }
@@ -1011,8 +927,8 @@
 {
 	pr_debug("%s,\n", __func__);
 
-	atomic_set(&acdb_data.sidetone_cal.enable, cal_data->enable);
-	atomic_set(&acdb_data.sidetone_cal.gain, cal_data->gain);
+	acdb_data.sidetone_cal.enable = cal_data->enable;
+	acdb_data.sidetone_cal.gain = cal_data->gain;
 }
 
 int get_sidetone_cal(struct sidetone_cal *cal_data)
@@ -1026,8 +942,10 @@
 		goto done;
 	}
 
-	cal_data->enable = atomic_read(&acdb_data.sidetone_cal.enable);
-	cal_data->gain = atomic_read(&acdb_data.sidetone_cal.gain);
+	mutex_lock(&acdb_data.acdb_mutex);
+	cal_data->enable = acdb_data.sidetone_cal.enable;
+	cal_data->gain = acdb_data.sidetone_cal.gain;
+	mutex_unlock(&acdb_data.acdb_mutex);
 done:
 	return result;
 }
@@ -1111,14 +1029,15 @@
 	s32 result = 0;
 	pr_debug("%s\n", __func__);
 
-	if (atomic64_read(&acdb_data.mem_len)) {
+	mutex_lock(&acdb_data.acdb_mutex);
+	if (acdb_data.mem_len)
 		pr_debug("%s: ACDB opened but memory allocated, using existing allocation!\n",
 			__func__);
-	}
 
-	atomic_set(&acdb_data.valid_adm_custom_top, 1);
-	atomic_set(&acdb_data.valid_asm_custom_top, 1);
-	atomic_inc(&usage_count);
+	acdb_data.valid_adm_custom_top = 1;
+	acdb_data.valid_asm_custom_top = 1;
+	acdb_data.usage_count++;
+	mutex_unlock(&acdb_data.acdb_mutex);
 
 	return result;
 }
@@ -1195,30 +1114,31 @@
 	int	i;
 	pr_debug("%s\n", __func__);
 
-	mutex_lock(&acdb_data.acdb_mutex);
+	if (acdb_data.mem_len == 0)
+		goto done;
+
+	pr_debug("Remove existing memory\n");
+	acdb_data.mem_len = 0;
+
+	/* unmap all cal data */
+	result = unmap_cal_tables();
+	if (result < 0)
+		pr_err("%s: unmap_cal_tables failed, err = %d\n",
+			__func__, result);
+
+	msm_audio_ion_free(acdb_data.ion_client, acdb_data.ion_handle);
+	acdb_data.ion_client = NULL;
+	acdb_data.ion_handle = NULL;
+
+	for (i = 0; i < MAX_VOCPROC_TYPES; i++) {
+		kfree(acdb_data.col_data[i]);
+		acdb_data.col_data[i] = NULL;
+	}
+
 	kfree(acdb_data.hw_delay_tx.delay_info);
 	kfree(acdb_data.hw_delay_rx.delay_info);
-
-	if (atomic64_read(&acdb_data.mem_len)) {
-		/* unmap all cal data */
-		result = unmap_cal_tables();
-		if (result < 0)
-			pr_err("%s: unmap_cal_tables failed, err = %d\n",
-				__func__, result);
-
-		atomic64_set(&acdb_data.mem_len, 0);
-
-		for (i = 0; i < MAX_VOCPROC_TYPES; i++) {
-			kfree(acdb_data.col_data[i]);
-			acdb_data.col_data[i] = NULL;
-		}
-		msm_audio_ion_free(acdb_data.ion_client, acdb_data.ion_handle);
-		acdb_data.ion_client = NULL;
-		acdb_data.ion_handle = NULL;
-		mutex_unlock(&acdb_data.acdb_mutex);
-	}
-	mutex_unlock(&acdb_data.acdb_mutex);
-	return 0;
+done:
+	return result;
 }
 
 static int register_memory(void)
@@ -1231,42 +1151,38 @@
 	unsigned long		mem_len;
 	pr_debug("%s\n", __func__);
 
-	mutex_lock(&acdb_data.acdb_mutex);
-	allocate_hw_delay_entries();
-	for (i = 0; i < MAX_VOCPROC_TYPES; i++) {
-		acdb_data.col_data[i] = kmalloc(MAX_COL_SIZE, GFP_KERNEL);
-		atomic_set(&acdb_data.vocproc_col_cal[i].cal_kvaddr,
-			(uint32_t)acdb_data.col_data[i]);
-	}
-
 	result = msm_audio_ion_import("audio_acdb_client",
 				&acdb_data.ion_client,
 				&acdb_data.ion_handle,
-				atomic_read(&acdb_data.map_handle),
+				acdb_data.map_handle,
 				NULL, 0,
 				&paddr, (size_t *)&mem_len, &kvptr);
 	if (result) {
 		pr_err("%s: audio ION alloc failed, rc = %d\n",
 			__func__, result);
-		result = PTR_ERR(acdb_data.ion_client);
 		goto err_ion_handle;
 	}
-	kvaddr = (unsigned long)kvptr;
-	atomic64_set(&acdb_data.paddr, paddr);
-	atomic64_set(&acdb_data.kvaddr, kvaddr);
-	atomic64_set(&acdb_data.mem_len, mem_len);
-	mutex_unlock(&acdb_data.acdb_mutex);
 
-	pr_debug("%s done! paddr = 0x%lx, kvaddr = 0x%lx, len = x%lx\n",
-		 __func__,
-		(long)atomic64_read(&acdb_data.paddr),
-		(long)atomic64_read(&acdb_data.kvaddr),
-		(long)atomic64_read(&acdb_data.mem_len));
+	allocate_hw_delay_entries();
+
+	for (i = 0; i < MAX_VOCPROC_TYPES; i++) {
+		acdb_data.col_data[i] = kmalloc(MAX_COL_SIZE, GFP_KERNEL);
+		acdb_data.vocproc_col_cal[i].cal_kvaddr =
+			(uint32_t)acdb_data.col_data[i];
+	}
+
+	kvaddr = (unsigned long)kvptr;
+	acdb_data.paddr = paddr;
+	acdb_data.kvaddr = kvaddr;
+	acdb_data.mem_len = mem_len;
+
+	pr_debug("%s done! paddr = 0x%llx, kvaddr = 0x%llx, len = 0x%llx\n",
+		 __func__, acdb_data.paddr, acdb_data.kvaddr,
+		 acdb_data.mem_len);
 
 	return result;
 err_ion_handle:
-	atomic64_set(&acdb_data.mem_len, 0);
-	mutex_unlock(&acdb_data.acdb_mutex);
+	acdb_data.mem_len = 0;
 	return result;
 }
 static long acdb_ioctl(struct file *f,
@@ -1281,26 +1197,26 @@
 	struct msm_spk_prot_status acdb_spk_status;
 	pr_debug("%s\n", __func__);
 
+	mutex_lock(&acdb_data.acdb_mutex);
 	switch (cmd) {
 	case AUDIO_REGISTER_PMEM:
 		pr_debug("AUDIO_REGISTER_PMEM\n");
-		if (atomic_read(&acdb_data.mem_len)) {
-			deregister_memory();
-			pr_debug("Remove the existing memory\n");
-		}
+		result = deregister_memory();
+		if (result < 0)
+			pr_err("%s: deregister_memory failed returned %d!\n",
+				__func__, result);
 
 		if (copy_from_user(&map_fd, (void *)arg, sizeof(map_fd))) {
 			pr_err("%s: fail to copy memory handle!\n", __func__);
 			result = -EFAULT;
 		} else {
-			atomic_set(&acdb_data.map_handle, map_fd);
+			acdb_data.map_handle = map_fd;
 			result = register_memory();
 		}
 		goto done;
-
 	case AUDIO_DEREGISTER_PMEM:
 		pr_debug("AUDIO_DEREGISTER_PMEM\n");
-		deregister_memory();
+		result = deregister_memory();
 		goto done;
 	case AUDIO_SET_VOICE_RX_TOPOLOGY:
 		if (copy_from_user(&topology, (void *)arg,
@@ -1343,16 +1259,13 @@
 		store_asm_topology(topology);
 		goto done;
 	case AUDIO_SET_SPEAKER_PROT:
-		mutex_lock(&acdb_data.acdb_mutex);
 		if (copy_from_user(&acdb_data.spk_prot_cfg, (void *)arg,
 				sizeof(acdb_data.spk_prot_cfg))) {
 			pr_err("%s fail to copy spk_prot_cfg\n", __func__);
 			result = -EFAULT;
 		}
-		mutex_unlock(&acdb_data.acdb_mutex);
 		goto done;
 	case AUDIO_GET_SPEAKER_PROT:
-		mutex_lock(&acdb_data.acdb_mutex);
 		/*Indicates calibration was succesfull*/
 		if (acdb_data.spk_prot_cfg.mode == MSM_SPKR_PROT_CALIBRATED) {
 			prot_status.r0 = acdb_data.spk_prot_cfg.r0;
@@ -1379,7 +1292,6 @@
 			sizeof(prot_status))) {
 			pr_err("%s: Failed to update prot_status\n", __func__);
 		}
-		mutex_unlock(&acdb_data.acdb_mutex);
 		goto done;
 	case AUDIO_REGISTER_VOCPROC_VOL_TABLE:
 		result = register_vocvol_table();
@@ -1502,23 +1414,25 @@
 	}
 
 done:
+	mutex_unlock(&acdb_data.acdb_mutex);
 	return result;
 }
 
 static int acdb_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	int result = 0;
-	uint32_t size = vma->vm_end - vma->vm_start;
+	size_t size = vma->vm_end - vma->vm_start;
 
 	pr_debug("%s\n", __func__);
 
-	if (atomic64_read(&acdb_data.mem_len)) {
-		if (size <= atomic64_read(&acdb_data.mem_len)) {
+	mutex_lock(&acdb_data.acdb_mutex);
+	if (acdb_data.mem_len) {
+		if (size <= acdb_data.mem_len) {
 			vma->vm_page_prot = pgprot_noncached(
 						vma->vm_page_prot);
 			result = remap_pfn_range(vma,
 				vma->vm_start,
-				atomic64_read(&acdb_data.paddr) >> PAGE_SHIFT,
+				acdb_data.paddr >> PAGE_SHIFT,
 				size,
 				vma->vm_page_prot);
 		} else {
@@ -1529,25 +1443,29 @@
 		pr_err("%s: memory is not allocated, yet!\n", __func__);
 		result = -ENODEV;
 	}
+	mutex_unlock(&acdb_data.acdb_mutex);
 
 	return result;
 }
 
 static int acdb_release(struct inode *inode, struct file *f)
 {
-	s32 result = 0;
+	int result = 0;
+	pr_debug("%s\n", __func__);
 
-	atomic_dec(&usage_count);
-	atomic_read(&usage_count);
+	mutex_lock(&acdb_data.acdb_mutex);
+	acdb_data.usage_count--;
 
-	pr_debug("%s: ref count %d!\n", __func__,
-		atomic_read(&usage_count));
+	pr_debug("%s: ref count %d!\n", __func__, acdb_data.usage_count);
 
-	if (atomic_read(&usage_count) >= 1)
+	if (acdb_data.usage_count > 0) {
 		result = -EBUSY;
-	else
-		result = deregister_memory();
+		goto done;
+	}
 
+	result = deregister_memory();
+done:
+	mutex_unlock(&acdb_data.acdb_mutex);
 	return result;
 }
 
@@ -1571,9 +1489,9 @@
 	/*Speaker protection disabled*/
 	acdb_data.spk_prot_cfg.mode = MSM_SPKR_PROT_DISABLED;
 	mutex_init(&acdb_data.acdb_mutex);
-	atomic_set(&usage_count, 0);
-	atomic_set(&acdb_data.valid_adm_custom_top, 1);
-	atomic_set(&acdb_data.valid_asm_custom_top, 1);
+	acdb_data.usage_count = 0;
+	acdb_data.valid_adm_custom_top = 1;
+	acdb_data.valid_asm_custom_top = 1;
 
 	return misc_register(&acdb_misc);
 }
diff --git a/sound/soc/msm/qdsp6v2/audio_acdb.h b/sound/soc/msm/qdsp6v2/audio_acdb.h
index e2ca395..45a83f6 100644
--- a/sound/soc/msm/qdsp6v2/audio_acdb.h
+++ b/sound/soc/msm/qdsp6v2/audio_acdb.h
@@ -35,12 +35,6 @@
 	uint32_t		cal_paddr;
 };
 
-struct acdb_atomic_cal_block {
-	atomic_t		cal_size;
-	atomic_t		cal_kvaddr;
-	atomic_t		cal_paddr;
-};
-
 struct hw_delay_entry {
 	uint32_t sample_rate;
 	uint32_t delay_usec;
diff --git a/sound/soc/msm/qdsp6v2/audio_ocmem.c b/sound/soc/msm/qdsp6v2/audio_ocmem.c
index 93b3597..4a25606 100644
--- a/sound/soc/msm/qdsp6v2/audio_ocmem.c
+++ b/sound/soc/msm/qdsp6v2/audio_ocmem.c
@@ -879,6 +879,15 @@
 
 	pr_debug("%s\n", __func__);
 
+	audio_ocmem_lcl.audio_hdl = ocmem_notifier_register(OCMEM_LP_AUDIO,
+						&audio_ocmem_client_nb);
+	if (PTR_RET(audio_ocmem_lcl.audio_hdl) == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
+	else if (!audio_ocmem_lcl.audio_hdl) {
+		pr_err("%s: Failed to get ocmem handle %d\n", __func__,
+						OCMEM_LP_AUDIO);
+		return -ENODEV;
+	}
 	subsys_notif_register_notifier("adsp", &anb);
 
 	audio_ocmem_lcl.ocmem_dump_addr =
@@ -944,12 +953,6 @@
 		ret = -EFAULT;
 		goto destroy_voice_wq;
 	}
-	audio_ocmem_lcl.audio_hdl = ocmem_notifier_register(OCMEM_LP_AUDIO,
-						&audio_ocmem_client_nb);
-	if (audio_ocmem_lcl.audio_hdl == NULL) {
-		pr_err("%s: Failed to get ocmem handle %d\n", __func__,
-						OCMEM_LP_AUDIO);
-	}
 	audio_ocmem_lcl.lp_memseg_ptr = NULL;
 	return 0;
 destroy_voice_wq:
diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
index 11326f6..6f3f8ec 100644
--- a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
@@ -396,6 +396,18 @@
 									ret);
 		}
 	}
+	ret = snd_pcm_hw_constraint_step(runtime, 0,
+		SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 32);
+	if (ret < 0) {
+		pr_err("constraint for period bytes step ret = %d\n",
+								ret);
+	}
+	ret = snd_pcm_hw_constraint_step(runtime, 0,
+		SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 32);
+	if (ret < 0) {
+		pr_err("constraint for buffer bytes step ret = %d\n",
+								ret);
+	}
 
 	prtd->dsp_cnt = 0;
 	prtd->set_channel_map = false;
diff --git a/sound/soc/msm/qdsp6v2/q6adm.c b/sound/soc/msm/qdsp6v2/q6adm.c
index 27c74ce..3ee6f6e 100644
--- a/sound/soc/msm/qdsp6v2/q6adm.c
+++ b/sound/soc/msm/qdsp6v2/q6adm.c
@@ -1144,8 +1144,8 @@
 			open.dev_channel_mapping[1] = PCM_CHANNEL_FR;
 		} else if (channel_mode == 3)	{
 			open.dev_channel_mapping[0] = PCM_CHANNEL_FL;
-			open.dev_channel_mapping[0] = PCM_CHANNEL_FR;
-			open.dev_channel_mapping[1] = PCM_CHANNEL_FC;
+			open.dev_channel_mapping[1] = PCM_CHANNEL_FR;
+			open.dev_channel_mapping[2] = PCM_CHANNEL_FC;
 		} else if (channel_mode == 4) {
 			open.dev_channel_mapping[0] = PCM_CHANNEL_FL;
 			open.dev_channel_mapping[1] = PCM_CHANNEL_FR;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 55f8dc8..f3f9725 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3229,7 +3229,7 @@
 	mutex_init(&card->mutex);
 	mutex_init(&card->dpcm_mutex);
 	mutex_init(&card->dapm_power_mutex);
-
+	mutex_init(&card->dapm_mutex);
 	ret = snd_soc_instantiate_card(card);
 	if (ret != 0) {
 		soc_cleanup_card_debugfs(card);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 99047178..bc3f6a7 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1866,7 +1866,7 @@
 #endif
 
 /* test and update the power status of a mux widget */
-int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
+static int soc_dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
 				 struct snd_kcontrol *kcontrol, int change,
 				 int mux, struct soc_enum *e)
 {
@@ -1915,10 +1915,22 @@
 
 	return 0;
 }
+
+int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
+				 struct snd_kcontrol *kcontrol, int change,
+				 int mux, struct soc_enum *e)
+{
+	struct snd_soc_card *card = widget->dapm->card;
+	int ret;
+	mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+	ret = soc_dapm_mux_update_power(widget, kcontrol, change, mux, e);
+	mutex_unlock(&card->dapm_mutex);
+	return ret;
+}
 EXPORT_SYMBOL_GPL(snd_soc_dapm_mux_update_power);
 
 /* test and update the power status of a mixer or switch widget */
-int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
+static int soc_dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
 				   struct snd_kcontrol *kcontrol, int connect)
 {
 	struct snd_soc_dapm_path *path;
@@ -1952,6 +1964,17 @@
 
 	return 0;
 }
+
+int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
+				   struct snd_kcontrol *kcontrol, int connect)
+{
+	struct snd_soc_card *card = widget->dapm->card;
+	int ret;
+	mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+	ret = soc_dapm_mixer_update_power(widget, kcontrol, connect);
+	mutex_unlock(&card->dapm_mutex);
+	return ret;
+}
 EXPORT_SYMBOL_GPL(snd_soc_dapm_mixer_update_power);
 
 /* show dapm widget status in sys fs */
@@ -2108,6 +2131,8 @@
  */
 int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm)
 {
+	int ret;
+
 	/*
 	 * Suppress early reports (eg, jacks syncing their state) to avoid
 	 * silly DAPM runs during card startup.
@@ -2115,7 +2140,10 @@
 	if (!dapm->card || !dapm->card->instantiated)
 		return 0;
 
-	return dapm_power_widgets(dapm, SND_SOC_DAPM_STREAM_NOP);
+	mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_PCM);
+	ret = dapm_power_widgets(dapm, SND_SOC_DAPM_STREAM_NOP);
+	mutex_unlock(&dapm->card->dapm_mutex);
+	return ret;
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_sync);
 
@@ -2279,6 +2307,7 @@
 {
 	int i, ret;
 
+	mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
 	for (i = 0; i < num; i++) {
 		ret = snd_soc_dapm_add_route(dapm, route);
 		if (ret < 0) {
@@ -2288,6 +2317,7 @@
 		}
 		route++;
 	}
+	mutex_unlock(&dapm->card->dapm_mutex);
 
 	return 0;
 }
@@ -2360,12 +2390,14 @@
 	int i, err;
 	int ret = 0;
 
+	mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
 	for (i = 0; i < num; i++) {
 		err = snd_soc_dapm_weak_route(dapm, route);
 		if (err)
 			ret = err;
 		route++;
 	}
+	mutex_unlock(&dapm->card->dapm_mutex);
 
 	return ret;
 }
@@ -2384,6 +2416,8 @@
 	struct snd_soc_dapm_widget *w;
 	unsigned int val;
 
+	mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
+
 	list_for_each_entry(w, &dapm->card->widgets, list)
 	{
 		if (w->new)
@@ -2393,8 +2427,10 @@
 			w->kcontrols = kzalloc(w->num_kcontrols *
 						sizeof(struct snd_kcontrol *),
 						GFP_KERNEL);
-			if (!w->kcontrols)
+			if (!w->kcontrols) {
+				mutex_unlock(&dapm->card->dapm_mutex);
 				return -ENOMEM;
+			}
 		}
 
 		switch(w->id) {
@@ -2434,6 +2470,7 @@
 	}
 
 	dapm_power_widgets(dapm, SND_SOC_DAPM_STREAM_NOP);
+	mutex_unlock(&dapm->card->dapm_mutex);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets);
@@ -2493,6 +2530,7 @@
 	struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
 	struct snd_soc_dapm_widget *widget = wlist->widgets[0];
 	struct snd_soc_codec *codec = widget->codec;
+	struct snd_soc_card *card = codec->card;
 	struct soc_mixer_control *mc =
 		(struct soc_mixer_control *)kcontrol->private_value;
 	unsigned int reg = mc->reg;
@@ -2519,7 +2557,7 @@
 		/* old connection must be powered down */
 		connect = invert ? 1 : 0;
 
-	mutex_lock(&codec->mutex);
+	mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_PCM);
 
 	change = snd_soc_test_bits(widget->codec, reg, mask, val);
 	if (change) {
@@ -2535,13 +2573,13 @@
 			update.val = val;
 			widget->dapm->update = &update;
 
-			snd_soc_dapm_mixer_update_power(widget, kcontrol, connect);
+			soc_dapm_mixer_update_power(widget, kcontrol, connect);
 
 			widget->dapm->update = NULL;
 		}
 	}
 
-	mutex_unlock(&codec->mutex);
+	mutex_unlock(&card->dapm_mutex);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw);
@@ -2590,6 +2628,7 @@
 	struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
 	struct snd_soc_dapm_widget *widget = wlist->widgets[0];
 	struct snd_soc_codec *codec = widget->codec;
+	struct snd_soc_card *card = codec->card;
 	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
 	unsigned int val, mux, change;
 	unsigned int mask, bitmask;
@@ -2610,7 +2649,7 @@
 		mask |= (bitmask - 1) << e->shift_r;
 	}
 
-	mutex_lock(&codec->mutex);
+	mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_PCM);
 
 	change = snd_soc_test_bits(widget->codec, e->reg, mask, val);
 	if (change) {
@@ -2626,13 +2665,13 @@
 			update.val = val;
 			widget->dapm->update = &update;
 
-			snd_soc_dapm_mux_update_power(widget, kcontrol, change, mux, e);
+			soc_dapm_mux_update_power(widget, kcontrol, change, mux, e);
 
 			widget->dapm->update = NULL;
 		}
 	}
 
-	mutex_unlock(&codec->mutex);
+	mutex_unlock(&card->dapm_mutex);
 	return change;
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_double);
@@ -2669,6 +2708,7 @@
 	struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
 	struct snd_soc_dapm_widget *widget = wlist->widgets[0];
 	struct snd_soc_codec *codec = widget->codec;
+	struct snd_soc_card *card = codec->card;
 	struct soc_enum *e =
 		(struct soc_enum *)kcontrol->private_value;
 	int change;
@@ -2678,7 +2718,7 @@
 	if (ucontrol->value.enumerated.item[0] >= e->max)
 		return -EINVAL;
 
-	mutex_lock(&codec->mutex);
+	mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_PCM);
 
 	change = widget->value != ucontrol->value.enumerated.item[0];
 	if (change) {
@@ -2687,12 +2727,12 @@
 
 			widget->value = ucontrol->value.enumerated.item[0];
 
-			snd_soc_dapm_mux_update_power(widget, kcontrol, change,
+			soc_dapm_mux_update_power(widget, kcontrol, change,
 					widget->value, e);
 		}
 	}
 
-	mutex_unlock(&codec->mutex);
+	mutex_unlock(&card->dapm_mutex);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_virt);
@@ -2757,6 +2797,7 @@
 	struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
 	struct snd_soc_dapm_widget *widget = wlist->widgets[0];
 	struct snd_soc_codec *codec = widget->codec;
+	struct snd_soc_card *card = codec->card;
 	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
 	unsigned int val, mux, change;
 	unsigned int mask;
@@ -2775,7 +2816,7 @@
 		mask |= e->mask << e->shift_r;
 	}
 
-	mutex_lock(&codec->mutex);
+	mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_PCM);
 
 	change = snd_soc_test_bits(widget->codec, e->reg, mask, val);
 	if (change) {
@@ -2791,13 +2832,13 @@
 			update.val = val;
 			widget->dapm->update = &update;
 
-			snd_soc_dapm_mux_update_power(widget, kcontrol, change, mux, e);
+			soc_dapm_mux_update_power(widget, kcontrol, change, mux, e);
 
 			widget->dapm->update = NULL;
 		}
 	}
 
-	mutex_unlock(&codec->mutex);
+	mutex_unlock(&card->dapm_mutex);
 	return change;
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_put_value_enum_double);
@@ -2831,15 +2872,15 @@
 int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
 				struct snd_ctl_elem_value *ucontrol)
 {
-	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+	struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
 	const char *pin = (const char *)kcontrol->private_value;
 
-	mutex_lock(&codec->mutex);
+	mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_PCM);
 
 	ucontrol->value.integer.value[0] =
-		snd_soc_dapm_get_pin_status(&codec->dapm, pin);
+		snd_soc_dapm_get_pin_status(&card->dapm, pin);
 
-	mutex_unlock(&codec->mutex);
+	mutex_unlock(&card->dapm_mutex);
 
 	return 0;
 }
@@ -2854,20 +2895,19 @@
 int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
 				struct snd_ctl_elem_value *ucontrol)
 {
-	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+	struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
 	const char *pin = (const char *)kcontrol->private_value;
 
-	mutex_lock(&codec->mutex);
+	mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_PCM);
 
 	if (ucontrol->value.integer.value[0])
-		snd_soc_dapm_enable_pin(&codec->dapm, pin);
+		snd_soc_dapm_enable_pin(&card->dapm, pin);
 	else
-		snd_soc_dapm_disable_pin(&codec->dapm, pin);
+		snd_soc_dapm_disable_pin(&card->dapm, pin);
 
-	snd_soc_dapm_sync(&codec->dapm);
+	mutex_unlock(&card->dapm_mutex);
 
-	mutex_unlock(&codec->mutex);
-
+	snd_soc_dapm_sync(&card->dapm);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_put_pin_switch);
@@ -2975,6 +3015,7 @@
 {
 	int i, ret;
 
+	mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
 	for (i = 0; i < num; i++) {
 		ret = snd_soc_dapm_new_control(dapm, widget);
 		if (ret < 0) {
@@ -2985,6 +3026,7 @@
 		}
 		widget++;
 	}
+	mutex_unlock(&dapm->card->dapm_mutex);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_new_controls);
@@ -3099,7 +3141,6 @@
 	mutex_lock(&codec->mutex);
 	soc_dapm_stream_event(&codec->dapm, stream, event);
 	mutex_unlock(&codec->mutex);
-
 	return 0;
 }