]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - tas2555sw-android/tas2555-android-device-driver-stereo.git/commitdiff
update tiload for in-system tuning
authora0220410 <peter-li@ti.com>
Fri, 22 Jul 2016 11:37:57 +0000 (19:37 +0800)
committera0220410 <peter-li@ti.com>
Fri, 22 Jul 2016 11:37:57 +0000 (19:37 +0800)
tas2555-i2c.c
tas2555.h
tiload.c
tiload.h

index 9629ead951a0825228f6cf701d5cc6ca8b00583c..976119656f2a96d02c452ec42cbb34c16fad17c2 100755 (executable)
@@ -291,6 +291,12 @@ static int tas2555_dev_read(
                        return 0;                       // let only reads from TILoad pass.
                }
                nRegister &= ~0x80000000;
+               
+               dev_dbg(pTAS2555->dev, "TiLoad R CH[%d] REG B[%d]P[%d]R[%d]\n", 
+                               chn,
+                               TAS2555_BOOK_ID(nRegister),
+                               TAS2555_PAGE_ID(nRegister),
+                               TAS2555_PAGE_REG(nRegister));
        }
 
        nResult = tas2555_change_book_page(pTAS2555, 
@@ -329,12 +335,16 @@ static int tas2555_dev_write(
        if ((nRegister == 0xAFFEAFFE) && (nValue == 0xBABEBABE)) {
                pTAS2555->mbTILoadActive = true;
                mutex_unlock(&pTAS2555->dev_lock);
+               
+               dev_dbg(pTAS2555->dev, "TiLoad Active\n");
                return 0;
        }
 
        if ((nRegister == 0xBABEBABE) && (nValue == 0xAFFEAFFE)) {
                pTAS2555->mbTILoadActive = false;
                mutex_unlock(&pTAS2555->dev_lock);
+               
+               dev_dbg(pTAS2555->dev, "TiLoad DeActive\n");
                return 0;
        }
 
@@ -344,6 +354,13 @@ static int tas2555_dev_write(
                        return 0;                       // let only writes from TILoad pass.
                }
                nRegister &= ~0x80000000;
+               
+               dev_dbg(pTAS2555->dev, "TiLoad W CH[%d] REG B[%d]P[%d]R[%d] =0x%x\n", 
+                                               chn,
+                                               TAS2555_BOOK_ID(nRegister),
+                                               TAS2555_PAGE_ID(nRegister),
+                                               TAS2555_PAGE_REG(nRegister),
+                                               nValue);
        }
 
        nResult = tas2555_change_book_page(pTAS2555, 
@@ -387,7 +404,14 @@ static int tas2555_dev_bulk_read(
                        mutex_unlock(&pTAS2555->dev_lock);
                        return 0;                       // let only writes from TILoad pass.
                }
+                                                               
                nRegister &= ~0x80000000;
+               dev_dbg(pTAS2555->dev, "TiLoad BR CH[%d] REG B[%d]P[%d]R[%d], count=%d\n", 
+                               chn,
+                               TAS2555_BOOK_ID(nRegister),
+                               TAS2555_PAGE_ID(nRegister),
+                               TAS2555_PAGE_REG(nRegister),
+                               nLength);               
        }
 
        nResult = tas2555_change_book_page(pTAS2555, 
@@ -436,7 +460,15 @@ static int tas2555_dev_bulk_write(
                        mutex_unlock(&pTAS2555->dev_lock);
                        return 0;                       // let only writes from TILoad pass.
                }
+                                                       
                nRegister &= ~0x80000000;
+               
+               dev_dbg(pTAS2555->dev, "TiLoad BW CH[%d] REG B[%d]P[%d]R[%d], count=%d\n", 
+                               chn,
+                               TAS2555_BOOK_ID(nRegister),
+                               TAS2555_PAGE_ID(nRegister),
+                               TAS2555_PAGE_REG(nRegister),
+                               nLength);               
        }
 
        nResult = tas2555_change_book_page(
@@ -493,7 +525,15 @@ static int tas2555_dev_update_bits(
                        mutex_unlock(&pTAS2555->dev_lock);
                        return 0;                       // let only writes from TILoad pass.
                }
+                                                               
                nRegister &= ~0x80000000;
+               
+               dev_dbg(pTAS2555->dev, "TiLoad SB CH[%d] REG B[%d]P[%d]R[%d], mask=0x%x, value=0x%x\n", 
+                               chn,
+                               TAS2555_BOOK_ID(nRegister),
+                               TAS2555_PAGE_ID(nRegister),
+                               TAS2555_PAGE_REG(nRegister),
+                               nMask, nValue);         
        }
        
        nResult = tas2555_change_book_page(
@@ -615,7 +655,8 @@ static int tas2555_i2c_probe(struct i2c_client *pClient,
 #endif
 
 #ifdef ENABLE_TILOAD
-               tiload_driver_init(pTAS2555);
+               tiload_driver_init(pTAS2555, channel_left);
+               tiload_driver_init(pTAS2555, channel_right);
 #endif
 
        }
index d12453f42de8f8241b75c882360a041faea6e92d..04b12b332423d95394bafbcc480e7afae5eafced 100755 (executable)
--- a/tas2555.h
+++ b/tas2555.h
@@ -400,6 +400,10 @@ struct tas2555_priv {
        int mnCurrentReg;       
        struct mutex file_lock;
 #endif 
+
+       //used for in-system tuning
+       void *chl_private_data;
+       void *chr_private_data;
 };
 
 #endif /* _TAS2555_H */
index 04553f4bf40c9bb975ef776911e4eb2eacaf7078..b7cca1f5e852d66807874f57a92530ae85d6334c 100755 (executable)
--- a/tiload.c
+++ b/tiload.c
@@ -22,6 +22,7 @@
 **
 ** =============================================================================
 */
+/* enable debug prints in the driver */
 #define DEBUG
 
 #include <linux/module.h>
@@ -34,6 +35,7 @@
 #include <linux/cdev.h>
 #include <linux/device.h>
 #include <asm/io.h>
+#include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/i2c.h>
 #include <linux/platform_device.h>
 /* Function prototypes */
 
 /* externs */
-static struct cdev *tiload_cdev;
-static int tiload_major = 0;   /* Dynamic allocation of Mjr No. */
-static int tiload_opened = 0;  /* Dynamic allocation of Mjr No. */
+//static struct cdev *tiload_cdev;
+//static int tiload_major = 0; /* Dynamic allocation of Mjr No. */
+//static int tiload_opened = 0;        /* Dynamic allocation of Mjr No. */
 static struct tas2555_priv *g_TAS2555;
-struct class *tiload_class;
-static unsigned int magic_num = 0x00;
+//struct class *tiload_class;
+//static unsigned int magic_num = 0x00;
 
-static char gPage = 0;
-static char gBook = 0;
+//static char gPage = 0;
+//static char gBook = 0;
 /******************************** Debug section *****************************/
 
 /*
@@ -64,16 +66,34 @@ static char gBook = 0;
 static int tiload_open(struct inode *in, struct file *filp)
 {
        struct tas2555_priv *pTAS2555 = g_TAS2555;
+       const unsigned char *pFileName;
+       struct tiload_data *pTiLoad;
        
        dev_info(pTAS2555->dev, "%s\n", __FUNCTION__);
-       if (tiload_opened) {
-               dev_info(pTAS2555->dev, "%s device is already opened\n", "tiload");
-               dev_info(pTAS2555->dev, "%s: only one instance of driver is allowed\n", "tiload");
+       
+       pFileName = filp->f_path.dentry->d_name.name;
+       if(strcmp(pFileName, CHL_DEVICE_NAME) == 0)
+               pTiLoad = pTAS2555->chl_private_data;
+       else if(strcmp(pFileName, CHR_DEVICE_NAME) == 0)
+               pTiLoad = pTAS2555->chr_private_data;
+       else{
+               dev_err(pTAS2555->dev, "channel err,dev (%s)\n", pFileName);
+               return -1;              
+       }
+       
+       if(pTiLoad == NULL)
                return -1;
+       else{
+               if(pTiLoad->mnTiload_Opened!=0){
+                       dev_info(pTAS2555->dev, "%s device is already opened\n", "tiload");
+                       dev_info(pTAS2555->dev, "%s: only one instance of driver is allowed\n", "tiload");
+                       return -1;
+               }
        }
        
        filp->private_data = (void*)pTAS2555;
-       tiload_opened++;
+       pTiLoad->mnTiload_Opened++;
+       
        return 0;
 }
 
@@ -87,14 +107,28 @@ static int tiload_open(struct inode *in, struct file *filp)
 static int tiload_release(struct inode *in, struct file *filp)
 {
        struct tas2555_priv *pTAS2555 = (struct tas2555_priv *)filp->private_data;
+       const unsigned char *pFileName;
+       struct tiload_data *pTiLoad;
        
        dev_info(pTAS2555->dev, "%s\n", __FUNCTION__);
        
-       tiload_opened--;
+       pFileName = filp->f_path.dentry->d_name.name;
+       if(strcmp(pFileName, CHL_DEVICE_NAME) == 0)
+               pTiLoad = pTAS2555->chl_private_data;
+       else if(strcmp(pFileName, CHR_DEVICE_NAME) == 0)
+               pTiLoad = pTAS2555->chr_private_data;
+       else{
+               dev_err(pTAS2555->dev, "channel err,dev (%s)\n", pFileName);
+               return 0;               
+       }
+       
+       if(pTiLoad == NULL)
+               return 0;
+       
+       pTiLoad->mnTiload_Opened--;
        return 0;
 }
 
-#define MAX_LENGTH 128
 /*
  *----------------------------------------------------------------------------
  * Function : tiload_read
@@ -102,22 +136,43 @@ static int tiload_release(struct inode *in, struct file *filp)
  * Purpose  : read from codec
  *----------------------------------------------------------------------------
  */
-static ssize_t tiload_read(struct file *file, char __user * buf,
+static ssize_t tiload_read(struct file *filp, char __user * buf,
        size_t count, loff_t * offset)
 {
-       struct tas2555_priv *pTAS2555 = (struct tas2555_priv *)file->private_data;      
-       static char rd_data[MAX_LENGTH + 1];
+       struct tas2555_priv *pTAS2555 = (struct tas2555_priv *)filp->private_data;      
+       const unsigned char *pFileName;
+       unsigned char channel;
+       struct tiload_data *pTiLoad;
        unsigned int nCompositeRegister = 0, Value;
        //unsigned int n;
        char reg_addr;
        size_t size;
        int ret = 0;
+       unsigned char nBook, nPage;
 #ifdef DEBUG
        int i;
 #endif
 
        dev_dbg(pTAS2555->dev, "%s\n", __FUNCTION__);
        
+       pFileName = filp->f_path.dentry->d_name.name;
+       if(strcmp(pFileName, CHL_DEVICE_NAME) == 0){
+               pTiLoad = pTAS2555->chl_private_data;
+               channel = channel_left;
+       }else if(strcmp(pFileName, CHR_DEVICE_NAME) == 0){
+               pTiLoad = pTAS2555->chr_private_data;
+               channel = channel_right;
+       }else{
+               dev_err(pTAS2555->dev, "channel err,dev (%s)\n", pFileName);
+               return -1;              
+       }
+       
+       if(pTiLoad == NULL)
+               return -1;
+       
+       nBook = pTiLoad->mnBook;
+       nPage = pTiLoad->mnPage;
+       
        if (count > MAX_LENGTH) {
                dev_err(pTAS2555->dev, "Max %d bytes can be read\n", MAX_LENGTH);
                return -1;
@@ -132,17 +187,17 @@ static ssize_t tiload_read(struct file *file, char __user * buf,
 
        size = count;
 
-       nCompositeRegister = BPR_REG(gBook, gPage, reg_addr);
+       nCompositeRegister = BPR_REG(nBook, nPage, reg_addr);
        if (count == 1) {
                ret = pTAS2555->read(pTAS2555, 
-                                       pTAS2555->mnCurrentChannel, 
+                                       channel, 
                                        0x80000000 | nCompositeRegister, &Value);
                if (ret >= 0)
-                       rd_data[0] = (char) Value;
+                       pTiLoad->mpRd_data[0] = (char) Value;
        } else if (count > 1) {
                ret = pTAS2555->bulk_read(pTAS2555, 
-                                       pTAS2555->mnCurrentChannel, 
-                                       0x80000000 | nCompositeRegister, rd_data, size);
+                                       channel, 
+                                       0x80000000 | nCompositeRegister, pTiLoad->mpRd_data, size);
        }
        if (ret < 0)
                dev_err(pTAS2555->dev, 
@@ -154,7 +209,9 @@ static ssize_t tiload_read(struct file *file, char __user * buf,
                "read size = %d, reg_addr= 0x%x , count = %d\n",
                (int) size, reg_addr, (int) count);
        for (i = 0; i < (int) size; i++) {
-               dev_dbg(pTAS2555->dev, "rd_data[%d]=0x%x\n", i, rd_data[i]);
+               dev_dbg(pTAS2555->dev, 
+                       "chl[%d] rd_data[%d]=0x%x\n", 
+                       channel,i, pTiLoad->mpRd_data[i]);
        }
 #endif
        if (size != count) {
@@ -162,7 +219,7 @@ static ssize_t tiload_read(struct file *file, char __user * buf,
                        "read %d registers from the codec\n", (int) size);
        }
 
-       if (copy_to_user(buf, rd_data, size) != 0) {
+       if (copy_to_user(buf, pTiLoad->mpRd_data, size) != 0) {
                dev_err(pTAS2555->dev, "copy_to_user failed\n");
                return -1;
        }
@@ -177,12 +234,14 @@ static ssize_t tiload_read(struct file *file, char __user * buf,
  * Purpose  : write to codec
  *----------------------------------------------------------------------------
  */
-static ssize_t tiload_write(struct file *file, const char __user * buf,
+static ssize_t tiload_write(struct file *filp, const char __user * buf,
        size_t count, loff_t * offset)
 {
-       struct tas2555_priv *pTAS2555 = (struct tas2555_priv *)file->private_data;              
-       static char wr_data[MAX_LENGTH + 1];
-       char *pData = wr_data;
+       struct tas2555_priv *pTAS2555 = (struct tas2555_priv *)filp->private_data;              
+       const unsigned char *pFileName;
+       unsigned char channel;
+       struct tiload_data *pTiLoad;
+       char *pData;// = wr_data;
        size_t size;
        unsigned int nCompositeRegister = 0;
        unsigned int nRegister;
@@ -193,13 +252,32 @@ static ssize_t tiload_write(struct file *file, const char __user * buf,
 
        dev_info(pTAS2555->dev, "%s\n", __FUNCTION__);
 
+       pFileName = filp->f_path.dentry->d_name.name;
+       if(strcmp(pFileName, CHL_DEVICE_NAME) == 0){
+               channel = channel_left;
+               pTiLoad = pTAS2555->chl_private_data;
+       }else if(strcmp(pFileName, CHR_DEVICE_NAME) == 0){
+               channel = channel_right;
+               pTiLoad = pTAS2555->chr_private_data;
+       }else{
+               dev_err(pTAS2555->dev, "channel err,dev (%s)\n", pFileName);
+               return -1;              
+       }
+       
+       dev_dbg(pTAS2555->dev, "file:%s, channel=%d\n", pFileName, channel);
+       
+       if(pTiLoad == NULL)
+               return -1;
+       
        if (count > MAX_LENGTH) {
                dev_err(pTAS2555->dev,"Max %d bytes can be read\n", MAX_LENGTH);
                return -1;
        }
+       
+       pData = pTiLoad->mpWr_data;
 
        /* copy buffer from user space  */
-       size = copy_from_user(wr_data, buf, count);
+       size = copy_from_user(pTiLoad->mpWr_data, buf, count);
        if (size != 0) {
                dev_err(pTAS2555->dev,
                        "copy_from_user failure %d\n", (int) size);
@@ -209,32 +287,31 @@ static ssize_t tiload_write(struct file *file, const char __user * buf,
        dev_dbg(pTAS2555->dev, "write size = %zu\n", count);
        for (i = 0; i < (int) count; i++) {
 
-               dev_dbg(pTAS2555->dev,"\nwr_data[%d]=%x\n", i, wr_data[i]);
+               dev_dbg(pTAS2555->dev,"wr_data[%d]=%x\n", i, pTiLoad->mpWr_data[i]);
        }
 #endif
-       nRegister = wr_data[0];
+       nRegister = pTiLoad->mpWr_data[0];
        size = count;
-       if ((nRegister == 127) && (gPage == 0)) {
-               gBook = wr_data[1];
+       if ((nRegister == 127) && (pTiLoad->mnPage == 0)) {
+               pTiLoad->mnBook = pTiLoad->mpWr_data[1];
                return size;
        }
 
        if (nRegister == 0) {
-               gPage = wr_data[1];
+               pTiLoad->mnPage = pTiLoad->mpWr_data[1];
+               if(count == 2) return size;
                pData++;
                count--;
        }
 #if 1
-       nCompositeRegister = BPR_REG(gBook, gPage, nRegister);
+       nCompositeRegister = BPR_REG(pTiLoad->mnBook, pTiLoad->mnPage, nRegister);
        if (count == 2) {
-               ret =
-                       pTAS2555->write(pTAS2555, 
-                               pTAS2555->mnCurrentChannel, 
+               ret = pTAS2555->write(pTAS2555, 
+                               channel, 
                                0x80000000 | nCompositeRegister, pData[1]);
        } else if (count > 2) {
-               ret =
-                       pTAS2555->bulk_write(pTAS2555, 
-                               pTAS2555->mnCurrentChannel, 
+               ret = pTAS2555->bulk_write(pTAS2555, 
+                               channel, 
                                0x80000000 | nCompositeRegister, &pData[1], count - 1);
        }
        if (ret < 0)
@@ -257,11 +334,11 @@ static void tiload_route_IO(struct tas2555_priv *pTAS2555,
 {
        if (bLock) {
                pTAS2555->write(pTAS2555, 
-                       pTAS2555->mnCurrentChannel
+                       channel_both
                        0xAFFEAFFE, 0xBABEBABE);
        } else {
                pTAS2555->write(pTAS2555, 
-                       pTAS2555->mnCurrentChannel
+                       channel_both
                        0xBABEBABE, 0xAFFEAFFE);
        }
 }
@@ -269,36 +346,40 @@ static void tiload_route_IO(struct tas2555_priv *pTAS2555,
 static long tiload_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
        long num = 0;
-       struct tas2555_priv *pTAS2555 = (struct tas2555_priv *)filp->private_data;              
+       struct tas2555_priv *pTAS2555 = (struct tas2555_priv *)filp->private_data;      
+       const unsigned char *pFileName; 
+       struct tiload_data *pTiLoad;
+       int magic_num;
        void __user *argp = (void __user *) arg;
        int val;
        BPR bpr;
 
-       dev_info(pTAS2555->dev, "%s\n", __FUNCTION__);
+       dev_info(pTAS2555->dev, "%s, cmd=0x%x\n", __FUNCTION__, cmd);
 //    if (_IOC_TYPE(cmd) != TILOAD_IOC_MAGIC)
 //        return -ENOTTY;
 
+       pFileName = filp->f_path.dentry->d_name.name;
+       if(strcmp(pFileName, CHL_DEVICE_NAME) == 0)
+               pTiLoad = pTAS2555->chl_private_data;
+       else if(strcmp(pFileName, CHR_DEVICE_NAME) == 0)
+               pTiLoad = pTAS2555->chr_private_data;
+       else{
+               dev_err(pTAS2555->dev, "channel err,dev (%s)\n", pFileName);
+               return 0;               
+       }
+       
        switch (cmd) {
        case TILOAD_IOMAGICNUM_GET:
+               magic_num = pTiLoad->mnMagicNum;
                num = copy_to_user(argp, &magic_num, sizeof(int));
                break;
        case TILOAD_IOMAGICNUM_SET:
                num = copy_from_user(&magic_num, argp, sizeof(int));
-               tiload_route_IO(pTAS2555, magic_num);
-               break;
-       case TILOAD_IOCHLNUM_SET:
-               {
-                       int channel = 0;
-                       num = copy_from_user(&channel, argp, sizeof(int));
-                       if((channel>=1)&&(channel<=3))
-                               pTAS2555->mnCurrentChannel = channel;
-                       else{
-                               dev_err(pTAS2555->dev, 
-                                       "TILOAD_IOCHLNUM_SET err chl %d\n", 
-                                       channel);
-                       }
+               if(num==0) {
+                       pTiLoad->mnMagicNum = magic_num;
+                       tiload_route_IO(pTAS2555, magic_num);
                }
-               break;  
+               break;
        case TILOAD_BPR_READ:
                break;
        case TILOAD_BPR_WRITE:
@@ -338,22 +419,49 @@ static struct file_operations tiload_fops = {
  * Purpose  : Register a char driver for dynamic tiload programming
  *----------------------------------------------------------------------------
  */
-int tiload_driver_init(struct tas2555_priv *pTAS2555)
+int tiload_driver_init(struct tas2555_priv *pTAS2555, unsigned char channel)
 {
        int result;
+       int tiload_major = 0;
+       struct cdev *tiload_cdev;
+       struct class *tiload_class;
        dev_t dev;
+       const char *pDeviceName;
+       struct tiload_data *private_data;
 
        dev_info(pTAS2555->dev, "%s\n", __FUNCTION__);
+       
+       private_data = kzalloc(sizeof(struct tiload_data), GFP_KERNEL);
+       if(private_data == NULL){
+               dev_err(pTAS2555->dev, "no mem\n");
+               return -ENOMEM;
+       }
+               
+       if(channel == channel_left){
+               pDeviceName = CHL_DEVICE_NAME;
+               if(pTAS2555->chl_private_data != NULL)
+                       kfree(pTAS2555->chl_private_data);
+               pTAS2555->chl_private_data = private_data;
+       }else if(channel == channel_right){             
+               pDeviceName = CHR_DEVICE_NAME;
+               if(pTAS2555->chr_private_data != NULL)
+                       kfree(pTAS2555->chr_private_data);              
+               pTAS2555->chr_private_data = private_data;
+       }else{
+               result = -EINVAL;
+               goto err;
+       }
+       
        dev = MKDEV(tiload_major, 0);
        g_TAS2555 = pTAS2555;
 
-       result = alloc_chrdev_region(&dev, 0, 1, DEVICE_NAME);
+       result = alloc_chrdev_region(&dev, 0, 1, pDeviceName);
        if (result < 0) {
                dev_err(pTAS2555->dev,
                        "cannot allocate major number %d\n", tiload_major);
-               return result;
+               goto err;
        }
-       tiload_class = class_create(THIS_MODULE, DEVICE_NAME);
+       tiload_class = class_create(THIS_MODULE, pDeviceName);
        tiload_major = MAJOR(dev);
        dev_info(pTAS2555->dev,
                "allocated Major Number: %d\n", tiload_major);
@@ -363,7 +471,7 @@ int tiload_driver_init(struct tas2555_priv *pTAS2555)
        tiload_cdev->owner = THIS_MODULE;
        tiload_cdev->ops = &tiload_fops;
 
-       if (device_create(tiload_class, NULL, dev, NULL, "tiload_node") == NULL){
+       if (device_create(tiload_class, NULL, dev, NULL, pDeviceName) == NULL){
                dev_err(pTAS2555->dev,
                        "Device creation failed\n");
        }
@@ -373,13 +481,19 @@ int tiload_driver_init(struct tas2555_priv *pTAS2555)
                                "tiload_driver: cdev_add failed \n");
                unregister_chrdev_region(dev, 1);
                tiload_cdev = NULL;
-               return 1;
+               goto err;
        }
        
        dev_info(pTAS2555->dev,
                "Registered TiLoad driver, Major number: %d \n", tiload_major);
-       
+               
        return 0;
+       
+err:
+       if(private_data!=NULL)
+               kfree(private_data);
+       
+       return result;
 }
 
 MODULE_AUTHOR("Texas Instruments Inc.");
index b55c949b6b860870f88ec276b6c53c8158f76b82..ca628ccfe15cdfd47a458fe5de02c87fa396be98 100755 (executable)
--- a/tiload.h
+++ b/tiload.h
@@ -28,6 +28,8 @@
 
 #include "tas2555.h"
 
+#define MAX_LENGTH 128
+
 #define BPR_REG(book, page, reg)               (((book * 256 * 128) + \
                                                 (page * 128)) + reg)
 
@@ -40,8 +42,19 @@ typedef struct {
        unsigned char nRegister;
 } BPR;
 
+struct tiload_data {
+       unsigned char mnBook;
+       unsigned char mnPage;
+       unsigned char mnMagicNum;
+       int mnTiload_Opened;
+       char mpRd_data[MAX_LENGTH + 1];
+       char mpWr_data[MAX_LENGTH + 1];
+} ;
+
 /* defines */
-#define DEVICE_NAME     "tiload_node"
+#define CHL_DEVICE_NAME     "tiload_chl_node"
+#define CHR_DEVICE_NAME     "tiload_chr_node"
+
 #define TILOAD_IOC_MAGIC   0xE0
 #define TILOAD_IOMAGICNUM_GET                          _IOR(TILOAD_IOC_MAGIC, 1, int)
 #define TILOAD_IOMAGICNUM_SET                          _IOW(TILOAD_IOC_MAGIC, 2, int)
@@ -51,6 +64,6 @@ typedef struct {
 #define TILOAD_IOCTL_SET_CONFIG                _IOW(TILOAD_IOC_MAGIC, 6, int)
 #define TILOAD_IOCTL_SET_CALIBRATION   _IOW(TILOAD_IOC_MAGIC, 7, int)
 
-int tiload_driver_init(struct tas2555_priv *pTAS2555);
+int tiload_driver_init(struct tas2555_priv *pTAS2555, unsigned char channel);
 
 #endif