[Title] Modified camera, backlight & fixed build error
authorjinhyung.jo <jinhyung.jo@samsung.com>
Mon, 4 Jun 2012 12:57:40 +0000 (21:57 +0900)
committerjinhyung.jo <jinhyung.jo@samsung.com>
Mon, 4 Jun 2012 12:57:40 +0000 (21:57 +0900)
[Type] Enhancement
[Module] Emulator-Kernel
[Priority] Major
[CQ#]
[Redmine#]
[Problem] Build Error
[Cause]
[Solution]
[TestCase]

arch/x86/configs/i386_emul_defconfig
drivers/maru/maru_bl.c
drivers/maru/maru_camera.c

index c704c5fd867d3eeb27df1c019149b49f9cb85780..ac2db680d5ce551517f4ff3c32587781be637106 100644 (file)
@@ -2799,8 +2799,8 @@ CONFIG_MARU_LCD=y
 CONFIG_MARU_CODEC=y
 CONFIG_MARU_TOUCHSCREEN=y
 CONFIG_MARU_FB=y
-# CONFIG_MARU_CAMERA is not set
-# CONFIG_MARU_BACKLIGHT is not set
+CONFIG_MARU_CAMERA=y
+CONFIG_MARU_BACKLIGHT=y
 CONFIG_MARU_OVERLAY=y
 CONFIG_MARU_JACK=y
 CONFIG_MARU_POWER_SUPPLY=y
index 10c9ed4316c6255d9709d9b4d80ca2073f3ac485..bc6839f887645b360d48420a4c4099d6c8cf643c 100644 (file)
@@ -111,6 +111,7 @@ static int __devinit marubl_probe(struct pci_dev *pci_dev,
 {
        int ret;
        struct backlight_device *bd;
+       struct backlight_properties props;
 
        marubl_device = kmalloc(sizeof(struct marubl), GFP_KERNEL);
        if (marubl_device == NULL) {
@@ -147,14 +148,16 @@ static int __devinit marubl_probe(struct pci_dev *pci_dev,
        /*
         * register backlight device
         */
-       bd = backlight_device_register ("emulator",     &pci_dev->dev, NULL, &marubl_ops);
+       memset(&props, 0, sizeof(struct backlight_properties));
+       props.max_brightness = max_brightness;
+       props.type = BACKLIGHT_PLATFORM;
+       bd = backlight_device_register ("emulator",     &pci_dev->dev, NULL, &marubl_ops, &props);
        if (IS_ERR (bd)) {
                ret = PTR_ERR (bd);
                goto outnotdev;
        }
 
        bd->props.brightness = (unsigned int)readl(marubl_device->marubl_mmreg);;
-       bd->props.max_brightness = max_brightness;
        bd->props.power = FB_BLANK_UNBLANK;
        backlight_update_status(bd);
 
index 1c77678cb4064a61ce277caa343a7c785b5d4f62..9fd7b81bc4966541813bcf2adac18a90979d051f 100644 (file)
@@ -52,7 +52,7 @@
 #include <media/v4l2-device.h>
 #include <media/v4l2-ioctl.h>
 
-static unsigned debug = 1;
+static unsigned debug = 0;
 
 #define marucam_err(fmt, arg...) \
        printk(KERN_ERR "marucam[%s] : " fmt, __func__, ##arg)
@@ -72,7 +72,7 @@ static unsigned debug = 1;
 #define MARUCAM_MODULE_NAME "marucam"
 
 #define MARUCAM_MAJOR_VERSION 0
-#define MARUCAM_MINOR_VERSION 20
+#define MARUCAM_MINOR_VERSION 22
 #define MARUCAM_RELEASE 1
 #define MARUCAM_VERSION \
        KERNEL_VERSION(MARUCAM_MAJOR_VERSION, MARUCAM_MINOR_VERSION, MARUCAM_RELEASE)
@@ -81,8 +81,8 @@ MODULE_DESCRIPTION("MARU Virtual Camera Driver");
 MODULE_AUTHOR("Jinhyung Jo <jinhyung.jo@samsung.com>");
 MODULE_LICENSE("GPL2");
 
-#define DFL_WIDTH      320
-#define DFL_HEIGHT     240
+#define DFL_WIDTH      640
+#define DFL_HEIGHT     480
 
 /* ------------------------------------------------------------------
        Basic structures
@@ -203,14 +203,16 @@ static const struct vm_operations_struct videobuf_vm_ops =
        .close    = videobuf_vm_close,
 };
 
-static void *__videobuf_alloc(size_t size)
+static struct videobuf_buffer *__videobuf_alloc_vb(size_t size)
 {
        struct videobuf_marucam_memory *mem;
        struct videobuf_buffer *vb;
 
-       vb = kzalloc(size+sizeof(*mem),GFP_KERNEL);
+       vb = kzalloc(size + sizeof(*mem), GFP_KERNEL);
+       if (vb == NULL)
+               return vb;
 
-       mem = vb->priv = ((char *)vb)+size;
+       mem = vb->priv = ((char *)vb) + size;
        mem->magic = MAGIC_MARUCAM_MEM;
 
        return vb;
@@ -241,63 +243,23 @@ static int __videobuf_iolock (struct videobuf_queue* q,
        return 0;
 }
 
-static int __videobuf_sync(struct videobuf_queue *q,
-                          struct videobuf_buffer *buf)
-{
-       return 0;
-}
-
-static int __videobuf_mmap_free(struct videobuf_queue *q)
-{
-       unsigned int i;
-
-       for (i = 0; i < VIDEO_MAX_FRAME; i++) {
-               if (q->bufs[i]) {
-                       if (q->bufs[i]->map)
-                               return -EBUSY;
-               }
-       }
-
-       return 0;
-}
-
 static int __videobuf_mmap_mapper(struct videobuf_queue *q,
-                        struct vm_area_struct *vma)
+                       struct videobuf_buffer *buf, struct vm_area_struct *vma)
 {
        struct videobuf_marucam_memory *mem;
        struct videobuf_mapping *map;
-       unsigned int first;
        int retval, pages;
-       unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
-
-       if (!(vma->vm_flags & VM_WRITE) || !(vma->vm_flags & VM_SHARED))
-               return -EINVAL;
-
-       for (first = 0; first < VIDEO_MAX_FRAME; first++) {
-               if (NULL == q->bufs[first])
-                       continue;
-
-               if (V4L2_MEMORY_MMAP != q->bufs[first]->memory)
-                       continue;
-               if (q->bufs[first]->boff == offset)
-                       break;
-       }
-       if (VIDEO_MAX_FRAME == first) {
-               return -EINVAL;
-       }
 
        map = kzalloc(sizeof(struct videobuf_mapping), GFP_KERNEL);
        if (NULL == map)
                return -ENOMEM;
 
-       q->bufs[first]->map = map;
-       map->start = vma->vm_start;
-       map->end   = vma->vm_end;
+       buf->map = map;
        map->q     = q;
 
-       q->bufs[first]->baddr = vma->vm_start;
+       buf->baddr = vma->vm_start;
 
-       mem = q->bufs[first]->priv;
+       mem = buf->priv;
        BUG_ON(!mem);
        mem->mapped = 1;
        MAGIC_CHECK(mem->magic, MAGIC_MARUCAM_MEM);
@@ -331,10 +293,8 @@ error:
 static struct videobuf_qtype_ops qops = {
        .magic        = MAGIC_QTYPE_OPS,
 
-       .alloc        = __videobuf_alloc,
+       .alloc_vb     = __videobuf_alloc_vb,
        .iolock       = __videobuf_iolock,
-       .sync         = __videobuf_sync,
-       .mmap_free    = __videobuf_mmap_free,
        .mmap_mapper  = __videobuf_mmap_mapper,
 };
 
@@ -345,10 +305,11 @@ void videobuf_queue_marucam_init(struct videobuf_queue* q,
                         enum v4l2_buf_type type,
                         enum v4l2_field field,
                         unsigned int msize,
-                        void *priv)
+                        void *priv,
+                        struct mutex *ext_lock)
 {
        videobuf_queue_core_init(q, ops, dev, irqlock, type, field, msize,
-                                priv, &qops);
+                                priv, &qops, ext_lock);
 }
 
 
@@ -932,7 +893,7 @@ static int marucam_open(struct file *file)
 
        videobuf_queue_marucam_init(&dev->vb_vidq, &marucam_video_qops,
                                &dev->pdev->dev, &dev->slock, dev->type, V4L2_FIELD_NONE,
-                               sizeof(struct videobuf_buffer), dev);
+                               sizeof(struct videobuf_buffer), dev, NULL);
        
        iowrite32(0, dev->mmregs + MARUCAM_OPEN);
        ret = (int)ioread32(dev->mmregs + MARUCAM_OPEN);