Staging: dream: remove dream driver and arch from tree
Greg Kroah-Hartman [Fri, 29 Oct 2010 19:42:18 +0000 (12:42 -0700)]
This code is stalled, with no one working on it anymore, and the main
msm code is now going through the proper channels to get merged
correctly.

So remove it as it contains a number of kernel information leaks and it
is doubtful if it even still builds anymore.

Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Bryan Huntsman <bryanh@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

93 files changed:
drivers/staging/Kconfig
drivers/staging/Makefile
drivers/staging/dream/Kconfig [deleted file]
drivers/staging/dream/Makefile [deleted file]
drivers/staging/dream/TODO [deleted file]
drivers/staging/dream/camera/Kconfig [deleted file]
drivers/staging/dream/camera/Makefile [deleted file]
drivers/staging/dream/camera/msm_camera.c [deleted file]
drivers/staging/dream/camera/msm_io7x.c [deleted file]
drivers/staging/dream/camera/msm_io8x.c [deleted file]
drivers/staging/dream/camera/msm_v4l2.c [deleted file]
drivers/staging/dream/camera/msm_vfe7x.c [deleted file]
drivers/staging/dream/camera/msm_vfe7x.h [deleted file]
drivers/staging/dream/camera/msm_vfe8x.c [deleted file]
drivers/staging/dream/camera/msm_vfe8x.h [deleted file]
drivers/staging/dream/camera/msm_vfe8x_proc.c [deleted file]
drivers/staging/dream/camera/msm_vfe8x_proc.h [deleted file]
drivers/staging/dream/camera/mt9d112.c [deleted file]
drivers/staging/dream/camera/mt9d112.h [deleted file]
drivers/staging/dream/camera/mt9d112_reg.c [deleted file]
drivers/staging/dream/camera/mt9p012.h [deleted file]
drivers/staging/dream/camera/mt9p012_fox.c [deleted file]
drivers/staging/dream/camera/mt9p012_reg.c [deleted file]
drivers/staging/dream/camera/mt9t013.c [deleted file]
drivers/staging/dream/camera/mt9t013.h [deleted file]
drivers/staging/dream/camera/mt9t013_reg.c [deleted file]
drivers/staging/dream/camera/s5k3e2fx.c [deleted file]
drivers/staging/dream/camera/s5k3e2fx.h [deleted file]
drivers/staging/dream/generic_gpio.c [deleted file]
drivers/staging/dream/gpio_axis.c [deleted file]
drivers/staging/dream/gpio_event.c [deleted file]
drivers/staging/dream/gpio_input.c [deleted file]
drivers/staging/dream/gpio_matrix.c [deleted file]
drivers/staging/dream/gpio_output.c [deleted file]
drivers/staging/dream/include/linux/android_pmem.h [deleted file]
drivers/staging/dream/include/linux/gpio_event.h [deleted file]
drivers/staging/dream/include/linux/msm_adsp.h [deleted file]
drivers/staging/dream/include/linux/msm_audio.h [deleted file]
drivers/staging/dream/include/linux/msm_rpcrouter.h [deleted file]
drivers/staging/dream/include/linux/wakelock.h [deleted file]
drivers/staging/dream/include/mach/camera.h [deleted file]
drivers/staging/dream/include/mach/msm_adsp.h [deleted file]
drivers/staging/dream/include/mach/msm_rpcrouter.h [deleted file]
drivers/staging/dream/include/mach/msm_smd.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5audplaycmdi.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5audplaymsg.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5audppcmdi.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5audppmsg.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5audpreproccmdi.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5audpreprocmsg.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5audreccmdi.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5audrecmsg.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5jpegcmdi.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5jpegmsg.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5lpmcmdi.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5lpmmsg.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5vdeccmdi.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5vdecmsg.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5venccmdi.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5vfecmdi.h [deleted file]
drivers/staging/dream/include/mach/qdsp5/qdsp5vfemsg.h [deleted file]
drivers/staging/dream/include/media/msm_camera.h [deleted file]
drivers/staging/dream/pmem.c [deleted file]
drivers/staging/dream/qdsp5/Makefile [deleted file]
drivers/staging/dream/qdsp5/adsp.c [deleted file]
drivers/staging/dream/qdsp5/adsp.h [deleted file]
drivers/staging/dream/qdsp5/adsp_6210.c [deleted file]
drivers/staging/dream/qdsp5/adsp_6220.c [deleted file]
drivers/staging/dream/qdsp5/adsp_6225.c [deleted file]
drivers/staging/dream/qdsp5/adsp_driver.c [deleted file]
drivers/staging/dream/qdsp5/adsp_info.c [deleted file]
drivers/staging/dream/qdsp5/adsp_jpeg_patch_event.c [deleted file]
drivers/staging/dream/qdsp5/adsp_jpeg_verify_cmd.c [deleted file]
drivers/staging/dream/qdsp5/adsp_lpm_verify_cmd.c [deleted file]
drivers/staging/dream/qdsp5/adsp_vfe_patch_event.c [deleted file]
drivers/staging/dream/qdsp5/adsp_vfe_verify_cmd.c [deleted file]
drivers/staging/dream/qdsp5/adsp_video_verify_cmd.c [deleted file]
drivers/staging/dream/qdsp5/adsp_videoenc_verify_cmd.c [deleted file]
drivers/staging/dream/qdsp5/audio_aac.c [deleted file]
drivers/staging/dream/qdsp5/audio_amrnb.c [deleted file]
drivers/staging/dream/qdsp5/audio_evrc.c [deleted file]
drivers/staging/dream/qdsp5/audio_in.c [deleted file]
drivers/staging/dream/qdsp5/audio_mp3.c [deleted file]
drivers/staging/dream/qdsp5/audio_out.c [deleted file]
drivers/staging/dream/qdsp5/audio_qcelp.c [deleted file]
drivers/staging/dream/qdsp5/audmgr.c [deleted file]
drivers/staging/dream/qdsp5/audmgr.h [deleted file]
drivers/staging/dream/qdsp5/audmgr_new.h [deleted file]
drivers/staging/dream/qdsp5/audpp.c [deleted file]
drivers/staging/dream/qdsp5/evlog.h [deleted file]
drivers/staging/dream/qdsp5/snd.c [deleted file]
drivers/staging/dream/synaptics_i2c_rmi.c [deleted file]
drivers/staging/dream/synaptics_i2c_rmi.h [deleted file]

index f9c9c8a..5eafdf4 100644 (file)
@@ -87,8 +87,6 @@ source "drivers/staging/rtl8712/Kconfig"
 
 source "drivers/staging/frontier/Kconfig"
 
-source "drivers/staging/dream/Kconfig"
-
 source "drivers/staging/pohmelfs/Kconfig"
 
 source "drivers/staging/autofs/Kconfig"
index a85074f..a97a955 100644 (file)
@@ -28,7 +28,6 @@ obj-$(CONFIG_RTL8192E)                += rtl8192e/
 obj-$(CONFIG_R8712U)           += rtl8712/
 obj-$(CONFIG_SPECTRA)          += spectra/
 obj-$(CONFIG_TRANZPORT)                += frontier/
-obj-$(CONFIG_DREAM)            += dream/
 obj-$(CONFIG_POHMELFS)         += pohmelfs/
 obj-$(CONFIG_AUTOFS_FS)                += autofs/
 obj-$(CONFIG_IDE_PHISON)       += phison/
diff --git a/drivers/staging/dream/Kconfig b/drivers/staging/dream/Kconfig
deleted file mode 100644 (file)
index 0c30b19..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-config DREAM
-       tristate "HTC Dream support"
-       depends on MACH_TROUT
-
-if DREAM
-
-source "drivers/staging/dream/camera/Kconfig"
-
-config INPUT_GPIO
-       tristate "GPIO driver support"
-       help
-         Say Y here if you want to support gpio based keys, wheels etc...
-endif
diff --git a/drivers/staging/dream/Makefile b/drivers/staging/dream/Makefile
deleted file mode 100644 (file)
index 87de1a5..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-ccflags-y:=-Idrivers/staging/dream/include
-obj-$(CONFIG_MSM_ADSP)         += qdsp5/
-obj-$(CONFIG_MSM_CAMERA)       += camera/
-obj-$(CONFIG_INPUT_GPIO)       += gpio_axis.o gpio_event.o gpio_input.o gpio_matrix.o gpio_output.o
-
diff --git a/drivers/staging/dream/TODO b/drivers/staging/dream/TODO
deleted file mode 100644 (file)
index dcd3ba8..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-
-* camera driver uses old V4L API
-
-* coding style in some places is lacking
-
-* gpio_input.c has some features matrix_keypad lacks. They should be
-merged to gpio_input, with gpio_input.c removed
-
-* pmem provides interface for userspace. Needs to be reviewed at least.
-
-* it is probably possible to simplify touchscreen driver using threaded_irq's.
-
-* touchscreen driver should be switched to oficial multitouch API
diff --git a/drivers/staging/dream/camera/Kconfig b/drivers/staging/dream/camera/Kconfig
deleted file mode 100644 (file)
index bfb6d24..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-comment "Qualcomm MSM Camera And Video"
-
-menuconfig MSM_CAMERA
-       bool "Qualcomm MSM camera and video capture support"
-       depends on ARCH_MSM && VIDEO_V4L2_COMMON
-       help
-         Say Y here to enable selecting the video adapters for
-         Qualcomm msm camera and video encoding
-
-config MSM_CAMERA_DEBUG
-       bool "Qualcomm MSM camera debugging with printk"
-       depends on MSM_CAMERA
-       help
-         Enable printk() debug for msm camera
-
-config MSM_CAMERA_FLASH
-       bool "Qualcomm MSM camera flash support"
-       depends on MSM_CAMERA && BROKEN
-       ---help---
-         Enable support for LED flash for msm camera
-
-
-comment "Camera Sensor Selection"
-config MT9T013
-       bool "Sensor mt9t013 (BAYER 3M)"
-       depends on MSM_CAMERA
-       ---help---
-         MICRON 3M Bayer Sensor with AutoFocus
-
-config MT9D112
-       bool "Sensor mt9d112 (YUV 2M)"
-       depends on MSM_CAMERA
-       ---help---
-         MICRON 2M YUV Sensor
-
-config MT9P012
-       bool "Sensor mt9p012 (BAYER 5M)"
-       depends on MSM_CAMERA
-       ---help---
-         MICRON 5M Bayer Sensor with Autofocus
-
-config S5K3E2FX
-       bool "Sensor s5k3e2fx (Samsung 5M)"
-       depends on MSM_CAMERA
-       ---help---
-         Samsung 5M with Autofocus
diff --git a/drivers/staging/dream/camera/Makefile b/drivers/staging/dream/camera/Makefile
deleted file mode 100644 (file)
index 03711dc..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-ccflags-y:=-Idrivers/staging/dream/include
-obj-$(CONFIG_MT9T013) += mt9t013.o mt9t013_reg.o
-obj-$(CONFIG_MT9D112) += mt9d112.o mt9d112_reg.o
-obj-$(CONFIG_MT9P012) += mt9p012_fox.o mt9p012_reg.o
-obj-$(CONFIG_MSM_CAMERA) += msm_camera.o msm_v4l2.o
-obj-$(CONFIG_S5K3E2FX) += s5k3e2fx.o
-obj-$(CONFIG_ARCH_MSM) += msm_vfe7x.o msm_io7x.o
-obj-$(CONFIG_ARCH_QSD) += msm_vfe8x.o msm_vfe8x_proc.o msm_io8x.o
diff --git a/drivers/staging/dream/camera/msm_camera.c b/drivers/staging/dream/camera/msm_camera.c
deleted file mode 100644 (file)
index de4ab61..0000000
+++ /dev/null
@@ -1,2181 +0,0 @@
-/*
- * Copyright (C) 2008-2009 QUALCOMM Incorporated.
- */
-
-/* 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/kernel.h>
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/sched.h>
-#include <mach/board.h>
-
-#include <linux/fs.h>
-#include <linux/list.h>
-#include <linux/uaccess.h>
-#include <linux/android_pmem.h>
-#include <linux/poll.h>
-#include <media/msm_camera.h>
-#include <mach/camera.h>
-
-#define MSM_MAX_CAMERA_SENSORS 5
-
-#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)
-
-static struct class *msm_class;
-static dev_t msm_devno;
-static LIST_HEAD(msm_sensors);
-
-#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;                                                    \
-})
-
-#define MSM_DRAIN_QUEUE_NOSYNC(sync, name) do {                        \
-       struct msm_queue_cmd *qcmd = NULL;                      \
-       CDBG("%s: draining queue "#name"\n", __func__);         \
-       while (!list_empty(&(sync)->name)) {                    \
-               qcmd = list_first_entry(&(sync)->name,          \
-                       struct msm_queue_cmd, list);            \
-               list_del_init(&qcmd->list);                     \
-               kfree(qcmd);                                    \
-       };                                                      \
-} while (0)
-
-#define MSM_DRAIN_QUEUE(sync, name) do {                       \
-       unsigned long flags;                                    \
-       spin_lock_irqsave(&(sync)->name##_lock, flags);         \
-       MSM_DRAIN_QUEUE_NOSYNC(sync, name);                     \
-       spin_unlock_irqrestore(&(sync)->name##_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)) {
-                       printk(KERN_ERR
-                               " 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 msm_pmem_table_add(struct hlist_head *ptype,
-       struct msm_pmem_info *info)
-{
-       struct file *file;
-       unsigned long paddr;
-       unsigned long vstart;
-       unsigned long len;
-       int rc;
-       struct msm_pmem_region *region;
-
-       rc = get_pmem_file(info->fd, &paddr, &vstart, &len, &file);
-       if (rc < 0) {
-               pr_err("msm_pmem_table_add: get_pmem_file fd %d error %d\n",
-                       info->fd, rc);
-               return rc;
-       }
-
-       if (check_overlap(ptype, paddr, len) < 0)
-               return -EINVAL;
-
-       CDBG("%s: type = %d, paddr = 0x%lx, vaddr = 0x%lx\n",
-               __func__,
-               info->type, paddr, (unsigned long)info->vaddr);
-
-       region = kmalloc(sizeof(*region), GFP_KERNEL);
-       if (!region)
-               return -ENOMEM;
-
-       INIT_HLIST_NODE(&region->list);
-
-       region->type = info->type;
-       region->vaddr = info->vaddr;
-       region->paddr = paddr;
-       region->len = len;
-       region->file = file;
-       region->y_off = info->y_off;
-       region->cbcr_off = info->cbcr_off;
-       region->fd = info->fd;
-       region->active = info->active;
-
-       hlist_add_head(&(region->list), ptype);
-
-       return 0;
-}
-
-/* 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)
-{
-       struct msm_pmem_region *region;
-       struct msm_pmem_region *regptr;
-       struct hlist_node *node, *n;
-
-       uint8_t rc = 0;
-
-       regptr = reg;
-
-       hlist_for_each_entry_safe(region, node, n, ptype, list) {
-               if (region->type == pmem_type && region->active) {
-                       *regptr = *region;
-                       rc += 1;
-                       if (rc >= maxcount)
-                               break;
-                       regptr++;
-               }
-       }
-
-       return rc;
-}
-
-static unsigned long msm_pmem_frame_ptov_lookup(struct msm_sync *sync,
-               unsigned long pyaddr,
-               unsigned long pcbcraddr,
-               uint32_t *yoff, uint32_t *cbcroff, int *fd)
-{
-       struct msm_pmem_region *region;
-       struct hlist_node *node, *n;
-
-       hlist_for_each_entry_safe(region, node, n, &sync->frame, list) {
-               if (pyaddr == (region->paddr + region->y_off) &&
-                               pcbcraddr == (region->paddr +
-                                               region->cbcr_off) &&
-                               region->active) {
-                       /* offset since we could pass vaddr inside
-                        * a registerd pmem buffer
-                        */
-                       *yoff = region->y_off;
-                       *cbcroff = region->cbcr_off;
-                       *fd = region->fd;
-                       region->active = 0;
-                       return (unsigned long)(region->vaddr);
-               }
-       }
-
-       return 0;
-}
-
-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;
-
-       hlist_for_each_entry_safe(region, node, n, &sync->stats, list) {
-               if (addr == region->paddr && region->active) {
-                       /* offset since we could pass vaddr inside a
-                        * registered pmem buffer */
-                       *fd = region->fd;
-                       region->active = 0;
-                       return (unsigned long)(region->vaddr);
-               }
-       }
-
-       return 0;
-}
-
-static unsigned long msm_pmem_frame_vtop_lookup(struct msm_sync *sync,
-               unsigned long buffer,
-               uint32_t yoff, uint32_t cbcroff, int fd)
-{
-       struct msm_pmem_region *region;
-       struct hlist_node *node, *n;
-
-       hlist_for_each_entry_safe(region,
-               node, n, &sync->frame, list) {
-               if (((unsigned long)(region->vaddr) == buffer) &&
-                               (region->y_off == yoff) &&
-                               (region->cbcr_off == cbcroff) &&
-                               (region->fd == fd) &&
-                               (region->active == 0)) {
-
-                       region->active = 1;
-                       return region->paddr;
-               }
-       }
-
-       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;
-
-       hlist_for_each_entry_safe(region, node, n, &sync->stats, list) {
-               if (((unsigned long)(region->vaddr) == buffer) &&
-                               (region->fd == fd) && region->active == 0) {
-                       region->active = 1;
-                       return region->paddr;
-               }
-       }
-
-       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;
-
-       switch (pinfo->type) {
-       case MSM_PMEM_OUTPUT1:
-       case MSM_PMEM_OUTPUT2:
-       case MSM_PMEM_THUMBAIL:
-       case MSM_PMEM_MAINIMG:
-       case MSM_PMEM_RAW_MAINIMG:
-               hlist_for_each_entry_safe(region, node, n,
-                       &sync->frame, list) {
-
-                       if (pinfo->type == region->type &&
-                                       pinfo->vaddr == region->vaddr &&
-                                       pinfo->fd == region->fd) {
-                               hlist_del(node);
-                               put_pmem_file(region->file);
-                               kfree(region);
-                       }
-               }
-               break;
-
-       case MSM_PMEM_AEC_AWB:
-       case MSM_PMEM_AF:
-               hlist_for_each_entry_safe(region, node, n,
-                       &sync->stats, list) {
-
-                       if (pinfo->type == region->type &&
-                                       pinfo->vaddr == region->vaddr &&
-                                       pinfo->fd == region->fd) {
-                               hlist_del(node);
-                               put_pmem_file(region->file);
-                               kfree(region);
-                       }
-               }
-               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)
-{
-       unsigned long flags;
-       int rc = 0;
-
-       struct msm_queue_cmd *qcmd = NULL;
-       struct msm_vfe_phy_info *pphy;
-
-       spin_lock_irqsave(&sync->prev_frame_q_lock, flags);
-       if (!list_empty(&sync->prev_frame_q)) {
-               qcmd = list_first_entry(&sync->prev_frame_q,
-                       struct msm_queue_cmd, list);
-               list_del_init(&qcmd->list);
-       }
-       spin_unlock_irqrestore(&sync->prev_frame_q_lock, flags);
-
-       if (!qcmd) {
-               pr_err("%s: no preview frame.\n", __func__);
-               return -EAGAIN;
-       }
-
-       pphy = (struct msm_vfe_phy_info *)(qcmd->command);
-
-       frame->buffer =
-               msm_pmem_frame_ptov_lookup(sync,
-                       pphy->y_phy,
-                       pphy->cbcr_phy, &(frame->y_off),
-                       &(frame->cbcr_off), &(frame->fd));
-       if (!frame->buffer) {
-               pr_err("%s: cannot get frame, invalid lookup address "
-                       "y=%x cbcr=%x offset=%d\n",
-                       __func__,
-                       pphy->y_phy,
-                       pphy->cbcr_phy,
-                       frame->y_off);
-               rc = -EINVAL;
-       }
-
-       CDBG("__msm_get_frame: y=0x%x, cbcr=0x%x, qcmd=0x%x, virt_addr=0x%x\n",
-               pphy->y_phy, pphy->cbcr_phy, (int) qcmd, (int) frame->buffer);
-
-       kfree(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;
-
-       if (sync->croplen) {
-               if (frame.croplen > sync->croplen) {
-                       pr_err("msm_get_frame: invalid frame croplen %d\n",
-                               frame.croplen);
-                       return -EINVAL;
-               }
-
-               if (copy_to_user((void *)frame.cropinfo,
-                               sync->cropinfo,
-                               sync->croplen)) {
-                       ERR_COPY_TO_USER();
-                       return -EFAULT;
-               }
-       }
-
-       if (copy_to_user((void *)arg,
-                               &frame, sizeof(struct msm_frame))) {
-               ERR_COPY_TO_USER();
-               rc = -EFAULT;
-       }
-
-       CDBG("Got frame!!!\n");
-
-       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);
-
-       CDBG("msm_enable_vfe: returned rc = %d\n", rc);
-       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);
-
-       CDBG("msm_disable_vfe: returned rc = %d\n", rc);
-       return rc;
-}
-
-static struct msm_queue_cmd *__msm_control(struct msm_sync *sync,
-               struct msm_control_device_queue *queue,
-               struct msm_queue_cmd *qcmd,
-               int timeout)
-{
-       unsigned long flags;
-       int rc;
-
-       spin_lock_irqsave(&sync->msg_event_q_lock, flags);
-       list_add_tail(&qcmd->list, &sync->msg_event_q);
-       /* wake up config thread */
-       wake_up(&sync->msg_event_wait);
-       spin_unlock_irqrestore(&sync->msg_event_q_lock, flags);
-
-       if (!queue)
-               return NULL;
-
-       /* wait for config status */
-       rc = wait_event_interruptible_timeout(
-                       queue->ctrl_status_wait,
-                       !list_empty_careful(&queue->ctrl_status_q),
-                       timeout);
-       if (list_empty_careful(&queue->ctrl_status_q)) {
-               if (!rc)
-                       rc = -ETIMEDOUT;
-               if (rc < 0) {
-                       pr_err("msm_control: wait_event error %d\n", rc);
-#if 0
-                       /* This is a bit scary.  If we time out too early, we
-                        * will free qcmd at the end of this function, and the
-                        * dsp may do the same when it does respond, so we
-                        * remove the message from the source queue.
-                        */
-                       pr_err("%s: error waiting for ctrl_status_q: %d\n",
-                               __func__, rc);
-                       spin_lock_irqsave(&sync->msg_event_q_lock, flags);
-                       list_del_init(&qcmd->list);
-                       spin_unlock_irqrestore(&sync->msg_event_q_lock, flags);
-#endif
-                       return ERR_PTR(rc);
-               }
-       }
-
-       /* control command status is ready */
-       spin_lock_irqsave(&queue->ctrl_status_q_lock, flags);
-       BUG_ON(list_empty(&queue->ctrl_status_q));
-       qcmd = list_first_entry(&queue->ctrl_status_q,
-                       struct msm_queue_cmd, list);
-       list_del_init(&qcmd->list);
-       spin_unlock_irqrestore(&queue->ctrl_status_q_lock, flags);
-
-       return qcmd;
-}
-
-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;
-       struct msm_ctrl_cmd udata, *ctrlcmd;
-       struct msm_queue_cmd *qcmd = NULL, *qcmd_temp;
-
-       if (copy_from_user(&udata, arg, sizeof(struct msm_ctrl_cmd))) {
-               ERR_COPY_FROM_USER();
-               rc = -EFAULT;
-               goto end;
-       }
-
-       qcmd = kmalloc(sizeof(struct msm_queue_cmd) +
-                               sizeof(struct msm_ctrl_cmd) + udata.length,
-                               GFP_KERNEL);
-       if (!qcmd) {
-               pr_err("msm_control: cannot allocate buffer\n");
-               rc = -ENOMEM;
-               goto end;
-       }
-
-       qcmd->type = MSM_CAM_Q_CTRL;
-       qcmd->command = ctrlcmd = (struct msm_ctrl_cmd *)(qcmd + 1);
-       *ctrlcmd = udata;
-       ctrlcmd->value = ctrlcmd + 1;
-
-       if (udata.length) {
-               if (copy_from_user(ctrlcmd->value,
-                               udata.value, udata.length)) {
-                       ERR_COPY_FROM_USER();
-                       rc = -EFAULT;
-                       goto end;
-               }
-       }
-
-       if (!block) {
-               /* qcmd will be set to NULL */
-               qcmd = __msm_control(sync, NULL, qcmd, 0);
-               goto end;
-       }
-
-       qcmd_temp = __msm_control(sync,
-                                 &ctrl_pmsm->ctrl_q,
-                                 qcmd, MAX_SCHEDULE_TIMEOUT);
-
-       if (IS_ERR(qcmd_temp)) {
-               rc = PTR_ERR(qcmd_temp);
-               goto end;
-       }
-       qcmd = qcmd_temp;
-
-       if (qcmd->command) {
-               void __user *to = udata.value;
-               udata = *(struct msm_ctrl_cmd *)qcmd->command;
-               if (udata.length > 0) {
-                       if (copy_to_user(to,
-                                        udata.value,
-                                        udata.length)) {
-                               ERR_COPY_TO_USER();
-                               rc = -EFAULT;
-                               goto end;
-                       }
-               }
-               udata.value = to;
-
-               if (copy_to_user((void *)arg, &udata,
-                               sizeof(struct msm_ctrl_cmd))) {
-                       ERR_COPY_TO_USER();
-                       rc = -EFAULT;
-                       goto end;
-               }
-       }
-
-end:
-       /* Note: if we get here as a result of an error, we will free the
-        * qcmd that we kmalloc() in this function.  When we come here as
-        * a result of a successful completion, we are freeing the qcmd that
-        * we dequeued from queue->ctrl_status_q.
-        */
-       kfree(qcmd);
-
-       CDBG("msm_control: end rc = %d\n", rc);
-       return rc;
-}
-
-static int msm_get_stats(struct msm_sync *sync, void __user *arg)
-{
-       unsigned long flags;
-       int timeout;
-       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_stats_buf stats;
-
-       if (copy_from_user(&se, arg,
-                       sizeof(struct msm_stats_event_ctrl))) {
-               ERR_COPY_FROM_USER();
-               return -EFAULT;
-       }
-
-       timeout = (int)se.timeout_ms;
-
-       CDBG("msm_get_stats timeout %d\n", timeout);
-       rc = wait_event_interruptible_timeout(
-                       sync->msg_event_wait,
-                       !list_empty_careful(&sync->msg_event_q),
-                       msecs_to_jiffies(timeout));
-       if (list_empty_careful(&sync->msg_event_q)) {
-               if (rc == 0)
-                       rc = -ETIMEDOUT;
-               if (rc < 0) {
-                       pr_err("msm_get_stats error %d\n", rc);
-                       return rc;
-               }
-       }
-       CDBG("msm_get_stats returned from wait: %d\n", rc);
-
-       spin_lock_irqsave(&sync->msg_event_q_lock, flags);
-       BUG_ON(list_empty(&sync->msg_event_q));
-       qcmd = list_first_entry(&sync->msg_event_q,
-                       struct msm_queue_cmd, list);
-       list_del_init(&qcmd->list);
-       spin_unlock_irqrestore(&sync->msg_event_q_lock, flags);
-
-       CDBG("=== received from DSP === %d\n", qcmd->type);
-
-       switch (qcmd->type) {
-       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;
-
-               CDBG("msm_get_stats, qcmd->type = %d\n", qcmd->type);
-               CDBG("length = %d\n", se.stats_event.len);
-               CDBG("msg_id = %d\n", se.stats_event.msg_id);
-
-               if ((data->type == VFE_MSG_STATS_AF) ||
-                               (data->type == VFE_MSG_STATS_WE)) {
-
-                       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;
-                       }
-
-                       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;
-                       }
-               } else if (data->type == VFE_MSG_OUTPUT1 ||
-                       data->type == VFE_MSG_OUTPUT2) {
-                       if (copy_to_user((void *)(se.stats_event.data),
-                                       data->extdata,
-                                       data->extlen)) {
-                               ERR_COPY_TO_USER();
-                               rc = -EFAULT;
-                       }
-               } else if (data->type == VFE_MSG_SNAPSHOT && sync->pict_pp) {
-                       struct msm_postproc buf;
-                       struct msm_pmem_region region;
-                       buf.fmnum = msm_pmem_region_lookup(&sync->frame,
-                                       MSM_PMEM_MAINIMG,
-                                       &region, 1);
-                       if (buf.fmnum == 1) {
-                               buf.fmain.buffer = (unsigned long)region.vaddr;
-                               buf.fmain.y_off  = region.y_off;
-                               buf.fmain.cbcr_off = region.cbcr_off;
-                               buf.fmain.fd = region.fd;
-                       } else {
-                               buf.fmnum = msm_pmem_region_lookup(&sync->frame,
-                                               MSM_PMEM_RAW_MAINIMG,
-                                               &region, 1);
-                               if (buf.fmnum == 1) {
-                                       buf.fmain.path = MSM_FRAME_PREV_2;
-                                       buf.fmain.buffer =
-                                               (unsigned long)region.vaddr;
-                                       buf.fmain.fd = region.fd;
-                               } else {
-                                       pr_err("%s: pmem lookup failed\n",
-                                               __func__);
-                                       rc = -EINVAL;
-                               }
-                       }
-
-                       if (copy_to_user((void *)(se.stats_event.data), &buf,
-                                       sizeof(buf))) {
-                               ERR_COPY_TO_USER();
-                               rc = -EFAULT;
-                               goto failure;
-                       }
-                       CDBG("snapshot copy_to_user!\n");
-               }
-               break;
-
-       case MSM_CAM_Q_CTRL:
-               /* control command from control thread */
-               ctrl = (struct msm_ctrl_cmd *)(qcmd->command);
-
-               CDBG("msm_get_stats, qcmd->type = %d\n", qcmd->type);
-               CDBG("length = %d\n", 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);
-
-               CDBG("msm_get_stats, qcmd->type = %d\n", qcmd->type);
-               CDBG("length = %d\n", 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;
-                       }
-               }
-
-               /* 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;
-       }
-
-failure:
-       kfree(qcmd);
-
-       CDBG("msm_get_stats: %d\n", rc);
-       return rc;
-}
-
-static int msm_ctrl_cmd_done(struct msm_control_device *ctrl_pmsm,
-               void __user *arg)
-{
-       unsigned long flags;
-       int rc = 0;
-
-       struct msm_ctrl_cmd udata, *ctrlcmd;
-       struct msm_queue_cmd *qcmd = NULL;
-
-       if (copy_from_user(&udata, arg, sizeof(struct msm_ctrl_cmd))) {
-               ERR_COPY_FROM_USER();
-               rc = -EFAULT;
-               goto end;
-       }
-
-       qcmd = kmalloc(sizeof(struct msm_queue_cmd) +
-                       sizeof(struct msm_ctrl_cmd) + udata.length,
-                       GFP_KERNEL);
-       if (!qcmd) {
-               rc = -ENOMEM;
-               goto end;
-       }
-
-       qcmd->command = ctrlcmd = (struct msm_ctrl_cmd *)(qcmd + 1);
-       *ctrlcmd = udata;
-       if (udata.length > 0) {
-               ctrlcmd->value = ctrlcmd + 1;
-               if (copy_from_user(ctrlcmd->value,
-                                       (void *)udata.value,
-                                       udata.length)) {
-                       ERR_COPY_FROM_USER();
-                       rc = -EFAULT;
-                       kfree(qcmd);
-                       goto end;
-               }
-       } else
-               ctrlcmd->value = NULL;
-
-end:
-       CDBG("msm_ctrl_cmd_done: end rc = %d\n", rc);
-       if (rc == 0) {
-               /* wake up control thread */
-               spin_lock_irqsave(&ctrl_pmsm->ctrl_q.ctrl_status_q_lock, flags);
-               list_add_tail(&qcmd->list, &ctrl_pmsm->ctrl_q.ctrl_status_q);
-               wake_up(&ctrl_pmsm->ctrl_q.ctrl_status_wait);
-               spin_unlock_irqrestore(&ctrl_pmsm->ctrl_q.ctrl_status_q_lock, flags);
-       }
-
-       return rc;
-}
-
-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;
-       void *data = NULL;
-       int rc = -EIO;
-
-       memset(&axi_data, 0, sizeof(axi_data));
-
-       if (copy_from_user(&cfgcmd, arg, sizeof(cfgcmd))) {
-               ERR_COPY_FROM_USER();
-               return -EFAULT;
-       }
-
-       switch (cfgcmd.cmd_type) {
-       case CMD_STATS_ENABLE:
-               axi_data.bufnum1 =
-                       msm_pmem_region_lookup(&sync->stats,
-                                       MSM_PMEM_AEC_AWB, &region[0],
-                                       NUM_WB_EXP_STAT_OUTPUT_BUFFERS);
-               if (!axi_data.bufnum1) {
-                       pr_err("%s: pmem region lookup error\n", __func__);
-                       return -EINVAL;
-               }
-               axi_data.region = &region[0];
-               data = &axi_data;
-               break;
-       case CMD_STATS_AF_ENABLE:
-               axi_data.bufnum1 =
-                       msm_pmem_region_lookup(&sync->stats,
-                                       MSM_PMEM_AF, &region[0],
-                                       NUM_AF_STAT_OUTPUT_BUFFERS);
-               if (!axi_data.bufnum1) {
-                       pr_err("%s: pmem region lookup error\n", __func__);
-                       return -EINVAL;
-               }
-               axi_data.region = &region[0];
-               data = &axi_data;
-               break;
-       case CMD_GENERAL:
-       case CMD_STATS_DISABLE:
-               break;
-       default:
-               pr_err("%s: unknown command type %d\n",
-                       __func__, cfgcmd.cmd_type);
-               return -EINVAL;
-       }
-
-
-       if (sync->vfefn.vfe_config)
-               rc = sync->vfefn.vfe_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[8];
-       int pmem_type;
-
-       memset(&axi_data, 0, sizeof(axi_data));
-
-       switch (cfgcmd->cmd_type) {
-       case CMD_AXI_CFG_OUT1:
-               pmem_type = MSM_PMEM_OUTPUT1;
-               axi_data.bufnum1 =
-                       msm_pmem_region_lookup(&sync->frame, pmem_type,
-                               &region[0], 8);
-               if (!axi_data.bufnum1) {
-                       pr_err("%s: pmem region lookup error\n", __func__);
-                       return -EINVAL;
-               }
-               break;
-
-       case CMD_AXI_CFG_OUT2:
-               pmem_type = MSM_PMEM_OUTPUT2;
-               axi_data.bufnum2 =
-                       msm_pmem_region_lookup(&sync->frame, pmem_type,
-                               &region[0], 8);
-               if (!axi_data.bufnum2) {
-                       pr_err("%s: pmem region lookup error\n", __func__);
-                       return -EINVAL;
-               }
-               break;
-
-       case CMD_AXI_CFG_SNAP_O1_AND_O2:
-               pmem_type = MSM_PMEM_THUMBAIL;
-               axi_data.bufnum1 =
-                       msm_pmem_region_lookup(&sync->frame, pmem_type,
-                               &region[0], 8);
-               if (!axi_data.bufnum1) {
-                       pr_err("%s: pmem region lookup error\n", __func__);
-                       return -EINVAL;
-               }
-
-               pmem_type = MSM_PMEM_MAINIMG;
-               axi_data.bufnum2 =
-                       msm_pmem_region_lookup(&sync->frame, pmem_type,
-                               &region[axi_data.bufnum1], 8);
-               if (!axi_data.bufnum2) {
-                       pr_err("%s: pmem region lookup error\n", __func__);
-                       return -EINVAL;
-               }
-               break;
-
-       case CMD_RAW_PICT_AXI_CFG:
-               pmem_type = MSM_PMEM_RAW_MAINIMG;
-               axi_data.bufnum2 =
-                       msm_pmem_region_lookup(&sync->frame, pmem_type,
-                               &region[0], 8);
-               if (!axi_data.bufnum2) {
-                       pr_err("%s: pmem region lookup error\n", __func__);
-                       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;
-       CDBG("sensor_name %s\n", sdata->sensor_name);
-
-       memcpy(&info.name[0],
-               sdata->sensor_name,
-               MAX_SENSOR_NAME);
-       info.flash_enabled = sdata->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_put_frame_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->y_off, pb->cbcr_off, pb->fd);
-
-       if (pphy != 0) {
-               CDBG("rel: vaddr = 0x%lx, paddr = 0x%lx\n",
-                       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_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_register_pmem(struct msm_sync *sync,
-               struct msm_pmem_info *pinfo)
-{
-       int rc = 0;
-
-       switch (pinfo->type) {
-       case MSM_PMEM_OUTPUT1:
-       case MSM_PMEM_OUTPUT2:
-       case MSM_PMEM_THUMBAIL:
-       case MSM_PMEM_MAINIMG:
-       case MSM_PMEM_RAW_MAINIMG:
-               rc = msm_pmem_table_add(&sync->frame, pinfo);
-               break;
-
-       case MSM_PMEM_AEC_AWB:
-       case MSM_PMEM_AF:
-               rc = msm_pmem_table_add(&sync->stats, pinfo);
-               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->stats, pmem_type,
-                               &region[0], NUM_WB_EXP_STAT_OUTPUT_BUFFERS);
-               if (!axi_data.bufnum1) {
-                       pr_err("%s: pmem region lookup error\n", __func__);
-                       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("msm_put_stats_buffer\n");
-       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 {
-                       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("msm_put_stats_buffer: "\
-                                       "vfe_config err %d\n", rc);
-               } else
-                       pr_err("msm_put_stats_buffer: vfe_config is NULL\n");
-       } else {
-               pr_err("msm_put_stats_buffer: NULL physical address\n");
-               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_OUT1:
-       case CMD_AXI_CFG_OUT2:
-       case CMD_AXI_CFG_SNAP_O1_AND_O2:
-       case CMD_RAW_PICT_AXI_CFG:
-               return msm_frame_axi_cfg(sync, &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_ctrl_cmd *ctrl)
-{
-       unsigned long flags;
-       int rc = 0;
-       int tm;
-
-       struct msm_queue_cmd *qcmd = NULL;
-
-       tm = (int)ctrl->timeout_ms;
-
-       rc = wait_event_interruptible_timeout(
-                       sync->pict_frame_wait,
-                       !list_empty_careful(&sync->pict_frame_q),
-                       msecs_to_jiffies(tm));
-       if (list_empty_careful(&sync->pict_frame_q)) {
-               if (rc == 0)
-                       return -ETIMEDOUT;
-               if (rc < 0) {
-                       pr_err("msm_camera_get_picture, rc = %d\n", rc);
-                       return rc;
-               }
-       }
-
-       spin_lock_irqsave(&sync->pict_frame_q_lock, flags);
-       BUG_ON(list_empty(&sync->pict_frame_q));
-       qcmd = list_first_entry(&sync->pict_frame_q,
-                       struct msm_queue_cmd, list);
-       list_del_init(&qcmd->list);
-       spin_unlock_irqrestore(&sync->pict_frame_q_lock, flags);
-
-       if (qcmd->command != NULL) {
-               struct msm_ctrl_cmd *q =
-                       (struct msm_ctrl_cmd *)qcmd->command;
-               ctrl->type = q->type;
-               ctrl->status = q->status;
-       } else {
-               ctrl->type = -1;
-               ctrl->status = -1;
-       }
-
-       kfree(qcmd);
-       return rc;
-}
-
-static int msm_get_pic(struct msm_sync *sync, void __user *arg)
-{
-       struct msm_ctrl_cmd ctrlcmd_t;
-       int rc;
-
-       if (copy_from_user(&ctrlcmd_t,
-                               arg,
-                               sizeof(struct msm_ctrl_cmd))) {
-               ERR_COPY_FROM_USER();
-               return -EFAULT;
-       }
-
-       rc = __msm_get_pic(sync, &ctrlcmd_t);
-       if (rc < 0)
-               return rc;
-
-       if (sync->croplen) {
-               if (ctrlcmd_t.length < sync->croplen) {
-                       pr_err("msm_get_pic: invalid len %d\n",
-                               ctrlcmd_t.length);
-                       return -EINVAL;
-               }
-               if (copy_to_user(ctrlcmd_t.value,
-                               sync->cropinfo,
-                               sync->croplen)) {
-                       ERR_COPY_TO_USER();
-                       return -EFAULT;
-               }
-       }
-
-       if (copy_to_user((void *)arg,
-               &ctrlcmd_t,
-               sizeof(struct msm_ctrl_cmd))) {
-               ERR_COPY_TO_USER();
-               return -EFAULT;
-       }
-       return 0;
-}
-
-static int msm_set_crop(struct msm_sync *sync, void __user *arg)
-{
-       struct crop_info crop;
-
-       if (copy_from_user(&crop,
-                               arg,
-                               sizeof(struct crop_info))) {
-               ERR_COPY_FROM_USER();
-               return -EFAULT;
-       }
-
-       if (!sync->croplen) {
-               sync->cropinfo = kmalloc(crop.len, GFP_KERNEL);
-               if (!sync->cropinfo)
-                       return -ENOMEM;
-       } else if (sync->croplen < crop.len)
-               return -EINVAL;
-
-       if (copy_from_user(sync->cropinfo,
-                               crop.info,
-                               crop.len)) {
-               ERR_COPY_FROM_USER();
-               kfree(sync->cropinfo);
-               return -EFAULT;
-       }
-
-       sync->croplen = crop.len;
-
-       return 0;
-}
-
-static int msm_pict_pp_done(struct msm_sync *sync, void __user *arg)
-{
-       struct msm_ctrl_cmd udata;
-       struct msm_ctrl_cmd *ctrlcmd = NULL;
-       struct msm_queue_cmd *qcmd = NULL;
-       unsigned long flags;
-       int rc = 0;
-
-       if (!sync->pict_pp)
-               return -EINVAL;
-
-       if (copy_from_user(&udata, arg, sizeof(struct msm_ctrl_cmd))) {
-               ERR_COPY_FROM_USER();
-               rc = -EFAULT;
-               goto pp_fail;
-       }
-
-       qcmd = kmalloc(sizeof(struct msm_queue_cmd) +
-                       sizeof(struct msm_ctrl_cmd),
-                       GFP_KERNEL);
-       if (!qcmd) {
-               rc = -ENOMEM;
-               goto pp_fail;
-       }
-
-       qcmd->type = MSM_CAM_Q_VFE_MSG;
-       qcmd->command = ctrlcmd = (struct msm_ctrl_cmd *)(qcmd + 1);
-       memset(ctrlcmd, 0, sizeof(struct msm_ctrl_cmd));
-       ctrlcmd->type = udata.type;
-       ctrlcmd->status = udata.status;
-
-       spin_lock_irqsave(&sync->pict_frame_q_lock, flags);
-       list_add_tail(&qcmd->list, &sync->pict_frame_q);
-       spin_unlock_irqrestore(&sync->pict_frame_q_lock, flags);
-       wake_up(&sync->pict_frame_wait);
-
-pp_fail:
-       return rc;
-}
-
-static long msm_ioctl_common(struct msm_device *pmsm,
-               unsigned int cmd,
-               void __user *argp)
-{
-       CDBG("msm_ioctl_common\n");
-       switch (cmd) {
-       case MSM_CAM_IOCTL_REGISTER_PMEM:
-               return msm_register_pmem(pmsm->sync, argp);
-       case MSM_CAM_IOCTL_UNREGISTER_PMEM:
-               return msm_pmem_table_del(pmsm->sync, argp);
-       default:
-               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_device *pmsm = filep->private_data;
-
-       CDBG("msm_ioctl_config cmd = %d\n", _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_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:
-               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_PICT_PP: {
-               uint8_t enable;
-               if (copy_from_user(&enable, argp, sizeof(enable))) {
-                       ERR_COPY_FROM_USER();
-                       rc = -EFAULT;
-               } else {
-                       pmsm->sync->pict_pp = enable;
-                       rc = 0;
-               }
-               break;
-       }
-
-       case MSM_CAM_IOCTL_PICT_PP_DONE:
-               rc = msm_pict_pp_done(pmsm->sync, argp);
-               break;
-
-       case MSM_CAM_IOCTL_SENSOR_IO_CFG:
-               rc = pmsm->sync->sctrl.s_config(argp);
-               break;
-
-       case MSM_CAM_IOCTL_FLASH_LED_CFG: {
-               uint32_t led_state;
-               if (copy_from_user(&led_state, argp, sizeof(led_state))) {
-                       ERR_COPY_FROM_USER();
-                       rc = -EFAULT;
-               } else
-                       rc = msm_camera_flash_set_led_state(led_state);
-               break;
-       }
-
-       default:
-               rc = msm_ioctl_common(pmsm, cmd, argp);
-               break;
-       }
-
-       CDBG("msm_ioctl_config cmd = %d DONE\n", _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_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 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_device *pmsm = ctrl_pmsm->pmsm;
-
-       switch (cmd) {
-       case MSM_CAM_IOCTL_CTRL_COMMAND:
-               /* Coming from control thread, may need to wait for
-                * command status */
-               rc = msm_control(ctrl_pmsm, 1, argp);
-               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_PICTURE:
-               rc = msm_get_pic(pmsm->sync, 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--;
-
-       if (!sync->opencnt) {
-               /* need to clean up system resource */
-               if (sync->vfefn.vfe_release)
-                       sync->vfefn.vfe_release(sync->pdev);
-
-               if (sync->cropinfo) {
-                       kfree(sync->cropinfo);
-                       sync->cropinfo = NULL;
-                       sync->croplen = 0;
-               }
-
-               hlist_for_each_entry_safe(region, hnode, n,
-                               &sync->frame, list) {
-                       hlist_del(hnode);
-                       put_pmem_file(region->file);
-                       kfree(region);
-               }
-
-               hlist_for_each_entry_safe(region, hnode, n,
-                               &sync->stats, list) {
-                       hlist_del(hnode);
-                       put_pmem_file(region->file);
-                       kfree(region);
-               }
-
-               MSM_DRAIN_QUEUE(sync, msg_event_q);
-               MSM_DRAIN_QUEUE(sync, prev_frame_q);
-               MSM_DRAIN_QUEUE(sync, pict_frame_q);
-
-               sync->sctrl.s_release();
-
-               sync->apps_id = NULL;
-               CDBG("msm_release completed!\n");
-       }
-       mutex_unlock(&sync->lock);
-
-       return 0;
-}
-
-static int msm_release_config(struct inode *node, struct file *filep)
-{
-       int rc;
-       struct msm_device *pmsm = filep->private_data;
-       printk("msm_camera: RELEASE %s\n", filep->f_path.dentry->d_name.name);
-       rc = __msm_release(pmsm->sync);
-       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_device *pmsm = ctrl_pmsm->pmsm;
-       printk(KERN_INFO "msm_camera: RELEASE %s\n",
-                                       filep->f_path.dentry->d_name.name);
-       rc = __msm_release(pmsm->sync);
-       if (!rc) {
-               MSM_DRAIN_QUEUE(&ctrl_pmsm->ctrl_q, ctrl_status_q);
-               MSM_DRAIN_QUEUE(pmsm->sync, pict_frame_q);
-       }
-       kfree(ctrl_pmsm);
-       return rc;
-}
-
-static int msm_release_frame(struct inode *node, struct file *filep)
-{
-       int rc;
-       struct msm_device *pmsm = filep->private_data;
-       printk(KERN_INFO "msm_camera: RELEASE %s\n",
-                                       filep->f_path.dentry->d_name.name);
-       rc = __msm_release(pmsm->sync);
-       if (!rc) {
-               MSM_DRAIN_QUEUE(pmsm->sync, prev_frame_q);
-               atomic_set(&pmsm->opened, 0);
-       }
-       return rc;
-}
-
-static int msm_unblock_poll_frame(struct msm_sync *sync)
-{
-       unsigned long flags;
-       CDBG("msm_unblock_poll_frame\n");
-       spin_lock_irqsave(&sync->prev_frame_q_lock, flags);
-       sync->unblock_poll_frame = 1;
-       wake_up(&sync->prev_frame_wait);
-       spin_unlock_irqrestore(&sync->prev_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->prev_frame_wait, pll_table);
-
-       spin_lock_irqsave(&sync->prev_frame_q_lock, flags);
-       if (!list_empty_careful(&sync->prev_frame_q))
-               /* 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->prev_frame_q_lock, flags);
-
-       return rc;
-}
-
-static unsigned int msm_poll_frame(struct file *filep,
-       struct poll_table_struct *pll_table)
-{
-       struct msm_device *pmsm = filep->private_data;
-       return __msm_poll_frame(pmsm->sync, filep, pll_table);
-}
-
-/*
- * This function executes in interrupt context.
- */
-
-static void *msm_vfe_sync_alloc(int size,
-                       void *syncdata __attribute__((unused)))
-{
-       struct msm_queue_cmd *qcmd =
-               kmalloc(sizeof(struct msm_queue_cmd) + size, GFP_ATOMIC);
-       return qcmd ? qcmd + 1 : NULL;
-}
-
-/*
- * This function executes in interrupt context.
- */
-
-static void msm_vfe_sync(struct msm_vfe_resp *vdata,
-               enum msm_queue qtype, void *syncdata)
-{
-       struct msm_queue_cmd *qcmd = NULL;
-       struct msm_queue_cmd *qcmd_frame = NULL;
-       struct msm_vfe_phy_info *fphy;
-
-       unsigned long flags;
-       struct msm_sync *sync = (struct msm_sync *)syncdata;
-       if (!sync) {
-               pr_err("msm_camera: no context in dsp callback.\n");
-               return;
-       }
-
-       qcmd = ((struct msm_queue_cmd *)vdata) - 1;
-       qcmd->type = qtype;
-
-       if (qtype == MSM_CAM_Q_VFE_MSG) {
-               switch (vdata->type) {
-               case VFE_MSG_OUTPUT1:
-               case VFE_MSG_OUTPUT2:
-                       qcmd_frame =
-                               kmalloc(sizeof(struct msm_queue_cmd) +
-                                       sizeof(struct msm_vfe_phy_info),
-                                       GFP_ATOMIC);
-                       if (!qcmd_frame)
-                               goto mem_fail;
-                       fphy = (struct msm_vfe_phy_info *)(qcmd_frame + 1);
-                       *fphy = vdata->phy;
-
-                       qcmd_frame->type = MSM_CAM_Q_VFE_MSG;
-                       qcmd_frame->command = fphy;
-
-                       CDBG("qcmd_frame= 0x%x phy_y= 0x%x, phy_cbcr= 0x%x\n",
-                               (int) qcmd_frame, fphy->y_phy, fphy->cbcr_phy);
-
-                       spin_lock_irqsave(&sync->prev_frame_q_lock, flags);
-                       list_add_tail(&qcmd_frame->list, &sync->prev_frame_q);
-                       wake_up(&sync->prev_frame_wait);
-                       spin_unlock_irqrestore(&sync->prev_frame_q_lock, flags);
-                       CDBG("woke up frame thread\n");
-                       break;
-               case VFE_MSG_SNAPSHOT:
-                       if (sync->pict_pp)
-                               break;
-
-                       CDBG("snapshot pp = %d\n", sync->pict_pp);
-                       qcmd_frame =
-                               kmalloc(sizeof(struct msm_queue_cmd),
-                                       GFP_ATOMIC);
-                       if (!qcmd_frame)
-                               goto mem_fail;
-                       qcmd_frame->type = MSM_CAM_Q_VFE_MSG;
-                       qcmd_frame->command = NULL;
-                               spin_lock_irqsave(&sync->pict_frame_q_lock,
-                               flags);
-                       list_add_tail(&qcmd_frame->list, &sync->pict_frame_q);
-                       wake_up(&sync->pict_frame_wait);
-                       spin_unlock_irqrestore(&sync->pict_frame_q_lock, flags);
-                       CDBG("woke up picture thread\n");
-                       break;
-               default:
-                       CDBG("%s: qtype = %d not handled\n",
-                               __func__, vdata->type);
-                       break;
-               }
-       }
-
-       qcmd->command = (void *)vdata;
-       CDBG("vdata->type = %d\n", vdata->type);
-
-       spin_lock_irqsave(&sync->msg_event_q_lock, flags);
-       list_add_tail(&qcmd->list, &sync->msg_event_q);
-       wake_up(&sync->msg_event_wait);
-       spin_unlock_irqrestore(&sync->msg_event_q_lock, flags);
-       CDBG("woke up config thread\n");
-       return;
-
-mem_fail:
-       kfree(qcmd);
-}
-
-static struct msm_vfe_callback msm_vfe_s = {
-       .vfe_resp = msm_vfe_sync,
-       .vfe_alloc = msm_vfe_sync_alloc,
-};
-
-static int __msm_open(struct msm_sync *sync, const char *const apps_id)
-{
-       int rc = 0;
-
-       mutex_lock(&sync->lock);
-       if (sync->apps_id && strcmp(sync->apps_id, apps_id)) {
-               pr_err("msm_camera(%s): sensor %s is already opened for %s\n",
-                       apps_id,
-                       sync->sdata->sensor_name,
-                       sync->apps_id);
-               rc = -EBUSY;
-               goto msm_open_done;
-       }
-
-       sync->apps_id = apps_id;
-
-       if (!sync->opencnt) {
-
-               msm_camvfe_fn_init(&sync->vfefn, sync);
-               if (sync->vfefn.vfe_init) {
-                       rc = sync->vfefn.vfe_init(&msm_vfe_s,
-                               sync->pdev);
-                       if (rc < 0) {
-                               pr_err("vfe_init failed at %d\n", rc);
-                               goto msm_open_done;
-                       }
-                       rc = sync->sctrl.s_init(sync->sdata);
-                       if (rc < 0) {
-                               pr_err("sensor init failed: %d\n", rc);
-                               goto msm_open_done;
-                       }
-               } else {
-                       pr_err("no sensor init func\n");
-                       rc = -ENODEV;
-                       goto msm_open_done;
-               }
-
-               if (rc >= 0) {
-                       INIT_HLIST_HEAD(&sync->frame);
-                       INIT_HLIST_HEAD(&sync->stats);
-                       sync->unblock_poll_frame = 0;
-               }
-       }
-       sync->opencnt++;
-
-msm_open_done:
-       mutex_unlock(&sync->lock);
-       return rc;
-}
-
-static int msm_open_common(struct inode *inode, struct file *filep,
-                          int once)
-{
-       int rc;
-       struct msm_device *pmsm =
-               container_of(inode->i_cdev, struct msm_device, cdev);
-
-       CDBG("msm_camera: open %s\n", filep->f_path.dentry->d_name.name);
-
-       if (atomic_cmpxchg(&pmsm->opened, 0, 1) && once) {
-               pr_err("msm_camera: %s is already opened.\n",
-                       filep->f_path.dentry->d_name.name);
-               return -EBUSY;
-       }
-
-       rc = nonseekable_open(inode, filep);
-       if (rc < 0) {
-               pr_err("msm_open: nonseekable_open error %d\n", rc);
-               return rc;
-       }
-
-       rc = __msm_open(pmsm->sync, MSM_APPS_ID_PROP);
-       if (rc < 0)
-               return rc;
-
-       filep->private_data = pmsm;
-
-       CDBG("msm_open() open: rc = %d\n", rc);
-       return rc;
-}
-
-static int msm_open(struct inode *inode, struct file *filep)
-{
-       return msm_open_common(inode, filep, 1);
-}
-
-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);
-       if (rc < 0) {
-               kfree(ctrl_pmsm);
-               return rc;
-       }
-
-       ctrl_pmsm->pmsm = filep->private_data;
-       filep->private_data = ctrl_pmsm;
-       spin_lock_init(&ctrl_pmsm->ctrl_q.ctrl_status_q_lock);
-       INIT_LIST_HEAD(&ctrl_pmsm->ctrl_q.ctrl_status_q);
-       init_waitqueue_head(&ctrl_pmsm->ctrl_q.ctrl_status_wait);
-
-       CDBG("msm_open() open: rc = %d\n", rc);
-       return rc;
-}
-
-static int __msm_v4l2_control(struct msm_sync *sync,
-               struct msm_ctrl_cmd *out)
-{
-       int rc = 0;
-
-       struct msm_queue_cmd *qcmd = NULL, *rcmd = NULL;
-       struct msm_ctrl_cmd *ctrl;
-       struct msm_control_device_queue FIXME;
-
-       /* wake up config thread, 4 is for V4L2 application */
-       qcmd = kmalloc(sizeof(struct msm_queue_cmd), GFP_KERNEL);
-       if (!qcmd) {
-               pr_err("msm_control: cannot allocate buffer\n");
-               rc = -ENOMEM;
-               goto end;
-       }
-       qcmd->type = MSM_CAM_Q_V4L2_REQ;
-       qcmd->command = out;
-
-       rcmd = __msm_control(sync, &FIXME, qcmd, out->timeout_ms);
-       if (IS_ERR(rcmd)) {
-               rc = PTR_ERR(rcmd);
-               goto end;
-       }
-
-       ctrl = (struct msm_ctrl_cmd *)(rcmd->command);
-       /* FIXME: we should just set out->length = ctrl->length; */
-       BUG_ON(out->length < ctrl->length);
-       memcpy(out->value, ctrl->value, ctrl->length);
-
-end:
-       kfree(rcmd);
-       CDBG("__msm_v4l2_control: end rc = %d\n", 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,
-       .llseek = no_llseek,
-};
-
-static const struct file_operations msm_fops_control = {
-       .owner = THIS_MODULE,
-       .open = msm_open_control,
-       .unlocked_ioctl = msm_ioctl_control,
-       .release = msm_release_control,
-       .llseek = no_llseek,
-};
-
-static const struct file_operations msm_fops_frame = {
-       .owner = THIS_MODULE,
-       .open = msm_open,
-       .unlocked_ioctl = msm_ioctl_frame,
-       .release = msm_release_frame,
-       .poll = msm_poll_frame,
-       .llseek = no_llseek,
-};
-
-static int msm_setup_cdev(struct msm_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("msm_camera: error creating device: %d\n", 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("msm_camera: error adding cdev: %d\n", rc);
-               device_destroy(msm_class, devno);
-               return rc;
-       }
-
-       return rc;
-}
-
-static int msm_tear_down_cdev(struct msm_device *msm, dev_t devno)
-{
-       cdev_del(&msm->cdev);
-       device_destroy(msm_class, devno);
-       return 0;
-}
-
-int msm_v4l2_register(struct msm_v4l2_driver *drv)
-{
-       /* FIXME: support multiple sensors */
-       if (list_empty(&msm_sensors))
-               return -ENODEV;
-
-       drv->sync = list_first_entry(&msm_sensors, struct msm_sync, list);
-       drv->open      = __msm_open;
-       drv->release   = __msm_release;
-       drv->ctrl      = __msm_v4l2_control;
-       drv->reg_pmem  = __msm_register_pmem;
-       drv->get_frame = __msm_get_frame;
-       drv->put_frame = __msm_put_frame_buf;
-       drv->get_pict  = __msm_get_pic;
-       drv->drv_poll  = __msm_poll_frame;
-
-       return 0;
-}
-EXPORT_SYMBOL(msm_v4l2_register);
-
-int msm_v4l2_unregister(struct msm_v4l2_driver *drv)
-{
-       drv->sync = NULL;
-       return 0;
-}
-EXPORT_SYMBOL(msm_v4l2_unregister);
-
-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;
-
-       spin_lock_init(&sync->msg_event_q_lock);
-       INIT_LIST_HEAD(&sync->msg_event_q);
-       init_waitqueue_head(&sync->msg_event_wait);
-
-       spin_lock_init(&sync->prev_frame_q_lock);
-       INIT_LIST_HEAD(&sync->prev_frame_q);
-       init_waitqueue_head(&sync->prev_frame_wait);
-
-       spin_lock_init(&sync->pict_frame_q_lock);
-       INIT_LIST_HEAD(&sync->pict_frame_q);
-       init_waitqueue_head(&sync->pict_frame_wait);
-
-       rc = msm_camio_probe_on(pdev);
-       if (rc < 0)
-               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("msm_camera: failed to initialize %s\n",
-                       sync->sdata->sensor_name);
-               return rc;
-       }
-
-       sync->opencnt = 0;
-       mutex_init(&sync->lock);
-       CDBG("initialized %s\n", sync->sdata->sensor_name);
-       return rc;
-}
-
-static int msm_sync_destroy(struct msm_sync *sync)
-{
-       return 0;
-}
-
-static int msm_device_init(struct msm_device *pmsm,
-               struct msm_sync *sync,
-               int node)
-{
-       int dev_num = 3 * node;
-       int rc = msm_setup_cdev(pmsm, node,
-               MKDEV(MAJOR(msm_devno), dev_num),
-               "control", &msm_fops_control);
-       if (rc < 0) {
-               pr_err("error creating control node: %d\n", 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("error creating config node: %d\n", 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("error creating frame node: %d\n", 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;
-       }
-
-       atomic_set(&pmsm[0].opened, 0);
-       atomic_set(&pmsm[1].opened, 0);
-       atomic_set(&pmsm[2].opened, 0);
-
-       pmsm[0].sync = sync;
-       pmsm[1].sync = sync;
-       pmsm[2].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_device *pmsm = NULL;
-       struct msm_sync *sync;
-       int rc = -ENODEV;
-       static int camera_node;
-
-       if (camera_node >= MSM_MAX_CAMERA_SENSORS) {
-               pr_err("msm_camera: too many camera sensors\n");
-               return rc;
-       }
-
-       if (!msm_class) {
-               /* There are three device nodes per sensor */
-               rc = alloc_chrdev_region(&msm_devno, 0,
-                               3 * MSM_MAX_CAMERA_SENSORS,
-                               "msm_camera");
-               if (rc < 0) {
-                       pr_err("msm_camera: failed to allocate chrdev: %d\n",
-                               rc);
-                       return rc;
-               }
-
-               msm_class = class_create(THIS_MODULE, "msm_camera");
-               if (IS_ERR(msm_class)) {
-                       rc = PTR_ERR(msm_class);
-                       pr_err("msm_camera: create device class failed: %d\n",
-                               rc);
-                       return rc;
-               }
-       }
-
-       pmsm = kzalloc(sizeof(struct msm_device) * 3 +
-                       sizeof(struct msm_sync), GFP_ATOMIC);
-       if (!pmsm)
-               return -ENOMEM;
-       sync = (struct msm_sync *)(pmsm + 3);
-
-       rc = msm_sync_init(sync, dev, sensor_probe);
-       if (rc < 0) {
-               kfree(pmsm);
-               return rc;
-       }
-
-       CDBG("setting camera node %d\n", camera_node);
-       rc = msm_device_init(pmsm, sync, camera_node);
-       if (rc < 0) {
-               msm_sync_destroy(sync);
-               kfree(pmsm);
-               return rc;
-       }
-
-       camera_node++;
-       list_add(&sync->list, &msm_sensors);
-       return rc;
-}
-EXPORT_SYMBOL(msm_camera_drv_start);
diff --git a/drivers/staging/dream/camera/msm_io7x.c b/drivers/staging/dream/camera/msm_io7x.c
deleted file mode 100644 (file)
index 55c020b..0000000
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Copyright (c) 2008-2009 QUALCOMM Incorporated
- */
-
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <mach/gpio.h>
-#include <mach/board.h>
-#include <mach/camera.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 msm_camera_io_ext camio_ext;
-static struct resource *appio, *mdcio;
-void __iomem *appbase, *mdcbase;
-
-extern int clk_set_flags(struct clk *clk, unsigned long flags);
-
-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;
-       }
-
-       mdcio = request_mem_region(camio_ext.mdcphy,
-               camio_ext.mdcsz, pdev->name);
-       if (!mdcio) {
-               rc = -EBUSY;
-               goto mdc_busy;
-       }
-
-       mdcbase = ioremap(camio_ext.mdcphy,
-               camio_ext.mdcsz);
-       if (!mdcbase) {
-               rc = -ENOMEM;
-               goto mdc_no_mem;
-       }
-
-       camdev->camera_gpio_on();
-
-       msm_camio_clk_enable(CAMIO_VFE_CLK);
-       msm_camio_clk_enable(CAMIO_MDC_CLK);
-       msm_camio_clk_enable(CAMIO_VFE_MDC_CLK);
-       return 0;
-
-mdc_no_mem:
-       release_mem_region(camio_ext.mdcphy, camio_ext.mdcsz);
-mdc_busy:
-       iounmap(appbase);
-apps_no_mem:
-       release_mem_region(camio_ext.appphy, camio_ext.appsz);
-enable_fail:
-       return rc;
-}
-
-void msm_camio_disable(struct platform_device *pdev)
-{
-       struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-       struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-
-       iounmap(mdcbase);
-       release_mem_region(camio_ext.mdcphy, camio_ext.mdcsz);
-       iounmap(appbase);
-       release_mem_region(camio_ext.appphy, camio_ext.appsz);
-
-       camdev->camera_gpio_off();
-
-       msm_camio_clk_disable(CAMIO_VFE_CLK);
-       msm_camio_clk_disable(CAMIO_MDC_CLK);
-       msm_camio_clk_disable(CAMIO_VFE_MDC_CLK);
-}
-
-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 = (readl(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;
-
-       writel((reg & (~mask)) | (value & mask), mdcbase);
-       mdelay(10);
-
-       reg = (readl(mdcbase)) & CAMIF_CFG_RMSK;
-       mask = CAM_PAD_REG_SW_RESET_BMSK;
-       value = 1 << CAM_PAD_REG_SW_RESET_SHFT;
-       writel((reg & (~mask)) | (value & mask), mdcbase);
-       mdelay(10);
-
-       reg = (readl(mdcbase)) & CAMIF_CFG_RMSK;
-       mask = CAM_PAD_REG_SW_RESET_BMSK;
-       value = 0 << CAM_PAD_REG_SW_RESET_SHFT;
-       writel((reg & (~mask)) | (value & mask), mdcbase);
-       mdelay(10);
-
-       msm_camio_clk_sel(MSM_CAMIO_CLK_SRC_EXTERNAL);
-       mdelay(10);
-}
-
-void msm_camio_vfe_blk_reset(void)
-{
-       uint32_t val;
-
-       val = readl(appbase + 0x00000210);
-       val |= 0x1;
-       writel(val, appbase + 0x00000210);
-       mdelay(10);
-
-       val = readl(appbase + 0x00000210);
-       val &= ~0x1;
-       writel(val, appbase + 0x00000210);
-       mdelay(10);
-}
-
-void msm_camio_camif_pad_reg_reset_2(void)
-{
-       uint32_t reg;
-       uint32_t mask, value;
-
-       reg = (readl(mdcbase)) & CAMIF_CFG_RMSK;
-       mask = CAM_PAD_REG_SW_RESET_BMSK;
-       value = 1 << CAM_PAD_REG_SW_RESET_SHFT;
-       writel((reg & (~mask)) | (value & mask), mdcbase);
-       mdelay(10);
-
-       reg = (readl(mdcbase)) & CAMIF_CFG_RMSK;
-       mask = CAM_PAD_REG_SW_RESET_BMSK;
-       value = 0 << CAM_PAD_REG_SW_RESET_SHFT;
-       writel((reg & (~mask)) | (value & mask), mdcbase);
-       mdelay(10);
-}
-
-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/staging/dream/camera/msm_io8x.c b/drivers/staging/dream/camera/msm_io8x.c
deleted file mode 100644 (file)
index 895161a..0000000
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Copyright (c) 2008-2009 QUALCOMM Incorporated
- */
-
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <mach/gpio.h>
-#include <mach/board.h>
-#include <mach/camera.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 clk *camio_vfe_axi_clk;
-static struct msm_camera_io_ext camio_ext;
-static struct resource *appio, *mdcio;
-void __iomem *appbase, *mdcbase;
-
-extern int clk_set_flags(struct clk *clk, unsigned long flags);
-
-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;
-       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;
-       }
-
-       mdcio = request_mem_region(camio_ext.mdcphy,
-               camio_ext.mdcsz, pdev->name);
-       if (!mdcio) {
-               rc = -EBUSY;
-               goto mdc_busy;
-       }
-
-       mdcbase = ioremap(camio_ext.mdcphy,
-               camio_ext.mdcsz);
-       if (!mdcbase) {
-               rc = -ENOMEM;
-               goto mdc_no_mem;
-       }
-
-       camdev->camera_gpio_on();
-
-       msm_camio_clk_enable(CAMIO_VFE_CLK);
-       msm_camio_clk_enable(CAMIO_MDC_CLK);
-       msm_camio_clk_enable(CAMIO_VFE_MDC_CLK);
-       msm_camio_clk_enable(CAMIO_VFE_AXI_CLK);
-       return 0;
-
-mdc_no_mem:
-       release_mem_region(camio_ext.mdcphy, camio_ext.mdcsz);
-mdc_busy:
-       iounmap(appbase);
-apps_no_mem:
-       release_mem_region(camio_ext.appphy, camio_ext.appsz);
-enable_fail:
-       return rc;
-}
-
-void msm_camio_disable(struct platform_device *pdev)
-{
-       struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-       struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-
-       iounmap(mdcbase);
-       release_mem_region(camio_ext.mdcphy, camio_ext.mdcsz);
-       iounmap(appbase);
-       release_mem_region(camio_ext.appphy, camio_ext.appsz);
-
-       camdev->camera_gpio_off();
-
-       msm_camio_clk_disable(CAMIO_VFE_MDC_CLK);
-       msm_camio_clk_disable(CAMIO_MDC_CLK);
-       msm_camio_clk_disable(CAMIO_VFE_CLK);
-       msm_camio_clk_disable(CAMIO_VFE_AXI_CLK);
-}
-
-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 = (readl(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;
-       writel((reg & (~mask)) | (value & mask), mdcbase);
-       mdelay(10);
-
-       reg = (readl(mdcbase)) & CAMIF_CFG_RMSK;
-       mask = CAM_PAD_REG_SW_RESET_BMSK;
-       value = 1 << CAM_PAD_REG_SW_RESET_SHFT;
-       writel((reg & (~mask)) | (value & mask), mdcbase);
-       mdelay(10);
-
-       reg = (readl(mdcbase)) & CAMIF_CFG_RMSK;
-       mask = CAM_PAD_REG_SW_RESET_BMSK;
-       value = 0 << CAM_PAD_REG_SW_RESET_SHFT;
-       writel((reg & (~mask)) | (value & mask), mdcbase);
-       mdelay(10);
-
-       msm_camio_clk_sel(MSM_CAMIO_CLK_SRC_EXTERNAL);
-
-       mdelay(10);
-
-       /* 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 = readl(appbase + 0x00000210);
-       val |= 0x1;
-       writel(val, appbase + 0x00000210);
-       mdelay(10);
-
-       val = readl(appbase + 0x00000210);
-       val &= ~0x1;
-       writel(val, appbase + 0x00000210);
-       mdelay(10);
-}
-
-void msm_camio_camif_pad_reg_reset_2(void)
-{
-       uint32_t reg;
-       uint32_t mask, value;
-
-       reg = (readl(mdcbase)) & CAMIF_CFG_RMSK;
-       mask = CAM_PAD_REG_SW_RESET_BMSK;
-       value = 1 << CAM_PAD_REG_SW_RESET_SHFT;
-       writel((reg & (~mask)) | (value & mask), mdcbase);
-       mdelay(10);
-
-       reg = (readl(mdcbase)) & CAMIF_CFG_RMSK;
-       mask = CAM_PAD_REG_SW_RESET_BMSK;
-       value = 0 << CAM_PAD_REG_SW_RESET_SHFT;
-       writel((reg & (~mask)) | (value & mask), mdcbase);
-       mdelay(10);
-}
-
-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/staging/dream/camera/msm_v4l2.c b/drivers/staging/dream/camera/msm_v4l2.c
deleted file mode 100644 (file)
index c276f2f..0000000
+++ /dev/null
@@ -1,798 +0,0 @@
-/*
- *
- * Copyright (C) 2008-2009 QUALCOMM Incorporated.
- *
- */
-
-#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/slab.h>
-#include <media/v4l2-dev.h>
-#include <media/msm_camera.h>
-#include <mach/camera.h>
-#include <media/v4l2-ioctl.h>
-/*#include <linux/platform_device.h>*/
-
-#define MSM_V4L2_START_SNAPSHOT _IOWR('V', BASE_VIDIOC_PRIVATE+1, \
-      struct v4l2_buffer)
-
-#define MSM_V4L2_GET_PICTURE    _IOWR('V', BASE_VIDIOC_PRIVATE+2, \
-      struct v4l2_buffer)
-
-#define MSM_V4L2_DEVICE_NAME       "msm_v4l2"
-
-#define MSM_V4L2_PROC_NAME         "msm_v4l2"
-
-#define MSM_V4L2_DEVNUM_MPEG2       0
-#define MSM_V4L2_DEVNUM_YUV         20
-
-/* HVGA-P (portrait) and HVGA-L (landscape) */
-#define MSM_V4L2_WIDTH              480
-#define MSM_V4L2_HEIGHT             320
-
-#if 1
-#define D(fmt, args...) printk(KERN_INFO "msm_v4l2: " fmt, ##args)
-#else
-#define D(fmt, args...) do {} while (0)
-#endif
-
-#define PREVIEW_FRAMES_NUM 4
-
-struct msm_v4l2_device {
-       struct list_head read_queue;
-       struct v4l2_format current_cap_format;
-       struct v4l2_format current_pix_format;
-       struct video_device *pvdev;
-       struct msm_v4l2_driver   *drv;
-       uint8_t opencnt;
-
-       spinlock_t read_queue_lock;
-};
-
-static struct msm_v4l2_device *g_pmsm_v4l2_dev;
-
-
-static DEFINE_MUTEX(msm_v4l2_opencnt_lock);
-
-static int msm_v4l2_open(struct file *f)
-{
-       int rc = 0;
-       D("%s\n", __func__);
-       mutex_lock(&msm_v4l2_opencnt_lock);
-       if (!g_pmsm_v4l2_dev->opencnt) {
-               rc = g_pmsm_v4l2_dev->drv->open(
-                               g_pmsm_v4l2_dev->drv->sync,
-                               MSM_APPS_ID_V4L2);
-       }
-       g_pmsm_v4l2_dev->opencnt++;
-       mutex_unlock(&msm_v4l2_opencnt_lock);
-       return rc;
-}
-
-static int msm_v4l2_release(struct file *f)
-{
-       int rc = 0;
-       D("%s\n", __func__);
-       mutex_lock(&msm_v4l2_opencnt_lock);
-       if (!g_pmsm_v4l2_dev->opencnt) {
-               g_pmsm_v4l2_dev->opencnt--;
-               if (!g_pmsm_v4l2_dev->opencnt) {
-                       rc = g_pmsm_v4l2_dev->drv->release(
-                                       g_pmsm_v4l2_dev->drv->sync);
-               }
-       }
-       mutex_unlock(&msm_v4l2_opencnt_lock);
-       return rc;
-}
-
-static unsigned int msm_v4l2_poll(struct file *f, struct poll_table_struct *w)
-{
-       return g_pmsm_v4l2_dev->drv->drv_poll(g_pmsm_v4l2_dev->drv->sync, f, w);
-}
-
-static long msm_v4l2_ioctl(struct file *filep,
-                          unsigned int cmd, unsigned long arg)
-{
-       struct msm_ctrl_cmd *ctrlcmd;
-
-       D("msm_v4l2_ioctl, cmd = %d, %d\n", cmd, __LINE__);
-
-       switch (cmd) {
-       case MSM_V4L2_START_SNAPSHOT:
-
-               ctrlcmd = kmalloc(sizeof(struct msm_ctrl_cmd), GFP_ATOMIC);
-               if (!ctrlcmd) {
-                       CDBG("msm_v4l2_ioctl: cannot allocate buffer\n");
-                       return -ENOMEM;
-               }
-
-               ctrlcmd->length     = 0;
-               ctrlcmd->value      = NULL;
-               ctrlcmd->timeout_ms = 10000;
-
-               D("msm_v4l2_ioctl,  MSM_V4L2_START_SNAPSHOT v4l2 ioctl %d\n",
-               cmd);
-               ctrlcmd->type = MSM_V4L2_SNAPSHOT;
-               return g_pmsm_v4l2_dev->drv->ctrl(g_pmsm_v4l2_dev->drv->sync,
-                                                       ctrlcmd);
-
-       case MSM_V4L2_GET_PICTURE:
-               D("msm_v4l2_ioctl,  MSM_V4L2_GET_PICTURE v4l2 ioctl %d\n", cmd);
-               ctrlcmd = (struct msm_ctrl_cmd *)arg;
-               return g_pmsm_v4l2_dev->drv->get_pict(
-                               g_pmsm_v4l2_dev->drv->sync, ctrlcmd);
-
-       default:
-               D("msm_v4l2_ioctl, standard v4l2 ioctl %d\n", cmd);
-               return video_ioctl2(filep, cmd, arg);
-       }
-}
-
-static void msm_v4l2_release_dev(struct video_device *d)
-{
-       D("%s\n", __func__);
-}
-
-static int msm_v4l2_querycap(struct file *f,
-                            void *pctx, struct v4l2_capability *pcaps)
-{
-       D("%s\n", __func__);
-       strncpy(pcaps->driver, MSM_APPS_ID_V4L2, sizeof(pcaps->driver));
-       strncpy(pcaps->card,
-               MSM_V4L2_DEVICE_NAME, sizeof(pcaps->card));
-       pcaps->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
-       return 0;
-}
-
-static int msm_v4l2_s_std(struct file *f, void *pctx, v4l2_std_id *pnorm)
-{
-       D("%s\n", __func__);
-       return 0;
-}
-
-static int msm_v4l2_queryctrl(struct file *f,
-                               void *pctx, struct v4l2_queryctrl *pqctrl)
-{
-  int rc = 0;
-  struct msm_ctrl_cmd *ctrlcmd;
-
-       D("%s\n", __func__);
-
-       ctrlcmd = kmalloc(sizeof(struct msm_ctrl_cmd), GFP_ATOMIC);
-       if (!ctrlcmd) {
-               CDBG("msm_v4l2_queryctrl: cannot allocate buffer\n");
-               return -ENOMEM;
-       }
-
-       ctrlcmd->type       = MSM_V4L2_QUERY_CTRL;
-       ctrlcmd->length     = sizeof(struct v4l2_queryctrl);
-       ctrlcmd->value      = pqctrl;
-       ctrlcmd->timeout_ms = 10000;
-
-       rc = g_pmsm_v4l2_dev->drv->ctrl(g_pmsm_v4l2_dev->drv->sync, ctrlcmd);
-       if (rc < 0)
-               return -1;
-
-       return ctrlcmd->status;
-}
-
-static int msm_v4l2_g_ctrl(struct file *f, void *pctx, struct v4l2_control *c)
-{
-       int rc = 0;
-       struct msm_ctrl_cmd *ctrlcmd;
-
-       D("%s\n", __func__);
-
-       ctrlcmd = kmalloc(sizeof(struct msm_ctrl_cmd), GFP_ATOMIC);
-       if (!ctrlcmd) {
-               CDBG("msm_v4l2_g_ctrl: cannot allocate buffer\n");
-               return -ENOMEM;
-       }
-
-       ctrlcmd->type       = MSM_V4L2_GET_CTRL;
-       ctrlcmd->length     = sizeof(struct v4l2_control);
-       ctrlcmd->value      = c;
-       ctrlcmd->timeout_ms = 10000;
-
-       rc = g_pmsm_v4l2_dev->drv->ctrl(g_pmsm_v4l2_dev->drv->sync, ctrlcmd);
-       if (rc < 0)
-               return -1;
-
-       return ctrlcmd->status;
-}
-
-static int msm_v4l2_s_ctrl(struct file *f, void *pctx, struct v4l2_control *c)
-{
-       int rc = 0;
-       struct msm_ctrl_cmd *ctrlcmd;
-
-       ctrlcmd = kmalloc(sizeof(struct msm_ctrl_cmd), GFP_ATOMIC);
-       if (!ctrlcmd) {
-               CDBG("msm_v4l2_s_ctrl: cannot allocate buffer\n");
-               return -ENOMEM;
-       }
-
-       ctrlcmd->type       = MSM_V4L2_SET_CTRL;
-       ctrlcmd->length     = sizeof(struct v4l2_control);
-       ctrlcmd->value      = c;
-       ctrlcmd->timeout_ms = 10000;
-
-       D("%s\n", __func__);
-
-       rc = g_pmsm_v4l2_dev->drv->ctrl(g_pmsm_v4l2_dev->drv->sync, ctrlcmd);
-       if (rc < 0)
-               return -1;
-
-       return ctrlcmd->status;
-}
-
-static int msm_v4l2_reqbufs(struct file *f,
-                           void *pctx, struct v4l2_requestbuffers *b)
-{
-       D("%s\n", __func__);
-       return 0;
-}
-
-static int msm_v4l2_querybuf(struct file *f, void *pctx, struct v4l2_buffer *pb)
-{
-       struct msm_pmem_info pmem_buf;
-#if 0
-       __u32 width = 0;
-       __u32 height = 0;
-       __u32 y_size = 0;
-       __u32 y_pad = 0;
-
-       /* FIXME: g_pmsm_v4l2_dev->current_pix_format.fmt.pix.width; */
-       width = 640;
-       /* FIXME: g_pmsm_v4l2_dev->current_pix_format.fmt.pix.height; */
-       height = 480;
-
-       D("%s: width = %d, height = %d\n", __func__, width, height);
-
-       y_size = width * height;
-       y_pad = y_size % 4;
-#endif
-
-    __u32 y_pad = pb->bytesused % 4;
-
-       /* V4L2 videodev will do the copy_from_user. */
-
-       memset(&pmem_buf, 0, sizeof(struct msm_pmem_info));
-       pmem_buf.type = MSM_PMEM_OUTPUT2;
-       pmem_buf.vaddr = (void *)pb->m.userptr;
-       pmem_buf.y_off = 0;
-       pmem_buf.fd = (int)pb->reserved;
-       /* pmem_buf.cbcr_off = (y_size + y_pad); */
-    pmem_buf.cbcr_off = (pb->bytesused + y_pad);
-
-       g_pmsm_v4l2_dev->drv->reg_pmem(g_pmsm_v4l2_dev->drv->sync, &pmem_buf);
-
-       return 0;
-}
-
-static int msm_v4l2_qbuf(struct file *f, void *pctx, struct v4l2_buffer *pb)
-{
-    /*
-       __u32 y_size = 0;
-       __u32 y_pad = 0;
-       __u32 width = 0;
-       __u32 height = 0;
-    */
-
-       __u32 y_pad = 0;
-
-       struct msm_pmem_info meminfo;
-       struct msm_frame frame;
-       static int cnt;
-
-       if ((pb->flags >> 16) & 0x0001) {
-               /* this is for previwe */
-#if 0
-               width = 640;
-               height = 480;
-
-               /* V4L2 videodev will do the copy_from_user. */
-               D("%s: width = %d, height = %d\n", __func__, width, height);
-               y_size = width * height;
-               y_pad = y_size % 4;
-#endif
-
-               y_pad = pb->bytesused % 4;
-
-               if (pb->type == V4L2_BUF_TYPE_PRIVATE) {
-                       /* this qbuf is actually for releasing */
-
-                       frame.buffer           = pb->m.userptr;
-                       frame.y_off            = 0;
-                       /* frame.cbcr_off = (y_size + y_pad); */
-                       frame.cbcr_off         = (pb->bytesused + y_pad);
-                       frame.fd               = pb->reserved;
-
-                       D("V4L2_BUF_TYPE_PRIVATE: pb->bytesused = %d \n",
-                       pb->bytesused);
-
-                       g_pmsm_v4l2_dev->drv->put_frame(
-                               g_pmsm_v4l2_dev->drv->sync,
-                               &frame);
-
-                       return 0;
-               }
-
-               D("V4L2_BUF_TYPE_VIDEO_CAPTURE: pb->bytesused = %d \n",
-               pb->bytesused);
-
-               meminfo.type             = MSM_PMEM_OUTPUT2;
-               meminfo.fd               = (int)pb->reserved;
-               meminfo.vaddr            = (void *)pb->m.userptr;
-               meminfo.y_off            = 0;
-               /* meminfo.cbcr_off = (y_size + y_pad); */
-               meminfo.cbcr_off         = (pb->bytesused + y_pad);
-               if (cnt == PREVIEW_FRAMES_NUM - 1)
-                       meminfo.active = 0;
-               else
-                       meminfo.active = 1;
-               cnt++;
-               g_pmsm_v4l2_dev->drv->reg_pmem(g_pmsm_v4l2_dev->drv->sync,
-                               &meminfo);
-       } else if ((pb->flags) & 0x0001) {
-               /* this is for snapshot */
-
-       __u32 y_size = 0;
-
-       if ((pb->flags >> 8) & 0x01) {
-
-               y_size = pb->bytesused;
-
-               meminfo.type = MSM_PMEM_THUMBAIL;
-       } else if ((pb->flags >> 9) & 0x01) {
-
-               y_size = pb->bytesused;
-
-               meminfo.type = MSM_PMEM_MAINIMG;
-       }
-
-       y_pad = y_size % 4;
-
-       meminfo.fd         = (int)pb->reserved;
-       meminfo.vaddr      = (void *)pb->m.userptr;
-       meminfo.y_off      = 0;
-       /* meminfo.cbcr_off = (y_size + y_pad); */
-       meminfo.cbcr_off   = (y_size + y_pad);
-       meminfo.active     = 1;
-       g_pmsm_v4l2_dev->drv->reg_pmem(g_pmsm_v4l2_dev->drv->sync,
-                                       &meminfo);
-       }
-
-       return 0;
-}
-
-static int msm_v4l2_dqbuf(struct file *f, void *pctx, struct v4l2_buffer *pb)
-{
-       struct msm_frame frame;
-       D("%s\n", __func__);
-
-       /* V4L2 videodev will do the copy_to_user. */
-       if (pb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
-
-               D("%s, %d\n", __func__, __LINE__);
-
-               g_pmsm_v4l2_dev->drv->get_frame(
-                       g_pmsm_v4l2_dev->drv->sync,
-                       &frame);
-
-               pb->type       = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-               pb->m.userptr  = (unsigned long)frame.buffer;  /* FIXME */
-               pb->reserved   = (int)frame.fd;
-               /* pb->length     = (int)frame.cbcr_off; */
-
-               pb->bytesused  = frame.cbcr_off;
-
-       } else if (pb->type == V4L2_BUF_TYPE_PRIVATE) {
-               __u32 y_pad     = pb->bytesused % 4;
-
-               frame.buffer   = pb->m.userptr;
-               frame.y_off    = 0;
-               /* frame.cbcr_off = (y_size + y_pad); */
-               frame.cbcr_off = (pb->bytesused + y_pad);
-               frame.fd       = pb->reserved;
-
-               g_pmsm_v4l2_dev->drv->put_frame(
-                       g_pmsm_v4l2_dev->drv->sync,
-                       &frame);
-       }
-
-       return 0;
-}
-
-static int msm_v4l2_streamon(struct file *f, void *pctx, enum v4l2_buf_type i)
-{
-  struct msm_ctrl_cmd *ctrlcmd;
-
-       ctrlcmd = kmalloc(sizeof(struct msm_ctrl_cmd), GFP_ATOMIC);
-       if (!ctrlcmd) {
-               CDBG("msm_v4l2_s_fmt_cap: cannot allocate buffer\n");
-               return -ENOMEM;
-       }
-
-       ctrlcmd->type       = MSM_V4L2_STREAM_ON;
-       ctrlcmd->timeout_ms = 10000;
-       ctrlcmd->length     = 0;
-       ctrlcmd->value      = NULL;
-
-       D("%s\n", __func__);
-
-       g_pmsm_v4l2_dev->drv->ctrl(
-               g_pmsm_v4l2_dev->drv->sync,
-               ctrlcmd);
-
-       D("%s after drv->ctrl \n", __func__);
-
-       return 0;
-}
-
-static int msm_v4l2_streamoff(struct file *f, void *pctx, enum v4l2_buf_type i)
-{
-  struct msm_ctrl_cmd *ctrlcmd;
-
-       ctrlcmd = kmalloc(sizeof(struct msm_ctrl_cmd), GFP_ATOMIC);
-       if (!ctrlcmd) {
-               CDBG("msm_v4l2_s_fmt_cap: cannot allocate buffer\n");
-               return -ENOMEM;
-       }
-
-       ctrlcmd->type       = MSM_V4L2_STREAM_OFF;
-       ctrlcmd->timeout_ms = 10000;
-       ctrlcmd->length     = 0;
-       ctrlcmd->value      = NULL;
-
-
-       D("%s\n", __func__);
-
-       g_pmsm_v4l2_dev->drv->ctrl(
-               g_pmsm_v4l2_dev->drv->sync,
-               ctrlcmd);
-
-       return 0;
-}
-
-static int msm_v4l2_enum_fmt_overlay(struct file *f,
-                                    void *pctx, struct v4l2_fmtdesc *pfmtdesc)
-{
-       D("%s\n", __func__);
-       return 0;
-}
-
-static int msm_v4l2_enum_fmt_cap(struct file *f,
-                                void *pctx, struct v4l2_fmtdesc *pfmtdesc)
-{
-       D("%s\n", __func__);
-
-       switch (pfmtdesc->index) {
-       case 0:
-               pfmtdesc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-               pfmtdesc->flags = 0;
-               strncpy(pfmtdesc->description, "YUV 4:2:0",
-                       sizeof(pfmtdesc->description));
-               pfmtdesc->pixelformat = V4L2_PIX_FMT_YVU420;
-               break;
-       default:
-               return -EINVAL;
-       }
-
-       return 0;
-}
-
-static int msm_v4l2_g_fmt_cap(struct file *f,
-                             void *pctx, struct v4l2_format *pfmt)
-{
-       D("%s\n", __func__);
-       pfmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-       pfmt->fmt.pix.width = MSM_V4L2_WIDTH;
-       pfmt->fmt.pix.height = MSM_V4L2_HEIGHT;
-       pfmt->fmt.pix.pixelformat = V4L2_PIX_FMT_YVU420;
-       pfmt->fmt.pix.field = V4L2_FIELD_ANY;
-       pfmt->fmt.pix.bytesperline = 0;
-       pfmt->fmt.pix.sizeimage = 0;
-       pfmt->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG;
-       pfmt->fmt.pix.priv = 0;
-       return 0;
-}
-
-static int msm_v4l2_s_fmt_cap(struct file *f,
-                             void *pctx, struct v4l2_format *pfmt)
-{
-  struct msm_ctrl_cmd *ctrlcmd;
-
-       D("%s\n", __func__);
-
-       ctrlcmd = kmalloc(sizeof(struct msm_ctrl_cmd), GFP_ATOMIC);
-       if (!ctrlcmd) {
-               CDBG("msm_v4l2_s_fmt_cap: cannot allocate buffer\n");
-               return -ENOMEM;
-       }
-
-  ctrlcmd->type       = MSM_V4L2_VID_CAP_TYPE;
-  ctrlcmd->length     = sizeof(struct v4l2_format);
-  ctrlcmd->value      = pfmt;
-  ctrlcmd->timeout_ms = 10000;
-
-       if (pfmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
-               kfree(ctrlcmd);
-               return -1;
-       }
-
-#if 0
-       /* FIXEME */
-       if (pfmt->fmt.pix.pixelformat != V4L2_PIX_FMT_YVU420) {
-               kfree(ctrlcmd);
-               return -EINVAL;
-       }
-#endif
-
-       /* Ok, but check other params, too. */
-
-#if 0
-       memcpy(&g_pmsm_v4l2_dev->current_pix_format.fmt.pix, pfmt,
-              sizeof(struct v4l2_format));
-#endif
-
-       g_pmsm_v4l2_dev->drv->ctrl(g_pmsm_v4l2_dev->drv->sync, ctrlcmd);
-
-       return 0;
-}
-
-static int msm_v4l2_g_fmt_overlay(struct file *f,
-                                 void *pctx, struct v4l2_format *pfmt)
-{
-       D("%s\n", __func__);
-       pfmt->type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
-       pfmt->fmt.pix.width = MSM_V4L2_WIDTH;
-       pfmt->fmt.pix.height = MSM_V4L2_HEIGHT;
-       pfmt->fmt.pix.pixelformat = V4L2_PIX_FMT_YVU420;
-       pfmt->fmt.pix.field = V4L2_FIELD_ANY;
-       pfmt->fmt.pix.bytesperline = 0;
-       pfmt->fmt.pix.sizeimage = 0;
-       pfmt->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG;
-       pfmt->fmt.pix.priv = 0;
-       return 0;
-}
-
-static int msm_v4l2_s_fmt_overlay(struct file *f,
-                                 void *pctx, struct v4l2_format *pfmt)
-{
-       D("%s\n", __func__);
-       return 0;
-}
-
-static int msm_v4l2_overlay(struct file *f, void *pctx, unsigned int i)
-{
-       D("%s\n", __func__);
-       return 0;
-}
-
-static int msm_v4l2_g_jpegcomp(struct file *f,
-                              void *pctx, struct v4l2_jpegcompression *pcomp)
-{
-       D("%s\n", __func__);
-       return 0;
-}
-
-static int msm_v4l2_s_jpegcomp(struct file *f,
-                              void *pctx, struct v4l2_jpegcompression *pcomp)
-{
-       D("%s\n", __func__);
-       return 0;
-}
-
-#ifdef CONFIG_PROC_FS
-int msm_v4l2_read_proc(char *pbuf, char **start, off_t offset,
-                      int count, int *eof, void *data)
-{
-       int len = 0;
-       len += snprintf(pbuf, strlen("stats\n") + 1, "stats\n");
-
-       if (g_pmsm_v4l2_dev) {
-               len += snprintf(pbuf, strlen("mode: ") + 1, "mode: ");
-
-               if (g_pmsm_v4l2_dev->current_cap_format.type
-                   == V4L2_BUF_TYPE_VIDEO_CAPTURE)
-                       len += snprintf(pbuf, strlen("capture\n") + 1,
-                                       "capture\n");
-               else
-                       len += snprintf(pbuf, strlen("unknown\n") + 1,
-                                       "unknown\n");
-
-               len += snprintf(pbuf, 21, "resolution: %dx%d\n",
-                               g_pmsm_v4l2_dev->current_cap_format.fmt.pix.
-                               width,
-                               g_pmsm_v4l2_dev->current_cap_format.fmt.pix.
-                               height);
-
-               len += snprintf(pbuf,
-                               strlen("pixel format: ") + 1, "pixel format: ");
-               if (g_pmsm_v4l2_dev->current_cap_format.fmt.pix.pixelformat
-                   == V4L2_PIX_FMT_YVU420)
-                       len += snprintf(pbuf, strlen("yvu420\n") + 1,
-                                       "yvu420\n");
-               else
-                       len += snprintf(pbuf, strlen("unknown\n") + 1,
-                                       "unknown\n");
-
-               len += snprintf(pbuf, strlen("colorspace: ") + 1,
-                               "colorspace: ");
-               if (g_pmsm_v4l2_dev->current_cap_format.fmt.pix.colorspace
-                   == V4L2_COLORSPACE_JPEG)
-                       len += snprintf(pbuf, strlen("jpeg\n") + 1, "jpeg\n");
-               else
-                       len += snprintf(pbuf, strlen("unknown\n") + 1,
-                                       "unknown\n");
-       }
-
-       *eof = 1;
-       return len;
-}
-#endif
-
-static const struct v4l2_file_operations msm_v4l2_fops = {
-       .owner = THIS_MODULE,
-       .open = msm_v4l2_open,
-       .poll = msm_v4l2_poll,
-       .release = msm_v4l2_release,
-       .ioctl = msm_v4l2_ioctl,
-};
-
-static void msm_v4l2_dev_init(struct msm_v4l2_device *pmsm_v4l2_dev)
-{
-       pmsm_v4l2_dev->read_queue_lock =
-           __SPIN_LOCK_UNLOCKED(pmsm_v4l2_dev->read_queue_lock);
-       INIT_LIST_HEAD(&pmsm_v4l2_dev->read_queue);
-}
-
-static int msm_v4l2_try_fmt_cap(struct file *file,
-                                void *fh, struct v4l2_format *f)
-{
-       /* FIXME */
-       return 0;
-}
-
-static int mm_v4l2_try_fmt_type_private(struct file *file,
-                                        void *fh, struct v4l2_format *f)
-{
-       /* FIXME */
-       return 0;
-}
-
-/*
- * should the following structure be used instead of the code in the function?
- * static const struct v4l2_ioctl_ops msm_v4l2_ioctl_ops = {
- *     .vidioc_querycap = ....
- * }
- */
-static const struct v4l2_ioctl_ops msm_ioctl_ops = {
-       .vidioc_querycap = msm_v4l2_querycap,
-       .vidioc_s_std = msm_v4l2_s_std,
-
-       .vidioc_queryctrl = msm_v4l2_queryctrl,
-       .vidioc_g_ctrl = msm_v4l2_g_ctrl,
-       .vidioc_s_ctrl = msm_v4l2_s_ctrl,
-
-       .vidioc_reqbufs = msm_v4l2_reqbufs,
-       .vidioc_querybuf = msm_v4l2_querybuf,
-       .vidioc_qbuf = msm_v4l2_qbuf,
-       .vidioc_dqbuf = msm_v4l2_dqbuf,
-
-       .vidioc_streamon = msm_v4l2_streamon,
-       .vidioc_streamoff = msm_v4l2_streamoff,
-
-       .vidioc_enum_fmt_vid_overlay = msm_v4l2_enum_fmt_overlay,
-       .vidioc_enum_fmt_vid_cap = msm_v4l2_enum_fmt_cap,
-
-       .vidioc_try_fmt_vid_cap = msm_v4l2_try_fmt_cap,
-       .vidioc_try_fmt_type_private = mm_v4l2_try_fmt_type_private,
-
-       .vidioc_g_fmt_vid_cap = msm_v4l2_g_fmt_cap,
-       .vidioc_s_fmt_vid_cap = msm_v4l2_s_fmt_cap,
-       .vidioc_g_fmt_vid_overlay = msm_v4l2_g_fmt_overlay,
-       .vidioc_s_fmt_vid_overlay = msm_v4l2_s_fmt_overlay,
-       .vidioc_overlay = msm_v4l2_overlay,
-
-       .vidioc_g_jpegcomp = msm_v4l2_g_jpegcomp,
-       .vidioc_s_jpegcomp = msm_v4l2_s_jpegcomp,
-};
-
-static int msm_v4l2_video_dev_init(struct video_device *pvd)
-{
-       strncpy(pvd->name, MSM_APPS_ID_V4L2, sizeof(pvd->name));
-       pvd->vfl_type = 1;
-       pvd->fops = &msm_v4l2_fops;
-       pvd->release = msm_v4l2_release_dev;
-       pvd->minor = -1;
-       pvd->ioctl_ops = &msm_ioctl_ops;
-       return msm_v4l2_register(g_pmsm_v4l2_dev->drv);
-}
-
-static int __init msm_v4l2_init(void)
-{
-       int rc = -ENOMEM;
-       struct video_device *pvdev = NULL;
-       struct msm_v4l2_device *pmsm_v4l2_dev = NULL;
-       D("%s\n", __func__);
-
-       pvdev = video_device_alloc();
-       if (pvdev == NULL)
-               return rc;
-
-       pmsm_v4l2_dev =
-               kzalloc(sizeof(struct msm_v4l2_device), GFP_KERNEL);
-       if (pmsm_v4l2_dev == NULL) {
-               video_device_release(pvdev);
-               return rc;
-       }
-
-       msm_v4l2_dev_init(pmsm_v4l2_dev);
-
-       g_pmsm_v4l2_dev = pmsm_v4l2_dev;
-       g_pmsm_v4l2_dev->pvdev = pvdev;
-
-       g_pmsm_v4l2_dev->drv =
-               kzalloc(sizeof(struct msm_v4l2_driver), GFP_KERNEL);
-       if (!g_pmsm_v4l2_dev->drv) {
-               video_device_release(pvdev);
-               kfree(pmsm_v4l2_dev);
-               return rc;
-       }
-
-       rc = msm_v4l2_video_dev_init(pvdev);
-       if (rc < 0) {
-               video_device_release(pvdev);
-               kfree(g_pmsm_v4l2_dev->drv);
-               kfree(pmsm_v4l2_dev);
-               return rc;
-       }
-
-       if (video_register_device(pvdev, VFL_TYPE_GRABBER,
-           MSM_V4L2_DEVNUM_YUV)) {
-               D("failed to register device\n");
-               video_device_release(pvdev);
-               kfree(g_pmsm_v4l2_dev);
-               g_pmsm_v4l2_dev = NULL;
-               return -ENOENT;
-       }
-#ifdef CONFIG_PROC_FS
-       create_proc_read_entry(MSM_V4L2_PROC_NAME,
-                              0, NULL, msm_v4l2_read_proc, NULL);
-#endif
-
-       return 0;
-}
-
-static void __exit msm_v4l2_exit(void)
-{
-       struct video_device *pvdev = g_pmsm_v4l2_dev->pvdev;
-       D("%s\n", __func__);
-#ifdef CONFIG_PROC_FS
-       remove_proc_entry(MSM_V4L2_PROC_NAME, NULL);
-#endif
-       video_unregister_device(pvdev);
-       video_device_release(pvdev);
-
-       msm_v4l2_unregister(g_pmsm_v4l2_dev->drv);
-
-       kfree(g_pmsm_v4l2_dev->drv);
-       g_pmsm_v4l2_dev->drv = NULL;
-
-       kfree(g_pmsm_v4l2_dev);
-       g_pmsm_v4l2_dev = NULL;
-}
-
-module_init(msm_v4l2_init);
-module_exit(msm_v4l2_exit);
-
-MODULE_DESCRIPTION("MSM V4L2 driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/staging/dream/camera/msm_vfe7x.c b/drivers/staging/dream/camera/msm_vfe7x.c
deleted file mode 100644 (file)
index 198656a..0000000
+++ /dev/null
@@ -1,702 +0,0 @@
-/*
- * Copyright (C) 2008-2009 QUALCOMM Incorporated.
- */
-
-#include <linux/msm_adsp.h>
-#include <linux/uaccess.h>
-#include <linux/fs.h>
-#include <linux/sched.h>
-#include <linux/android_pmem.h>
-#include <linux/slab.h>
-#include <mach/msm_adsp.h>
-#include <linux/delay.h>
-#include <linux/wait.h>
-#include "msm_vfe7x.h"
-
-#define QDSP_CMDQUEUE QDSP_vfeCommandQueue
-
-#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
-
-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;
-
-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_OUTPUT1:
-       case VFE_MSG_OUTPUT2: {
-               pinfo->y_phy = ((struct vfe_endframe *)data)->y_address;
-               pinfo->cbcr_phy =
-                       ((struct vfe_endframe *)data)->cbcr_address;
-
-               CDBG("vfe_7x_convert, y_phy = 0x%x, cbcr_phy = 0x%x\n",
-                                pinfo->y_phy, pinfo->cbcr_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_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;
-
-       len = (id == (uint16_t)-1) ? 0 : len;
-       data = resp->vfe_alloc(sizeof(struct msm_vfe_resp) + len, vfe_syncdata);
-
-       if (!data) {
-               pr_err("rp: cannot allocate buffer\n");
-               return;
-       }
-       rp = (struct msm_vfe_resp *)data;
-       rp->evt_msg.len = len;
-
-       if (id == ((uint16_t)-1)) {
-               /* 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];
-               resp->vfe_resp(rp, MSM_CAM_Q_VFE_EVT, vfe_syncdata);
-       } 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);
-
-               switch (rp->evt_msg.msg_id) {
-               case MSG_SNAPSHOT:
-                       rp->type = VFE_MSG_SNAPSHOT;
-                       break;
-
-               case MSG_OUTPUT1:
-                       rp->type = VFE_MSG_OUTPUT1;
-                       vfe_7x_convert(&(rp->phy), VFE_MSG_OUTPUT1,
-                               rp->evt_msg.data, &(rp->extdata),
-                               &(rp->extlen));
-                       break;
-
-               case MSG_OUTPUT2:
-                       rp->type = VFE_MSG_OUTPUT2;
-                       vfe_7x_convert(&(rp->phy), VFE_MSG_OUTPUT2,
-                                       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);
-       }
-}
-
-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);
-
-       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;
-}
-
-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);
-               CDBG("config_axi1: O1, phy = 0x%lx, y_off = %d, cbcr_off =%d\n",
-                       regptr->paddr, regptr->y_off, regptr->cbcr_off);
-
-               bptr = &ao->output1buffer1_y_phy;
-               for (cnt = 0; cnt < ad->bufnum1; cnt++) {
-                       *bptr = regptr->paddr + regptr->y_off;
-                       bptr++;
-                       *bptr = regptr->paddr + regptr->cbcr_off;
-
-                       bptr++;
-                       regptr++;
-               }
-
-               regptr--;
-               for (cnt = 0; cnt < (8 - ad->bufnum1); cnt++) {
-                       *bptr = regptr->paddr + regptr->y_off;
-                       bptr++;
-                       *bptr = regptr->paddr + regptr->cbcr_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);
-               CDBG("config_axi2: O2, phy = 0x%lx, y_off = %d, cbcr_off =%d\n",
-                       regptr->paddr, regptr->y_off, regptr->cbcr_off);
-
-               bptr = &ao->output2buffer1_y_phy;
-               for (cnt = 0; cnt < ad->bufnum2; cnt++) {
-                       *bptr = regptr->paddr + regptr->y_off;
-                       bptr++;
-                       *bptr = regptr->paddr + regptr->cbcr_off;
-
-                       bptr++;
-                       regptr++;
-               }
-
-               regptr--;
-               for (cnt = 0; cnt < (8 - ad->bufnum2); cnt++) {
-                       *bptr = regptr->paddr + regptr->y_off;
-                       bptr++;
-                       *bptr = regptr->paddr + regptr->cbcr_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;
-
-       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_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;
-
-                       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->y_off);
-
-               fack.output2newcbcrbufferaddress =
-                       (void *)(p + b->cbcr_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();
-                               msm_camio_camif_pad_reg_reset_2();
-                               vfestopped = 0;
-                               break;
-
-                       case VFE_START_CMD:
-                               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_OUT1: {
-               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 *)(vfecmd->value),
-                                       sizeof(struct axiout))) {
-                       rc = -EFAULT;
-                       goto config_done;
-               }
-
-               vfe_7x_config_axi(OUTPUT_1, axid, axio);
-
-               cmd_data = axio;
-       }
-               break;
-
-       case CMD_AXI_CFG_OUT2:
-       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_O1_AND_O2: {
-               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);
-       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;
-}
diff --git a/drivers/staging/dream/camera/msm_vfe7x.h b/drivers/staging/dream/camera/msm_vfe7x.h
deleted file mode 100644 (file)
index be3e9ad..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (C) 2008-2009 QUALCOMM Incorporated.
- */
-#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/staging/dream/camera/msm_vfe8x.c b/drivers/staging/dream/camera/msm_vfe8x.c
deleted file mode 100644 (file)
index d87d56f..0000000
+++ /dev/null
@@ -1,736 +0,0 @@
-/*
- * Copyright (C) 2008-2009 QUALCOMM Incorporated.
- */
-#include <linux/slab.h>
-#include <linux/uaccess.h>
-#include <linux/interrupt.h>
-#include <mach/irqs.h>
-#include "msm_vfe8x_proc.h"
-
-#define ON  1
-#define OFF 0
-
-struct mutex vfe_lock;
-static void     *vfe_syncdata;
-
-static int vfe_enable(struct camera_enable_cmd *enable)
-{
-       int rc = 0;
-       return rc;
-}
-
-static int vfe_disable(struct camera_enable_cmd *enable,
-       struct platform_device *dev)
-{
-       int rc = 0;
-
-       vfe_stop();
-
-       msm_camio_disable(dev);
-       return rc;
-}
-
-static void vfe_release(struct platform_device *dev)
-{
-       msm_camio_disable(dev);
-       vfe_cmd_release(dev);
-
-       mutex_lock(&vfe_lock);
-       vfe_syncdata = NULL;
-       mutex_unlock(&vfe_lock);
-}
-
-static void vfe_config_axi(int mode,
-       struct axidata *ad, struct vfe_cmd_axi_output_config *ao)
-{
-       struct msm_pmem_region *regptr;
-       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->y_off;
-                               p1++;
-
-                               *p2 = regptr->paddr + regptr->cbcr_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->y_off, regptr->cbcr_off);
-
-                       for (j = 0;
-                               j < ao->output2.fragmentCount; j++) {
-
-                               *p1 = regptr->paddr + regptr->y_off;
-                               CDBG("vfe_config_axi: p1 = 0x%x\n", *p1);
-                               p1++;
-
-                               *p2 = regptr->paddr + regptr->cbcr_off;
-                               CDBG("vfe_config_axi: p2 = 0x%x\n", *p2);
-                               p2++;
-                       }
-                       regptr++;
-               }
-       }
-}
-
-static int vfe_proc_general(struct msm_vfe_command_8k *cmd)
-{
-       int rc = 0;
-
-       CDBG("vfe_proc_general: cmdID = %d\n", 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;
-               if (copy_from_user(&start,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               /* 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;
-               if (copy_from_user(&camif,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_camif_config(&camif);
-       }
-               break;
-
-       case VFE_CMD_ID_BLACK_LEVEL_CONFIG: {
-               struct vfe_cmd_black_level_config bl;
-               if (copy_from_user(&bl,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_black_level_config(&bl);
-       }
-               break;
-
-       case VFE_CMD_ID_ROLL_OFF_CONFIG: {
-               struct vfe_cmd_roll_off_config rolloff;
-               if (copy_from_user(&rolloff,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_roll_off_config(&rolloff);
-       }
-               break;
-
-       case VFE_CMD_ID_DEMUX_CHANNEL_GAIN_CONFIG: {
-               struct vfe_cmd_demux_channel_gain_config demuxc;
-               if (copy_from_user(&demuxc,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               /* demux is always enabled.  */
-               vfe_demux_channel_gain_config(&demuxc);
-       }
-               break;
-
-       case VFE_CMD_ID_DEMOSAIC_CONFIG: {
-               struct vfe_cmd_demosaic_config demosaic;
-               if (copy_from_user(&demosaic,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               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;
-               if (copy_from_user(&fov,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               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;
-               if (copy_from_user(&mainds,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               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;
-               if (copy_from_user(&wb,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               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;
-               if (copy_from_user(&cc,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_color_correction_config(&cc);
-       }
-               break;
-
-       case VFE_CMD_ID_LA_CONFIG: {
-               struct vfe_cmd_la_config la;
-               if (copy_from_user(&la,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_la_config(&la);
-       }
-               break;
-
-       case VFE_CMD_ID_RGB_GAMMA_CONFIG: {
-               struct vfe_cmd_rgb_gamma_config rgb;
-               if (copy_from_user(&rgb,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               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;
-               if (copy_from_user(&chrom,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               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;
-               if (copy_from_user(&chromsup,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_chroma_sup_config(&chromsup);
-       }
-               break;
-
-       case VFE_CMD_ID_ASF_CONFIG: {
-               struct vfe_cmd_asf_config asf;
-               if (copy_from_user(&asf,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_asf_config(&asf);
-       }
-               break;
-
-       case VFE_CMD_ID_SCALER2Y_CONFIG:
-       case VFE_CMD_ID_SCALER2Y_UPDATE: {
-               struct vfe_cmd_scaler2_config ds2y;
-               if (copy_from_user(&ds2y,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_scaler2y_config(&ds2y);
-       }
-               break;
-
-       case VFE_CMD_ID_SCALER2CbCr_CONFIG:
-       case VFE_CMD_ID_SCALER2CbCr_UPDATE: {
-               struct vfe_cmd_scaler2_config ds2cbcr;
-               if (copy_from_user(&ds2cbcr,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_scaler2cbcr_config(&ds2cbcr);
-       }
-               break;
-
-       case VFE_CMD_ID_CHROMA_SUBSAMPLE_CONFIG: {
-               struct vfe_cmd_chroma_subsample_config sub;
-               if (copy_from_user(&sub,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_chroma_subsample_config(&sub);
-       }
-               break;
-
-       case VFE_CMD_ID_FRAME_SKIP_CONFIG: {
-               struct vfe_cmd_frame_skip_config fskip;
-               if (copy_from_user(&fskip,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_frame_skip_config(&fskip);
-       }
-               break;
-
-       case VFE_CMD_ID_OUTPUT_CLAMP_CONFIG: {
-               struct vfe_cmd_output_clamp_config clamp;
-               if (copy_from_user(&clamp,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_output_clamp_config(&clamp);
-       }
-               break;
-
-       /* module update commands */
-       case VFE_CMD_ID_BLACK_LEVEL_UPDATE: {
-               struct vfe_cmd_black_level_config blk;
-               if (copy_from_user(&blk,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_black_level_update(&blk);
-       }
-               break;
-
-       case VFE_CMD_ID_DEMUX_CHANNEL_GAIN_UPDATE: {
-               struct vfe_cmd_demux_channel_gain_config dmu;
-               if (copy_from_user(&dmu,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_demux_channel_gain_update(&dmu);
-       }
-               break;
-
-       case VFE_CMD_ID_DEMOSAIC_BPC_UPDATE: {
-               struct vfe_cmd_demosaic_bpc_update demo_bpc;
-               if (copy_from_user(&demo_bpc,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_demosaic_bpc_update(&demo_bpc);
-       }
-               break;
-
-       case VFE_CMD_ID_DEMOSAIC_ABF_UPDATE: {
-               struct vfe_cmd_demosaic_abf_update demo_abf;
-               if (copy_from_user(&demo_abf,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_demosaic_abf_update(&demo_abf);
-       }
-               break;
-
-       case VFE_CMD_ID_LA_UPDATE: {
-               struct vfe_cmd_la_config la;
-               if (copy_from_user(&la,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_la_update(&la);
-       }
-               break;
-
-       case VFE_CMD_ID_RGB_GAMMA_UPDATE: {
-               struct vfe_cmd_rgb_gamma_config rgb;
-               if (copy_from_user(&rgb,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               rc = vfe_rgb_gamma_update(&rgb);
-       }
-               break;
-
-       case VFE_CMD_ID_ASF_UPDATE: {
-               struct vfe_cmd_asf_update asf;
-               if (copy_from_user(&asf,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_asf_update(&asf);
-       }
-               break;
-
-       case VFE_CMD_ID_FRAME_SKIP_UPDATE: {
-               struct vfe_cmd_frame_skip_update fskip;
-               if (copy_from_user(&fskip,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_frame_skip_update(&fskip);
-       }
-               break;
-
-       case VFE_CMD_ID_CAMIF_FRAME_UPDATE: {
-               struct vfe_cmds_camif_frame fup;
-               if (copy_from_user(&fup,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_camif_frame_update(&fup);
-       }
-               break;
-
-       /* stats update commands */
-       case VFE_CMD_ID_STATS_AUTOFOCUS_UPDATE: {
-               struct vfe_cmd_stats_af_update afup;
-               if (copy_from_user(&afup,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_stats_update_af(&afup);
-       }
-               break;
-
-       case VFE_CMD_ID_STATS_WB_EXP_UPDATE: {
-               struct vfe_cmd_stats_wb_exp_update wbexp;
-               if (copy_from_user(&wbexp,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               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;
-               if (copy_from_user(&stats,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               vfe_stats_setting(&stats);
-       }
-               break;
-
-       case VFE_CMD_ID_STATS_AUTOFOCUS_START: {
-               struct vfe_cmd_stats_af_start af;
-               if (copy_from_user(&af,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               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;
-               if (copy_from_user(&awexp,
-                       (void __user *) cmd->value, cmd->length))
-                       rc = -EFAULT;
-
-               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:
-               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;
-
-       uint32_t i;
-
-       void *cmd_data = NULL;
-       long rc = 0;
-
-       struct vfe_cmd_axi_output_config *axio = NULL;
-       struct vfe_cmd_stats_setting *scfg = NULL;
-
-       if (cmd->cmd_type != CMD_FRAME_BUF_RELEASE &&
-           cmd->cmd_type != CMD_STATS_BUF_RELEASE) {
-
-               if (copy_from_user(&vfecmd,
-                               (void __user *)(cmd->value),
-                               sizeof(struct msm_vfe_command_8k)))
-                       return -EFAULT;
-       }
-
-       CDBG("vfe_config: cmdType = %d\n", 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: {
-               struct axidata *axid;
-
-               axid = data;
-               if (!axid)
-                       return -EFAULT;
-
-               scfg =
-                       kmalloc(sizeof(struct vfe_cmd_stats_setting),
-                               GFP_ATOMIC);
-               if (!scfg)
-                       return -ENOMEM;
-
-               if (copy_from_user(scfg,
-                                       (void __user *)(vfecmd.value),
-                                       vfecmd.length)) {
-
-                       kfree(scfg);
-                       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_config(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;
-
-               if (!data)
-                       return -EFAULT;
-
-               b = (struct msm_frame *)(cmd->value);
-               p = *(unsigned long *)data;
-
-               b->path = MSM_FRAME_ENC;
-
-               fack.ybufaddr[0] =
-                       (uint32_t)(p + b->y_off);
-
-               fack.chromabufaddr[0] =
-                       (uint32_t)(p + b->cbcr_off);
-
-               if (b->path == MSM_FRAME_PREV_1)
-                       vfe_output1_ack(&fack);
-
-               if (b->path == MSM_FRAME_ENC ||
-                   b->path == MSM_FRAME_PREV_2)
-                       vfe_output2_ack(&fack);
-       }
-               break;
-
-       case CMD_SNAP_BUF_RELEASE: {
-       }
-               break;
-
-       case CMD_STATS_BUF_RELEASE: {
-               struct vfe_cmd_stats_wb_exp_ack sack;
-
-               if (!data)
-                       return -EFAULT;
-
-               sack.nextWbExpOutputBufferAddr = *(uint32_t *)data;
-               vfe_stats_wb_exp_ack(&sack);
-       }
-               break;
-
-       case CMD_AXI_CFG_OUT1: {
-               struct axidata *axid;
-
-               axid = data;
-               if (!axid)
-                       return -EFAULT;
-
-               axio = memdup_user((void __user *)(vfecmd.value),
-                                  sizeof(struct vfe_cmd_axi_output_config));
-               if (IS_ERR(axio))
-                       return PTR_ERR(axio);
-
-               vfe_config_axi(OUTPUT_1, axid, axio);
-               vfe_axi_output_config(axio);
-       }
-               break;
-
-       case CMD_AXI_CFG_OUT2:
-       case CMD_RAW_PICT_AXI_CFG: {
-               struct axidata *axid;
-
-               axid = data;
-               if (!axid)
-                       return -EFAULT;
-
-               axio = memdup_user((void __user *)(vfecmd.value),
-                                  sizeof(struct vfe_cmd_axi_output_config));
-               if (IS_ERR(axio))
-                       return PTR_ERR(axio);
-
-               vfe_config_axi(OUTPUT_2, axid, axio);
-
-               axio->outputDataSize = 0;
-               vfe_axi_output_config(axio);
-       }
-               break;
-
-       case CMD_AXI_CFG_SNAP_O1_AND_O2: {
-               struct axidata *axid;
-               axid = data;
-               if (!axid)
-                       return -EFAULT;
-
-               axio = memdup_user((void __user *)(vfecmd.value),
-                                  sizeof(struct vfe_cmd_axi_output_config));
-               if (IS_ERR(axio))
-                       return PTR_ERR(axio);
-
-               vfe_config_axi(OUTPUT_1_AND_2,
-                       axid, axio);
-               vfe_axi_output_config(axio);
-               cmd_data = axio;
-       }
-               break;
-
-       default:
-               break;
-       } /* switch */
-
-       kfree(scfg);
-
-       kfree(axio);
-
-/*
-       if (cmd->length > 256 &&
-                       cmd_data &&
-                       (cmd->cmd_type == CMD_GENERAL ||
-                        cmd->cmd_type == CMD_STATS_DISABLE)) {
-               kfree(cmd_data);
-       }
-*/
-       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 */
-       return msm_camio_enable(dev);
-}
-
-void msm_camvfe_fn_init(struct msm_camvfe_fn *fptr, void *data)
-{
-       mutex_init(&vfe_lock);
-       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;
-}
diff --git a/drivers/staging/dream/camera/msm_vfe8x.h b/drivers/staging/dream/camera/msm_vfe8x.h
deleted file mode 100644 (file)
index 28a70a9..0000000
+++ /dev/null
@@ -1,895 +0,0 @@
-/*
- * Copyright (C) 2008-2009 QUALCOMM Incorporated.
- */
-#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_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_OUTPUT1,
-       VFE_MSG_ID_OUTPUT2,
-       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,
-};
-
-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 {
-       int32_t  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/staging/dream/camera/msm_vfe8x_proc.c b/drivers/staging/dream/camera/msm_vfe8x_proc.c
deleted file mode 100644 (file)
index f80ef96..0000000
+++ /dev/null
@@ -1,4003 +0,0 @@
-/*
-* Copyright (C) 2008-2009 QUALCOMM Incorporated.
-*/
-#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>
-
-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;
-
-       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;
-
-       spinlock_t  ack_lock;
-       spinlock_t  state_lock;
-       spinlock_t  io_lock;
-
-       struct msm_vfe_callback *resp;
-       uint32_t extlen;
-       void *extdata;
-
-       spinlock_t  tasklet_lock;
-       struct list_head tasklet_q;
-
-       int vfeirq;
-       void __iomem *vfebase;
-
-       void *syncdata;
-};
-static struct msm_vfe8x_ctrl *ctrl;
-static irqreturn_t vfe_parse_irq(int irq_num, void *data);
-
-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;
-};
-
-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_read_reg_values(uint8_t *hwreg,
-       uint32_t *dest, uint32_t count)
-{
-       /* unsigned long flags; */
-       uint32_t *temp;
-       uint32_t i;
-
-       /* @todo This is causing issues, need further investigate */
-       /* spin_lock_irqsave(&ctrl->io_lock, flags); */
-
-       temp = (uint32_t *)(hwreg);
-       for (i = 0; i < count; i++)
-               *dest++ = *temp++;
-
-       /* spin_unlock_irqrestore(&ctrl->io_lock, flags); */
-}
-
-static struct vfe_irqenable vfe_read_irq_mask(void)
-{
-       /* unsigned long flags; */
-       uint32_t *temp;
-       struct vfe_irqenable rc;
-
-       memset(&rc, 0, sizeof(rc));
-
-       /* @todo This is causing issues, need further investigate */
-       /* spin_lock_irqsave(&ctrl->io_lock, flags); */
-       temp = (uint32_t *)(ctrl->vfebase + VFE_IRQ_MASK);
-
-       rc = *((struct vfe_irqenable *)temp);
-       /* spin_unlock_irqrestore(&ctrl->io_lock, flags); */
-
-       return rc;
-}
-
-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;
-
-       /* 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;
-
-       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)(*initGr))<<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 = (((int32_t)(*pDeltaR)) & 0x0000FFFF) |
-                       (((int32_t)(*pDeltaGr))<<16);
-               pDeltaR++;
-               pDeltaGr++;
-
-               writel(data, ctrl->vfebase + VFE_DMI_DATA_LO);
-
-               data = (((int32_t)(*pDeltaB)) & 0x0000FFFF) |
-                       (((int32_t)(*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_program_bus_rd_irq_en(uint32_t value)
-{
-       writel(value, ctrl->vfebase + VFE_BUS_PINGPONG_IRQ_EN);
-}
-
-static void vfe_camif_go(void)
-{
-       writel(CAMIF_COMMAND_START, ctrl->vfebase + CAMIF_COMMAND);
-}
-
-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_bus_cmd(uint32_t value)
-{
-       writel(value, ctrl->vfebase + VFE_BUS_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 void vfe_program_chroma_upsample_cfg(uint32_t value)
-{
-       writel(value, ctrl->vfebase + VFE_CHROMA_UPSAMPLE_CFG);
-}
-
-static uint32_t vfe_read_axi_status(void)
-{
-       return readl(ctrl->vfebase + VFE_AXI_STATUS);
-}
-
-static uint32_t vfe_read_pm_status_in_raw_capture(void)
-{
-       return readl(ctrl->vfebase + VFE_BUS_ENC_CBCR_WR_PM_STATS_1);
-}
-
-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 uint32_t vfe_read_camif_status(void)
-{
-       return readl(ctrl->vfebase + CAMIF_STATUS);
-}
-
-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, int32_t *elen)
-{
-       switch (type) {
-       case VFE_MSG_OUTPUT1: {
-               pinfo->y_phy =
-                       ((struct vfe_message *)data)->_u.msgOutput1.yBuffer;
-               pinfo->cbcr_phy =
-                       ((struct vfe_message *)data)->_u.msgOutput1.cbcrBuffer;
-
-               ((struct vfe_frame_extra *)ctrl->extdata)->bpcInfo =
-               ((struct vfe_message *)data)->_u.msgOutput1.bpcInfo;
-
-               ((struct vfe_frame_extra *)ctrl->extdata)->asfInfo =
-               ((struct vfe_message *)data)->_u.msgOutput1.asfInfo;
-
-               ((struct vfe_frame_extra *)ctrl->extdata)->frameCounter =
-               ((struct vfe_message *)data)->_u.msgOutput1.frameCounter;
-
-               ((struct vfe_frame_extra *)ctrl->extdata)->pmData =
-               ((struct vfe_message *)data)->_u.msgOutput1.pmData;
-
-               *ext  = ctrl->extdata;
-               *elen = ctrl->extlen;
-       }
-               break;
-
-       case VFE_MSG_OUTPUT2: {
-               pinfo->y_phy =
-                       ((struct vfe_message *)data)->_u.msgOutput2.yBuffer;
-               pinfo->cbcr_phy =
-                       ((struct vfe_message *)data)->_u.msgOutput2.cbcrBuffer;
-
-               CDBG("vfe_addr_convert, pinfo->y_phy = 0x%x\n", pinfo->y_phy);
-               CDBG("vfe_addr_convert, pinfo->cbcr_phy = 0x%x\n",
-                       pinfo->cbcr_phy);
-
-               ((struct vfe_frame_extra *)ctrl->extdata)->bpcInfo =
-               ((struct vfe_message *)data)->_u.msgOutput2.bpcInfo;
-
-               ((struct vfe_frame_extra *)ctrl->extdata)->asfInfo =
-               ((struct vfe_message *)data)->_u.msgOutput2.asfInfo;
-
-               ((struct vfe_frame_extra *)ctrl->extdata)->frameCounter =
-               ((struct vfe_message *)data)->_u.msgOutput2.frameCounter;
-
-               ((struct vfe_frame_extra *)ctrl->extdata)->pmData =
-               ((struct vfe_message *)data)->_u.msgOutput2.pmData;
-
-               *ext  = ctrl->extdata;
-               *elen = ctrl->extlen;
-       }
-               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 void
-vfe_proc_ops(enum VFE_MESSAGE_ID id, void *msg, size_t len)
-{
-       struct msm_vfe_resp *rp;
-
-       /* In 8k, OUTPUT1 & OUTPUT2 messages arrive before
-        * SNAPSHOT_DONE. We don't send such messages to user */
-
-       CDBG("ctrl->vfeOperationMode = %d, msgId = %d\n",
-               ctrl->vfeOperationMode, id);
-
-       if ((ctrl->vfeOperationMode == VFE_START_OPERATION_MODE_SNAPSHOT) &&
-               (id == VFE_MSG_ID_OUTPUT1 || id == VFE_MSG_ID_OUTPUT2)) {
-               return;
-       }
-
-       rp = ctrl->resp->vfe_alloc(sizeof(struct msm_vfe_resp), ctrl->syncdata);
-       if (!rp) {
-               CDBG("rp: cannot allocate buffer\n");
-               return;
-       }
-
-       CDBG("vfe_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 VFE_MSG_ID_SNAPSHOT_DONE:
-               rp->type = VFE_MSG_SNAPSHOT;
-               break;
-
-       case VFE_MSG_ID_OUTPUT1:
-               rp->type = VFE_MSG_OUTPUT1;
-               vfe_addr_convert(&(rp->phy), VFE_MSG_OUTPUT1,
-                       rp->evt_msg.data, &(rp->extdata),
-                       &(rp->extlen));
-               break;
-
-       case VFE_MSG_ID_OUTPUT2:
-               rp->type = VFE_MSG_OUTPUT2;
-               vfe_addr_convert(&(rp->phy), VFE_MSG_OUTPUT2,
-                               rp->evt_msg.data, &(rp->extdata),
-                               &(rp->extlen));
-               break;
-
-       case VFE_MSG_ID_STATS_AUTOFOCUS:
-               rp->type = VFE_MSG_STATS_AF;
-               vfe_addr_convert(&(rp->phy), VFE_MSG_STATS_AF,
-                               rp->evt_msg.data, NULL, NULL);
-               break;
-
-       case VFE_MSG_ID_STATS_WB_EXP:
-               rp->type = VFE_MSG_STATS_WE;
-               vfe_addr_convert(&(rp->phy), VFE_MSG_STATS_WE,
-                               rp->evt_msg.data, NULL, NULL);
-               break;
-
-       default:
-               rp->type = VFE_MSG_GENERAL;
-               break;
-       }
-
-       ctrl->resp->vfe_resp(rp, MSM_CAM_Q_VFE_MSG, ctrl->syncdata);
-}
-
-static void vfe_send_msg_no_payload(enum VFE_MESSAGE_ID id)
-{
-       struct vfe_message *msg;
-
-       msg = kzalloc(sizeof(*msg), GFP_ATOMIC);
-       if (!msg)
-               return;
-
-       msg->_d = id;
-       vfe_proc_ops(id, msg, 0);
-}
-
-static void vfe_send_bus_overflow_msg(void)
-{
-       struct vfe_message *msg;
-       msg =
-               kzalloc(sizeof(struct vfe_message), GFP_ATOMIC);
-       if (!msg)
-               return;
-
-       msg->_d = VFE_MSG_ID_BUS_OVERFLOW;
-#if 0
-       memcpy(&(msg->_u.msgBusOverflow),
-               &ctrl->vfePmData, sizeof(ctrl->vfePmData));
-#endif
-
-       vfe_proc_ops(VFE_MSG_ID_BUS_OVERFLOW,
-               msg, sizeof(struct vfe_message));
-}
-
-static void vfe_send_camif_error_msg(void)
-{
-#if 0
-       struct vfe_message *msg;
-       msg =
-               kzalloc(sizeof(struct vfe_message), GFP_ATOMIC);
-       if (!msg)
-               return;
-
-       msg->_d = VFE_MSG_ID_CAMIF_ERROR;
-       memcpy(&(msg->_u.msgCamifError),
-               &ctrl->vfeCamifStatusLocal, sizeof(ctrl->vfeCamifStatusLocal));
-
-       vfe_proc_ops(VFE_MSG_ID_CAMIF_ERROR,
-               msg, sizeof(struct vfe_message));
-#endif
-}
-
-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_send_msg_no_payload(VFE_MSG_ID_AF_OVERFLOW);
-
-       if (irqstatus->awbOverflowIrq)
-               vfe_send_msg_no_payload(VFE_MSG_ID_AWB_OVERFLOW);
-
-       if (irqstatus->axiErrorIrq)
-               vfe_send_msg_no_payload(VFE_MSG_ID_AXI_ERROR);
-
-       if (irqstatus->busOverflowIrq)
-               vfe_send_bus_overflow_msg();
-
-       if (irqstatus->camifErrorIrq)
-               vfe_send_camif_error_msg();
-
-       if (irqstatus->camifOverflowIrq)
-               vfe_send_msg_no_payload(VFE_MSG_ID_CAMIF_OVERFLOW);
-
-       if (irqstatus->violationIrq)
-               ;
-}
-
-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;
-       }
-}
-
-static int vfe_get_af_pingpong_status(void)
-{
-       uint32_t busPingPongStatus;
-       int rc = 0;
-
-       busPingPongStatus =
-               readl(ctrl->vfebase + VFE_BUS_PINGPONG_STATUS);
-
-       if ((busPingPongStatus & VFE_AF_PINGPONG_STATUS_BIT) == 0)
-               return -EFAULT;
-
-       return rc;
-}
-
-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 void
-vfe_send_af_stats_msg(uint32_t afBufAddress)
-{
-       /* unsigned long flags; */
-       struct vfe_message *msg;
-       msg =
-               kzalloc(sizeof(struct vfe_message), GFP_ATOMIC);
-       if (!msg)
-               return;
-
-       /* 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) {
-               kfree(msg);
-               goto af_stats_done;
-       }
-
-       msg->_d = VFE_MSG_ID_STATS_AUTOFOCUS;
-       msg->_u.msgStatsAf.afBuffer = afBufAddress;
-       msg->_u.msgStatsAf.frameCounter = ctrl->vfeFrameId;
-
-       vfe_proc_ops(VFE_MSG_ID_STATS_AUTOFOCUS,
-               msg, sizeof(struct vfe_message));
-
-       ctrl->afStatsControl.ackPending = TRUE;
-
-af_stats_done:
-       /* spin_unlock_irqrestore(&ctrl->state_lock, flags); */
-       return;
-}
-
-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_send_af_stats_msg(ctrl->afStatsControl.bufToRender);
-       } else
-               ctrl->afStatsControl.droppedStatsFrameCount++;
-}
-
-static boolean vfe_get_awb_pingpong_status(void)
-{
-       uint32_t busPingPongStatus;
-
-       busPingPongStatus =
-               readl(ctrl->vfebase + VFE_BUS_PINGPONG_STATUS);
-
-       if ((busPingPongStatus & VFE_AWB_PINGPONG_STATUS_BIT) == 0)
-               return FALSE;
-
-       return TRUE;
-}
-
-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 void vfe_send_awb_stats_msg(uint32_t awbBufAddress)
-{
-       /* unsigned long flags; */
-       struct vfe_message   *msg;
-
-       msg =
-               kzalloc(sizeof(struct vfe_message), GFP_ATOMIC);
-       if (!msg)
-               return;
-
-       /* 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) {
-               kfree(msg);
-               goto awb_stats_done;
-       }
-
-       msg->_d = VFE_MSG_ID_STATS_WB_EXP;
-       msg->_u.msgStatsWbExp.awbBuffer = awbBufAddress;
-       msg->_u.msgStatsWbExp.frameCounter = ctrl->vfeFrameId;
-
-       vfe_proc_ops(VFE_MSG_ID_STATS_WB_EXP,
-               msg, sizeof(struct vfe_message));
-
-       ctrl->awbStatsControl.ackPending = TRUE;
-
-awb_stats_done:
-       /* spin_unlock_irqrestore(&ctrl->state_lock, flags); */
-       return;
-}
-
-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_send_awb_stats_msg(ctrl->awbStatsControl.bufToRender);
-
-       } else
-               ctrl->awbStatsControl.droppedStatsFrameCount++;
-}
-
-static void vfe_process_sync_timer_irq(
-       struct vfe_interrupt_status *irqstatus)
-{
-       if (irqstatus->syncTimer0Irq)
-               vfe_send_msg_no_payload(VFE_MSG_ID_SYNC_TIMER0_DONE);
-
-       if (irqstatus->syncTimer1Irq)
-               vfe_send_msg_no_payload(VFE_MSG_ID_SYNC_TIMER1_DONE);
-
-       if (irqstatus->syncTimer2Irq)
-               vfe_send_msg_no_payload(VFE_MSG_ID_SYNC_TIMER2_DONE);
-}
-
-static void vfe_process_async_timer_irq(
-       struct vfe_interrupt_status *irqstatus)
-{
-
-       if (irqstatus->asyncTimer0Irq)
-               vfe_send_msg_no_payload(VFE_MSG_ID_ASYNC_TIMER0_DONE);
-
-       if (irqstatus->asyncTimer1Irq)
-               vfe_send_msg_no_payload(VFE_MSG_ID_ASYNC_TIMER1_DONE);
-
-       if (irqstatus->asyncTimer2Irq)
-               vfe_send_msg_no_payload(VFE_MSG_ID_ASYNC_TIMER2_DONE);
-
-       if (irqstatus->asyncTimer3Irq)
-               vfe_send_msg_no_payload(VFE_MSG_ID_ASYNC_TIMER3_DONE);
-}
-
-static void vfe_send_violation_msg(void)
-{
-       vfe_send_msg_no_payload(VFE_MSG_ID_VIOLATION);
-}
-
-static void vfe_send_async_timer_msg(void)
-{
-       vfe_send_msg_no_payload(VFE_MSG_ID_ASYNC_TIMER0_DONE);
-}
-
-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);
-       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 struct vfe_interrupt_status
-vfe_parse_interrupt_status(uint32_t irqStatusIn)
-{
-       struct vfe_irqenable hwstat;
-       struct vfe_interrupt_status ret;
-       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.awbPingpongIrq   ||
-               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;
-
-       return ret;
-}
-
-static struct vfe_frame_asf_info
-vfe_get_asf_frame_info(struct vfe_irq_thread_msg *in)
-{
-       struct vfe_asf_info     asfInfoTemp;
-       struct vfe_frame_asf_info rc;
-
-       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;
-
-       return rc;
-}
-
-static struct vfe_frame_bpc_info
-vfe_get_demosaic_frame_info(struct vfe_irq_thread_msg *in)
-{
-       struct vfe_bps_info     bpcInfoTemp;
-       struct vfe_frame_bpc_info rc;
-
-       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;
-
-       return rc;
-}
-
-static struct vfe_msg_camif_status
-vfe_get_camif_status(struct vfe_irq_thread_msg *in)
-{
-       struct vfe_camif_stats camifStatusTemp;
-       struct vfe_msg_camif_status rc;
-
-       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;
-
-       return rc;
-}
-
-static struct vfe_bus_performance_monitor
-vfe_get_performance_monitor_data(struct vfe_irq_thread_msg *in)
-{
-       struct vfe_bus_performance_monitor rc;
-       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;
-
-       return rc;
-}
-
-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_send_msg_no_payload(VFE_MSG_ID_START_ACK);
-               ctrl->vfeStartAckPendingFlag = FALSE;
-       } else
-               vfe_send_msg_no_payload(VFE_MSG_ID_UPDATE_ACK);
-}
-
-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_send_msg_no_payload(VFE_MSG_ID_STOP_ACK);
-       } else {
-               vfe_set_default_reg_values();
-               vfe_send_msg_no_payload(VFE_MSG_ID_RESET_ACK);
-       }
-}
-
-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 void vfe_send_output2_msg(
-       struct vfe_msg_output *pPayload)
-{
-       /* unsigned long flags; */
-       struct vfe_message *msg;
-
-       msg = kzalloc(sizeof(struct vfe_message), GFP_ATOMIC);
-       if (!msg)
-               return;
-
-       /* 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) {
-               kfree(msg);
-               goto output2_msg_done;
-       }
-
-       msg->_d = VFE_MSG_ID_OUTPUT2;
-
-       memcpy(&(msg->_u.msgOutput2),
-               (void *)pPayload, sizeof(struct vfe_msg_output));
-
-       vfe_proc_ops(VFE_MSG_ID_OUTPUT2,
-               msg, sizeof(struct vfe_message));
-
-       ctrl->encPath.ackPending = TRUE;
-
-       if (!(ctrl->vfeRequestedSnapShotCount <= 3) &&
-                       (ctrl->vfeOperationMode ==
-                        VFE_START_OPERATION_MODE_SNAPSHOT))
-               ctrl->encPath.ackPending = TRUE;
-
-output2_msg_done:
-       /* spin_unlock_irqrestore(&ctrl->state_lock, flags); */
-       return;
-}
-
-static void vfe_send_output1_msg(
-       struct vfe_msg_output *pPayload)
-{
-       /* unsigned long flags; */
-       struct vfe_message *msg;
-
-       msg = kzalloc(sizeof(struct vfe_message), GFP_ATOMIC);
-       if (!msg)
-               return;
-
-       /* @todo This is causing issues, need further investigate */
-       /* spin_lock_irqsave(&ctrl->state_lock, flags); */
-       if (ctrl->vstate != VFE_STATE_ACTIVE) {
-               kfree(msg);
-               goto output1_msg_done;
-       }
-
-       msg->_d = VFE_MSG_ID_OUTPUT1;
-       memmove(&(msg->_u),
-               (void *)pPayload, sizeof(struct vfe_msg_output));
-
-       vfe_proc_ops(VFE_MSG_ID_OUTPUT1,
-               msg, sizeof(struct vfe_message));
-
-       ctrl->viewPath.ackPending = TRUE;
-
-       if (!(ctrl->vfeRequestedSnapShotCount <= 3) &&
-                       (ctrl->vfeOperationMode ==
-                        VFE_START_OPERATION_MODE_SNAPSHOT))
-               ctrl->viewPath.ackPending = TRUE;
-
-output1_msg_done:
-       /* spin_unlock_irqrestore(&ctrl->state_lock, flags); */
-       return;
-}
-
-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; */
-               vfe_send_output2_msg(&msgPayload);
-       } else {
-               /* msgPayload.pmData = ctrl->vfePmData.viewPathPmInfo; */
-               vfe_send_output1_msg(&msgPayload);
-       }
-}
-
-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];
-       static uint32_t fcnt;
-
-       if (fcnt++ < 3)
-               return;
-
-       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_send_msg_no_payload(VFE_MSG_ID_SNAPSHOT_DONE);
-                       vfe_prog_hw_testgen_cmd(VFE_TEST_GEN_STOP);
-                       vfe_pm_stop();
-               }
-       }
-}
-
-static void vfe_do_tasklet(unsigned long data)
-{
-       unsigned long flags;
-
-       struct isr_queue_cmd *qcmd = NULL;
-
-       CDBG("=== vfe_do_tasklet start === \n");
-
-       spin_lock_irqsave(&ctrl->tasklet_lock, flags);
-       qcmd = list_first_entry(&ctrl->tasklet_q,
-                       struct isr_queue_cmd, list);
-
-       if (!qcmd) {
-               spin_unlock_irqrestore(&ctrl->tasklet_lock, flags);
-               return;
-       }
-
-       list_del(&qcmd->list);
-       spin_unlock_irqrestore(&ctrl->tasklet_lock, flags);
-
-       if (qcmd->vfeInterruptStatus.regUpdateIrq) {
-               CDBG("irq       regUpdateIrq\n");
-               vfe_process_reg_update_irq();
-       }
-
-       if (qcmd->vfeInterruptStatus.resetAckIrq) {
-               CDBG("irq       resetAckIrq\n");
-               vfe_process_reset_irq();
-       }
-
-       spin_lock_irqsave(&ctrl->state_lock, flags);
-       if (ctrl->vstate != VFE_STATE_ACTIVE) {
-               spin_unlock_irqrestore(&ctrl->state_lock, flags);
-               return;
-       }
-       spin_unlock_irqrestore(&ctrl->state_lock, flags);
-
-#if 0
-       if (qcmd->vfeInterruptStatus.camifEpoch1Irq)
-               vfe_send_msg_no_payload(VFE_MSG_ID_EPOCH1);
-
-       if (qcmd->vfeInterruptStatus.camifEpoch2Irq)
-               vfe_send_msg_no_payload(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();
-       }
-
-       kfree(qcmd);
-       CDBG("=== vfe_do_tasklet end === \n");
-}
-
-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");
-
-       vfe_read_irq_status(&irq);
-
-       if (irq.vfeIrqStatus == 0) {
-               CDBG("vfe_parse_irq: irq.vfeIrqStatus is 0\n");
-               return IRQ_HANDLED;
-       }
-
-       qcmd = kzalloc(sizeof(struct isr_queue_cmd),
-               GFP_ATOMIC);
-       if (!qcmd) {
-               CDBG("vfe_parse_irq: qcmd malloc failed!\n");
-               return IRQ_HANDLED;
-       }
-
-       spin_lock_irqsave(&ctrl->ack_lock, flags);
-
-       if (ctrl->vfeStopAckPending)
-               irqStatusLocal =
-                       (VFE_IMASK_WHILE_STOPPING & irq.vfeIrqStatus);
-       else
-               irqStatusLocal =
-                       ((ctrl->vfeImaskPacked | VFE_IMASK_ERROR_ONLY) &
-                               irq.vfeIrqStatus);
-
-       spin_unlock_irqrestore(&ctrl->ack_lock, flags);
-
-       /* first parse the interrupt status to local data structures. */
-       qcmd->vfeInterruptStatus = vfe_parse_interrupt_status(irqStatusLocal);
-       qcmd->vfeAsfFrameInfo = vfe_get_asf_frame_info(&irq);
-       qcmd->vfeBpcFrameInfo = vfe_get_demosaic_frame_info(&irq);
-       qcmd->vfeCamifStatusLocal = vfe_get_camif_status(&irq);
-       qcmd->vfePmData = vfe_get_performance_monitor_data(&irq);
-
-       spin_lock_irqsave(&ctrl->tasklet_lock, flags);
-       list_add_tail(&qcmd->list, &ctrl->tasklet_q);
-       spin_unlock_irqrestore(&ctrl->tasklet_lock, flags);
-       tasklet_schedule(&vfe_tasklet);
-
-       /* 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;
-
-       vfemem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!vfemem) {
-               CDBG("no mem resource?\n");
-               return -ENODEV;
-       }
-
-       vfeirq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-       if (!vfeirq) {
-               CDBG("no irq resource?\n");
-               return -ENODEV;
-       }
-
-       vfeio = request_mem_region(vfemem->start,
-               resource_size(vfemem), pdev->name);
-       if (!vfeio) {
-               CDBG("VFE region already claimed\n");
-               return -EBUSY;
-       }
-
-       ctrl =
-       kzalloc(sizeof(struct msm_vfe8x_ctrl), GFP_KERNEL);
-       if (!ctrl) {
-               rc = -ENOMEM;
-               goto cmd_init_failed1;
-       }
-
-       ctrl->vfeirq  = vfeirq->start;
-
-       ctrl->vfebase =
-               ioremap(vfemem->start, (vfemem->end - vfemem->start) + 1);
-       if (!ctrl->vfebase) {
-               rc = -ENOMEM;
-               goto cmd_init_failed2;
-       }
-
-       rc = request_irq(ctrl->vfeirq, vfe_parse_irq,
-               IRQF_TRIGGER_RISING, "vfe", 0);
-       if (rc < 0)
-               goto cmd_init_failed2;
-
-       if (presp && presp->vfe_resp)
-               ctrl->resp = presp;
-       else {
-               rc = -EINVAL;
-               goto cmd_init_failed3;
-       }
-
-       ctrl->extdata =
-               kmalloc(sizeof(struct vfe_frame_extra), GFP_KERNEL);
-       if (!ctrl->extdata) {
-               rc = -ENOMEM;
-               goto cmd_init_failed3;
-       }
-
-       spin_lock_init(&ctrl->ack_lock);
-       spin_lock_init(&ctrl->state_lock);
-       spin_lock_init(&ctrl->io_lock);
-
-       ctrl->extlen = sizeof(struct vfe_frame_extra);
-
-       spin_lock_init(&ctrl->tasklet_lock);
-       INIT_LIST_HEAD(&ctrl->tasklet_q);
-
-       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;
-
-       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);
-
-       ctrl->extlen = 0;
-
-       kfree(ctrl->extdata);
-       kfree(ctrl);
-}
-
-void vfe_stats_af_stop(void)
-{
-       ctrl->vfeStatsCmdLocal.autoFocusEnable = FALSE;
-       ctrl->vfeImaskLocal.afPingpongIrq = FALSE;
-}
-
-void vfe_stop(void)
-{
-       boolean vfeAxiBusy;
-       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);
-
-       vfeAxiBusy = TRUE;
-
-       while (vfeAxiBusy) {
-               vfeAxiStauts = vfe_read_axi_status();
-               if ((vfeAxiStauts & AXI_STATUS_BUSY_MASK) != 0)
-                       vfeAxiBusy = FALSE;
-       }
-
-       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:
-               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:
-               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_output2_ack(struct vfe_cmd_output_ack *in)
-{
-       const uint32_t *psrc;
-       uint32_t *pdest;
-       uint8_t i;
-
-       pdest = ctrl->encPath.nextFrameAddrBuf;
-
-       CDBG("output2_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_output1_ack(struct vfe_cmd_output_ack *in)
-{
-       const uint32_t *psrc;
-       uint32_t *pdest;
-       uint8_t i;
-
-       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;
-}
-
-void vfe_start(struct vfe_cmd_start *in)
-{
-       unsigned long flags;
-       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;
-          &nbs