From: Yusuf Caglar Akyuz <cag...@bilkon-kontrol.com.tr>

2.6.10 driver mostly usable but there are some compile errors:

 * Header inclusions updated for newer kernels.
 * Old driver uses devfs, this has changed as well class interfaces.
 * dev_dbg statements changed.

Signed-off-by: Yusuf Caglar Akyuz <cag...@bilkon-kontrol.com.tr>
---
 arch/arm/mach-davinci/include/mach/resizer.h    |   10 +--
 arch/arm/mach-davinci/include/mach/resizer_hw.h |    6 +-
 arch/arm/mach-davinci/resizer.c                 |   98 ++++++++++-------------
 arch/arm/mach-davinci/resizer_hw.c              |   13 ++--
 4 files changed, 55 insertions(+), 72 deletions(-)

diff --git a/arch/arm/mach-davinci/include/mach/resizer.h 
b/arch/arm/mach-davinci/include/mach/resizer.h
index 05a54e9..d6020fc 100644
--- a/arch/arm/mach-davinci/include/mach/resizer.h
+++ b/arch/arm/mach-davinci/include/mach/resizer.h
@@ -21,9 +21,8 @@
 
 #ifdef __KERNEL__
 /* include Linux files */
-#include <asm/arch/hardware.h>
-#include <asm/io.h>
-#include <linux/config.h>
+#include <mach/hardware.h>
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
@@ -48,10 +47,9 @@
 #include <linux/version.h>
 #include <asm/irq.h>
 #include <asm/io.h>
-#include <asm/hardware/clock.h>
+#include <linux/clk.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
-#include <asm/arch/hardware.h>
 #include <linux/err.h>
 #include <linux/proc_fs.h>
 #include <linux/sysctl.h>
@@ -362,7 +360,7 @@ int delete_from_array(channel_config_t * 
rsz_configuration_channel);
 int rsz_set_params(rsz_params_t *, channel_config_t *);
 int rsz_get_params(rsz_params_t *, channel_config_t *);
 int free_buff(channel_config_t * rsz_configuration_channel);
-irqreturn_t rsz_isr(int, void *, struct pt_regs *);
+irqreturn_t rsz_isr(int, void *);
 void rsz_calculate_crop(channel_config_t * rsz_conf_chan,
                        rsz_cropsize_t * cropsize);
 #endif                         /* end of #ifdef __KERNEL__ */
diff --git a/arch/arm/mach-davinci/include/mach/resizer_hw.h 
b/arch/arm/mach-davinci/include/mach/resizer_hw.h
index 775ab59..c66ef9b 100644
--- a/arch/arm/mach-davinci/include/mach/resizer_hw.h
+++ b/arch/arm/mach-davinci/include/mach/resizer_hw.h
@@ -19,9 +19,9 @@
 #ifndef        DAVINCI_RESIZER_HW
 #define        DAVINCI_RESIZER_HW
 
-#include <asm/arch/davinci_resizer.h>
-#include <asm/arch/hardware.h>
-#include <asm/io.h>
+#include <mach/resizer.h>
+#include <mach/hardware.h>
+#include <linux/io.h>
 
 /* Register    offset mapping*/
 #define        RESIZER_IOBASE_VADDR    IO_ADDRESS(0x01C70C00)
diff --git a/arch/arm/mach-davinci/resizer.c b/arch/arm/mach-davinci/resizer.c
index a1197f3..649010e 100644
--- a/arch/arm/mach-davinci/resizer.c
+++ b/arch/arm/mach-davinci/resizer.c
@@ -18,7 +18,6 @@
 /* davinci_resizer.c file */
 
 /*Header files*/
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
@@ -34,10 +33,10 @@
 #include <asm/irq.h>
 #include <asm/io.h>
 #include <linux/err.h>
-#include <linux/devfs_fs_kernel.h>     /* for devfs */
 #include <linux/device.h>
-#include <asm/arch/davinci_resizer_hw.h>
-#include <asm/arch/davinci_resizer.h>
+#include <linux/platform_device.h>
+#include <mach/resizer_hw.h>
+#include <mach/resizer.h>
 
 #define        DRIVERNAME      "DaVinciResizer"
 
@@ -94,7 +93,7 @@ int malloc_buff(rsz_reqbufs_t * reqbuff, channel_config_t * 
rsz_conf_chan)
        unsigned long adr;
        unsigned long size;
 
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
 
        /* assigning the buf_ptr to input buffer which is array of void
           pointer */
@@ -234,7 +233,7 @@ int malloc_buff(rsz_reqbufs_t * reqbuff, channel_config_t * 
rsz_conf_chan)
        /* this will be useful only when numbuffers = 0 */
        *buf_size = reqbuff->size;
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");
+       dev_dbg(rsz_device, "%s L\n", __func__);
 
        return SUCESS;
 }                              /*     end     of function     Main_buff */
@@ -246,7 +245,7 @@ int get_buf_address(rsz_buffer_t * buffer, channel_config_t 
* rsz_conf_chan)
 {
        int buffer_index = 0;
 
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
 
        if (buffer == NULL)
                return -EINVAL;
@@ -313,7 +312,7 @@ int get_buf_address(rsz_buffer_t * buffer, channel_config_t 
* rsz_conf_chan)
        dev_dbg(rsz_device, "the physical offset returned after query \
                                                is %x", buffer->offset);
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");
+       dev_dbg(rsz_device, "%s L\n", __func__);
 
        return SUCESS;
 
@@ -344,7 +343,7 @@ int rsz_start(rsz_resize_t * resize, channel_config_t * 
rsz_conf_chan)
        /* For calculating the number of output buffers allocated */
        int buffer_out_index = ZERO;
 
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
        /* checking     the     configuartion status */
        if (rsz_conf_chan->config_state) {
                dev_dbg(rsz_device, "State not configured \n");
@@ -471,7 +470,7 @@ int rsz_start(rsz_resize_t * resize, channel_config_t * 
rsz_conf_chan)
 
        delete_from_array(rsz_conf_chan);
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");
+       dev_dbg(rsz_device, "%s L\n", __func__);
 
        return ret;
 }                              /*End of function Start_Resize */
@@ -485,7 +484,7 @@ int add_to_array(channel_config_t * rsz_conf_chan)
 {
        int array_index, device_index;
 
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
 
        /* locking the configuartion aaray */
        down_interruptible(&device_config.array_sem);
@@ -540,7 +539,7 @@ int add_to_array(channel_config_t * rsz_conf_chan)
                up(&device_config.array_sem);
        }
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");
+       dev_dbg(rsz_device, "%s L\n", __func__);
 
        return SUCESS;
 }                              /*  end of function addToarray */
@@ -553,7 +552,7 @@ int delete_from_array(channel_config_t * rsz_conf_chan)
 {
        int array_index = FIRSTENTRY, device_index;
 
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
 
        down_interruptible(&(device_config.array_sem));
 
@@ -600,7 +599,7 @@ int delete_from_array(channel_config_t * rsz_conf_chan)
                up(&(device_config.array_sem));
        }
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");
+       dev_dbg(rsz_device, "%s L\n", __func__);
 
        return SUCESS;
 }                              /*     end     of function     deleteFromarray 
*/
@@ -614,7 +613,7 @@ int rsz_set_params(rsz_params_t * params, channel_config_t 
* rsz_conf_chan)
        int hsize;
        int vsize;
 
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
 
        /* calculating the horizontal and vertical ratio */
        vrsz = (params->in_vsize - NUM_D2TAPS) * RATIO_MULTIPLIER /
@@ -902,7 +901,7 @@ int rsz_set_params(rsz_params_t * params, channel_config_t 
* rsz_conf_chan)
        dev_dbg(rsz_device, "Resizer State configured \n");
        rsz_conf_chan->config_state = STATE_CONFIGURED;
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");
+       dev_dbg(rsz_device, "%s L\n", __func__);
 
        return SUCESS;
 }                              /*End of rsz_Set_Params */
@@ -916,7 +915,7 @@ int rsz_get_params(rsz_params_t * params, channel_config_t 
* rsz_conf_chan)
 {
        int coeffcounter;
 
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
 
        if (rsz_conf_chan->config_state) {
                dev_dbg(rsz_device, "   state not configured \n");
@@ -1035,7 +1034,7 @@ int rsz_get_params(rsz_params_t * params, 
channel_config_t * rsz_conf_chan)
        else
                params->pix_fmt = RSZ_PIX_FMT_YUYV;
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");
+       dev_dbg(rsz_device, "%s L\n", __func__);
        return SUCESS;
 }
 
@@ -1043,7 +1042,7 @@ void rsz_calculate_crop(channel_config_t * rsz_conf_chan,
                        rsz_cropsize_t * cropsize)
 {
        int luma_enable;
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
 
        cropsize->hcrop = ZERO;
        cropsize->vcrop = ZERO;
@@ -1057,7 +1056,7 @@ void rsz_calculate_crop(channel_config_t * rsz_conf_chan,
                cropsize->hcrop += 2;
        }
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");;
+       dev_dbg(rsz_device, "%s L\n", __func__);
 }
 
 /*
@@ -1068,7 +1067,7 @@ int free_buff(channel_config_t * rsz_conf_chan)
 {
        int buffercounter = ZERO;
 
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
 
        /* Free all     the     input buffers */
        while (rsz_conf_chan->input_buffer[buffercounter] != NULL
@@ -1092,7 +1091,7 @@ int free_buff(channel_config_t * rsz_conf_chan)
                buffercounter++;
        }
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");
+       dev_dbg(rsz_device, "%s L\n", __func__);
 
        return SUCESS;
 }
@@ -1106,7 +1105,7 @@ static int rsz_open(struct inode *inode, struct file 
*filp)
        channel_config_t *rsz_conf_chan;
        int buffercounter;
 
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
 
        if (filp->f_flags == O_NONBLOCK)
                return -1;
@@ -1173,7 +1172,7 @@ static int rsz_open(struct inode *inode, struct file 
*filp)
        /* taking the configuartion     structure in private data */
        filp->private_data = rsz_conf_chan;
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");
+       dev_dbg(rsz_device, "%s L\n", __func__);
 
        return SUCESS;
 
@@ -1193,12 +1192,12 @@ static int rsz_release(struct inode *inode, struct file 
*filp)
        channel_config_t *rsz_conf_chan =
            (channel_config_t *) filp->private_data;
 
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
 
        ret = down_trylock(&(rsz_conf_chan->chanprotection_sem));
        if (ret != 0) {
 
-               dev_dbg(rsz_device, "Channel in use", ret);
+               dev_dbg(rsz_device, "Channel in use");
                return -EBUSY;
        }
 
@@ -1213,7 +1212,7 @@ static int rsz_release(struct inode *inode, struct file 
*filp)
 
        kfree(rsz_conf_chan);
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");;
+       dev_dbg(rsz_device, "%s L\n", __func__);
 
        up(&(rsz_conf_chan->chanprotection_sem));
 
@@ -1242,7 +1241,7 @@ Function to map device memory into user   space
        channel_config_t *rsz_conf_chan =
            (channel_config_t *) filp->private_data;
 
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
 
        /* Count the number of input buffers allocated */
        while ((rsz_conf_chan->input_buffer[buffercounter]) != NULL) {
@@ -1292,7 +1291,7 @@ Function to map device memory into user   space
                return -EAGAIN;
        }
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");
+       dev_dbg(rsz_device, "%s L\n", __func__);
 
        return SUCESS;
 
@@ -1319,12 +1318,12 @@ static int rsz_ioctl(struct inode *inode, struct file 
*file,
        rsz_status_t *status;
        rsz_resize_t *resize;
 
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
 
        ret = down_trylock(&(rsz_conf_chan->chanprotection_sem));
        if (ret != 0) {
 
-               dev_dbg(rsz_device, "Channel in use", ret);
+               dev_dbg(rsz_device, "Channel in use");
                return -EBUSY;
        }
 
@@ -1456,7 +1455,7 @@ static int rsz_ioctl(struct inode *inode, struct file 
*file,
                ret = -EINVAL;
        }
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");
+       dev_dbg(rsz_device, "%s L\n", __func__);
        up(&(rsz_conf_chan->chanprotection_sem));
 
        return ret;
@@ -1471,15 +1470,15 @@ static struct file_operations rsz_fops = {
 =====================rsz_isr===========================
 Function to register the Resizer character device      driver
 */
-irqreturn_t rsz_isr(int irq, void *dev_id, struct pt_regs *regs)
+irqreturn_t rsz_isr(int irq, void *dev_id)
 {
 
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
 
        /* to suggest that resizing     has     been completed */
        complete(&(device_config.sem_isr));
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");
+       dev_dbg(rsz_device, "%s L\n", __func__);
 
        return IRQ_HANDLED;
 }
@@ -1496,7 +1495,7 @@ static int resizer_remove(struct device *device)
 {
        return 0;
 }
-static struct class_simple *rsz_class = NULL;
+static struct class *rsz_class = NULL;
 
 static struct platform_device resizer_device = {
        .name = "davinci_resizer",.id = 2,.dev = {
@@ -1565,7 +1564,7 @@ static int __init rsz_init(void)
                return -EINVAL;
        }
 
-       rsz_class = class_simple_create(THIS_MODULE, "davinci_resizer");
+       rsz_class = class_create(THIS_MODULE, "davinci_resizer");
 
        if (!rsz_class) {
 
@@ -1576,20 +1575,8 @@ static int __init rsz_init(void)
                return -EIO;
        }
 
-       /* make entry in the devfs */
-       result = devfs_mk_cdev(dev, S_IFCHR | S_IRUGO | S_IWUSR,
-                              "%s%d", "davinci_resizer", 0);
-
-       if (result < ZERO) {
-               printk("\nresizer_init: error in devfs_register_chrdev");
-               cdev_del(&c_dev);
-               unregister_chrdev(MAJOR(dev), DRIVER_NAME);
-               class_simple_destroy(rsz_class);
-               return result;
-       }
-
-       /* register     simple device class     */
-       class_simple_device_add(rsz_class, dev, NULL, "davinci_resizer");
+       /* register device class     */
+       device_create(rsz_class, NULL, dev, NULL, "davinci_resizer");
 
        init_completion(&(device_config.sem_isr));
 
@@ -1601,7 +1588,7 @@ static int __init rsz_init(void)
 
        /* Set up the Interrupt handler for     resizer interrupt */
 
-       result = request_irq(IRQ_RSZINT, rsz_isr, SA_INTERRUPT,
+       result = request_irq(IRQ_RSZINT, rsz_isr, 0,
                             "dm644xresizer", (void *)NULL);
        if (result < ZERO) {
                printk("Cannot initialize IRQ \n");
@@ -1624,13 +1611,10 @@ void __exit rsz_cleanup(void)
        unregister_chrdev_region(dev, 1);
 
        /* remove simple class device */
-       class_simple_device_remove(dev);
-
-       /* remove prev device from devfs */
-       devfs_remove("%s%d", "davinci_resizer", ZERO);
+       device_destroy(rsz_class, dev);
 
        /* destroy simple class */
-       class_simple_destroy(rsz_class);
+       class_destroy(rsz_class);
 
        /* Remove platform driver */
        driver_unregister(&resizer_driver);
diff --git a/arch/arm/mach-davinci/resizer_hw.c 
b/arch/arm/mach-davinci/resizer_hw.c
index 8ab0f0e..3697228 100644
--- a/arch/arm/mach-davinci/resizer_hw.c
+++ b/arch/arm/mach-davinci/resizer_hw.c
@@ -19,10 +19,11 @@
 
 /*Header files*/
 
-#include <asm/arch/davinci_resizer_hw.h>
+#include <mach/resizer.h>
 #include <linux/kernel.h>      /* printk()     */
 #include <linux/device.h>
-#include <asm/arch/davinci_resizer.h>
+#include <mach/resizer.h>
+#include <mach/resizer_hw.h>
 extern struct device *rsz_device;
 /*
 =====================rsz_hardware_setup===========================
@@ -36,7 +37,7 @@ void rsz_hardware_setup(channel_config_t * rsz_conf_chan)
        /* for getting the coefficient offset */
        int coeffoffset = ZERO;
 
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
 
        /* clear the VPSS_PCR register buffer overflow bits     */
        regw(0x003c0000, VPSS_PCR);
@@ -107,7 +108,7 @@ void rsz_hardware_setup(channel_config_t * rsz_conf_chan)
                coeffoffset = coeffoffset + COEFF_ADDRESS_OFFSET;
        }
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");
+       dev_dbg(rsz_device, "%s L\n", __func__);
 
 }
 
@@ -118,7 +119,7 @@ void rsz_hardware_setup(channel_config_t * rsz_conf_chan)
 int rsz_enable(channel_config_t * rsz_conf_chan)
 {
 
-       dev_dbg(rsz_device, __FUNCTION__ "E\n");
+       dev_dbg(rsz_device, "%s E\n", __func__);
 
        /* Eanbling the resizer the setting enable bit */
        rsz_conf_chan->register_config.rsz_pcr =
@@ -130,7 +131,7 @@ int rsz_enable(channel_config_t * rsz_conf_chan)
 
        regw(0x003c0000, VPSS_PCR);
 
-       dev_dbg(rsz_device, __FUNCTION__ "L\n");
+       dev_dbg(rsz_device, "%s L\n", __func__);
 
        return SUCESS;
 }
-- 
1.5.6


_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to