From: Trilok Soni <[EMAIL PROTECTED]>

Signed-off-by: Trilok Soni <[EMAIL PROTECTED]>
---
 arch/arm/mach-davinci/dma.c |  135 ++++++++++++++++++++++---------------------
 1 files changed, 68 insertions(+), 67 deletions(-)

diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index 4665ecc..3bb9ced 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -29,7 +29,7 @@
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/spinlock.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <asm/arch/memory.h>
 #include <linux/kernel.h>
 #include <asm/arch/hardware.h>
@@ -256,18 +256,16 @@ static int request_param(int lch, int dev_id)
                while (i < DAVINCI_EDMA_NUM_PARAMENTRY) {
                        j = 0, is_break = 1;
                        if ((param_entry_arm[i / 32] & (1 << (i % 32))) &&
-                           (param_entry_use_status[i / 32] & (1 << (i % 32))))
-                       {
+                           (param_entry_use_status[i / 32] &
+                                       (1 << (i % 32)))) {
                                if (dev_id != DAVINCI_EDMA_PARAM_ANY) {
                                        while (dma_chan_no_event[j] != -1) {
-                                               if (dma_chan_no_event[j] == i) {
+                                               if (dma_chan_no_event[j] == i)
                                                        is_break = 0;
-                                               }
                                                j++;
                                        }
-                                       if (!is_break) {
+                                       if (!is_break)
                                                break;
-                                       }
                                } else {
                                        break;
                                }
@@ -344,7 +342,8 @@ static int request_dma_interrupt(int lch,
                        dma_intr_use_status[lch / 32] &= (~(1 << (lch % 32)));
                        UNLOCK;
                        free_intr_no = lch;
-                       dev_dbg(&edma_dev.dev, "interrupt no=%d\r\n", 
free_intr_no);
+                       dev_dbg(&edma_dev.dev, "interrupt no=%d\r\n",
+                                                free_intr_no);
                } else {
                        UNLOCK;
                        dev_dbg(&edma_dev.dev, "EDMA:Error\r\n");
@@ -429,9 +428,10 @@ static int request_dma_interrupt(int lch,
        } else {
                dev_dbg(&edma_dev.dev, "ERROR lch = %d\r\n", lch);
        }
-       if (is_break) {
-               dev_dbg(&edma_dev.dev, "While allocating EDMA channel for 
QDMA");
-       }
+       if (is_break)
+               dev_dbg(&edma_dev.dev, "While allocating EDMA channel"
+                                       " for QDMA");
+
        if (lch >= DAVINCI_EDMA_NUM_DMACH && lch <
            (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
                if (free_intr_no < 32) {
@@ -506,9 +506,9 @@ static void dma_irq_handler(void)
                                            (1 << i);
                                        if (intr_data[i].callback) {
                                                intr_data[i].callback(i,
-                                                                     
DMA_COMPLETE,
-                                                                     intr_data
-                                                                     [i].data);
+                                                             DMA_COMPLETE,
+                                                             intr_data
+                                                             [i].data);
 
                                        }
                                }
@@ -517,18 +517,17 @@ static void dma_irq_handler(void)
                        dev_dbg(&edma_dev.dev, "IPRH =%d\r\n",
                                ptr_edmacc_regs->shadow[0].iprh);
                        for (i = 0; i < 32; i++) {
-                               if (ptr_edmacc_regs->shadow[0].iprh & (1 << i)) 
{
+                               if (ptr_edmacc_regs->shadow[0].iprh &
+                                               (1 << i)) {
                                        /* Clear the corresponding IPR bits */
                                        ptr_edmacc_regs->shadow[0].icrh |=
                                            (1 << i);
                                        if (intr_data[32 + i].callback) {
-                                               intr_data[32 + i].callback(32 +
-                                                                          i,
-                                                                          
DMA_COMPLETE,
-                                                                          
intr_data
-                                                                          [32 +
-                                                                           i].
-                                                                          
data);
+                                               intr_data[32 + i].callback(
+                                                               32 + i,
+                                                               DMA_COMPLETE,
+                                                               intr_data
+                                                               [32 + i].data);
                                        }
                                }
                        }
@@ -538,9 +537,8 @@ static void dma_irq_handler(void)
                        break;
                }
                cnt++;
-               if (cnt > 10) {
+               if (cnt > 10)
                        break;
-               }
        }
        ptr_edmacc_regs->shadow[0].ieval = 0x1;
 }
@@ -560,7 +558,8 @@ static void dma_ccerr_handler(void)
                return;
        while (1) {
                if (ptr_edmacc_regs->emr) {
-                       dev_dbg(&edma_dev.dev, "EMR =%d\r\n", 
ptr_edmacc_regs->emr);
+                       dev_dbg(&edma_dev.dev, "EMR =%d\r\n",
+                                ptr_edmacc_regs->emr);
                        for (i = 0; i < 32; i++) {
                                if (ptr_edmacc_regs->emr & (1 << i)) {
                                        /* Clear the corresponding EMR bits */
@@ -570,9 +569,8 @@ static void dma_ccerr_handler(void)
                                            (1 << i);
                                        if (intr_data[i].callback) {
                                                intr_data[i].callback(i,
-                                                                     
DMA_CC_ERROR,
-                                                                     intr_data
-                                                                     [i].data);
+                                                       DMA_CC_ERROR,
+                                                       intr_data[i].data);
                                        }
                                }
                        }
@@ -588,9 +586,8 @@ static void dma_ccerr_handler(void)
                                            (1 << i);
                                        if (intr_data[i].callback) {
                                                intr_data[i].callback(i,
-                                                                     
DMA_CC_ERROR,
-                                                                     intr_data
-                                                                     [i].data);
+                                                       DMA_CC_ERROR,
+                                                       intr_data[i].data);
                                        }
                                }
                        }
@@ -622,9 +619,8 @@ static void dma_ccerr_handler(void)
                        break;
                }
                cnt++;
-               if (cnt > 10) {
+               if (cnt > 10)
                        break;
-               }
        }
        ptr_edmacc_regs->eeval = 0x1;
 }
@@ -663,11 +659,11 @@ int __init arch_dma_init(void)
        edma_dev.dev.driver = &edma_driver;
 
        ptr_edmacc_regs = get_edma_base();
-       dev_dbg(&edma_dev.dev, "DMA REG BASE ADDR=%x\n", 
+       dev_dbg(&edma_dev.dev, "DMA REG BASE ADDR=%x\n",
               (unsigned int)ptr_edmacc_regs);
        memset(dma_chan, 0x00, sizeof(dma_chan));
        memset((void *)&(ptr_edmacc_regs->paramentry[0]), 0x00,
-              sizeof(ptr_edmacc_regs->paramentry));
+               sizeof(ptr_edmacc_regs->paramentry));
        i = 0;
        /* Channel to queue mapping */
        while (channel_queue_mapping[i][0] != -1) {
@@ -734,11 +730,12 @@ int davinci_request_dma(int dev_id, const char *dev_name,
 {
 
        int ret_val = 0, i = 0;
-       static int req_flag = 0;
+       static int req_flag;
        int temp_ch = 0;
        /* checking the ARM side events */
        if (dev_id >= 0 && (dev_id < DAVINCI_EDMA_NUM_DMACH)) {
-               if (!(edma_channels_arm[dev_id / 32] & (0x1 << (dev_id % 32)))) 
{
+               if (!(edma_channels_arm[dev_id / 32] &
+                       (0x1 << (dev_id % 32)))) {
                        dev_dbg(&edma_dev.dev,
                                "dev_id = %d not supported on ARM side\r\n",
                                dev_id);
@@ -837,7 +834,8 @@ int davinci_request_dma(int dev_id, const char *dev_name,
                        *lch = dev_id;
                        dma_chan[*lch].param_no = request_param(*lch, dev_id);
                        if (dma_chan[*lch].param_no == -1) {
-                               dev_dbg(&edma_dev.dev, "request_param 
failed\r\n");
+                               dev_dbg(&edma_dev.dev,
+                                       "request_param failed\r\n");
                                return -EINVAL;
                        } else {
                                dev_dbg(&edma_dev.dev, "param_no=%d\r\n",
@@ -869,9 +867,8 @@ int davinci_request_dma(int dev_id, const char *dev_name,
                                *lch = dma_chan_no_event[i];
                                dma_chan[*lch].param_no =
                                    request_param(*lch, dev_id);
-                               if (dma_chan[*lch].param_no == -1) {
+                               if (dma_chan[*lch].param_no == -1)
                                        return -EINVAL;
-                               }
                                dev_dbg(&edma_dev.dev, "param_no=%d\r\n",
                                        dma_chan[*lch].param_no);
                                if (dma_chan[*lch].param_no >=
@@ -911,11 +908,10 @@ int davinci_request_dma(int dev_id, const char *dev_name,
                                                                  [*lch].
                                                                  param_no,
                                                                  *tcc);
-                                       if (dma_chan[*lch].tcc == -1) {
+                                       if (dma_chan[*lch].tcc == -1)
                                                return -EINVAL;
-                                       } else {
+                                       else
                                                *tcc = dma_chan[*lch].tcc;
-                                       }
                                } else {
                                        dma_chan[*lch].tcc = -1;
                                }
@@ -941,7 +937,8 @@ int davinci_request_dma(int dev_id, const char *dev_name,
                                                "request_param failed\r\n");
                                        return -EINVAL;
                                } else {
-                                       dev_dbg(&edma_dev.dev, 
"param_no=%d\r\n",
+                                       dev_dbg(&edma_dev.dev,
+                                               "param_no=%d\r\n",
                                                dma_chan[*lch].param_no);
                                }
                                if (*tcc != -1)
@@ -1030,6 +1027,7 @@ int davinci_request_dma(int dev_id, const char *dev_name,
        }
        return ret_val;
 }
+EXPORT_SYMBOL(davinci_request_dma);
 
 /******************************************************************************
  *
@@ -1058,6 +1056,7 @@ void davinci_free_dma(int lch)
                free_dma_interrupt(dma_chan[lch].tcc);
        }
 }
+EXPORT_SYMBOL(davinci_free_dma);
 
 /******************************************************************************
  *
@@ -1095,6 +1094,7 @@ void davinci_set_dma_src_params(int lch, unsigned long 
src_port,
                    src_port;
        }
 }
+EXPORT_SYMBOL(davinci_set_dma_src_params);
 
 /******************************************************************************
  *
@@ -1131,6 +1131,7 @@ void davinci_set_dma_dest_params(int lch, unsigned long 
dest_port,
                    dest_port;
        }
 }
+EXPORT_SYMBOL(davinci_set_dma_dest_params);
 
 /******************************************************************************
  *
@@ -1161,6 +1162,7 @@ void davinci_set_dma_src_index(int lch, short src_bidx, 
short src_cidx)
                    |= src_cidx;
        }
 }
+EXPORT_SYMBOL(davinci_set_dma_src_index);
 
 /******************************************************************************
  *
@@ -1190,6 +1192,7 @@ void davinci_set_dma_dest_index(int lch, short dest_bidx, 
short dest_cidx)
                    |= ((unsigned long)dest_cidx << 16);
        }
 }
+EXPORT_SYMBOL(davinci_set_dma_dest_index);
 
 /******************************************************************************
  *
@@ -1230,6 +1233,7 @@ void davinci_set_dma_transfer_params(int lch, unsigned 
short acnt,
                ptr_edmacc_regs->paramentry[dma_chan[lch].param_no].ccnt = ccnt;
        }
 }
+EXPORT_SYMBOL(davinci_set_dma_transfer_params);
 
 /******************************************************************************
  *
@@ -1238,9 +1242,10 @@ void davinci_set_dma_transfer_params(int lch, unsigned 
short acnt,
  *      lch - logical channel number
  *
  *****************************************************************************/
-void davinci_set_dma_params(int lch, edmacc_paramentry_regs * temp)
+void davinci_set_dma_params(int lch, edmacc_paramentry_regs *temp)
 {
        int temp_ch = 0;
+
        if (lch >= DAVINCI_EDMA_NUM_DMACH && lch <
            (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
                temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_NUM_DMACH];
@@ -1253,6 +1258,7 @@ void davinci_set_dma_params(int lch, 
edmacc_paramentry_regs * temp)
                       (void *)temp, sizeof(edmacc_paramentry_regs));
        }
 }
+EXPORT_SYMBOL(davinci_set_dma_params);
 
 /******************************************************************************
  *
@@ -1261,9 +1267,10 @@ void davinci_set_dma_params(int lch, 
edmacc_paramentry_regs * temp)
  *      lch - logical channel number
  *
  *****************************************************************************/
-void davinci_get_dma_params(int lch, edmacc_paramentry_regs * temp)
+void davinci_get_dma_params(int lch, edmacc_paramentry_regs *temp)
 {
        int temp_ch = 0;
+
        if (lch >= DAVINCI_EDMA_NUM_DMACH && lch <
            (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
                temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_NUM_DMACH];
@@ -1276,6 +1283,7 @@ void davinci_get_dma_params(int lch, 
edmacc_paramentry_regs * temp)
                       sizeof(edmacc_paramentry_regs));
        }
 }
+EXPORT_SYMBOL(davinci_get_dma_params);
 
 /******************************************************************************
  *
@@ -1345,6 +1353,7 @@ int davinci_start_dma(int lch)
        }
        return ret_val;
 }
+EXPORT_SYMBOL(davinci_start_dma);
 
 /******************************************************************************
  *
@@ -1377,7 +1386,8 @@ void davinci_stop_dma(int lch)
                            (ptr_edmacc_regs->shadow[0].eecrh |=
                             (1UL << (lch - 32)));
                        if (lch < 32) {
-                               if (ptr_edmacc_regs->shadow[0].er & (1 << lch)) 
{
+                               if (ptr_edmacc_regs->shadow[0].er &
+                                       (1 << lch)) {
                                        dev_dbg(&edma_dev.dev, "ER=%x\n",
                                                ptr_edmacc_regs->shadow[0].er);
                                        ptr_edmacc_regs->shadow[0].ecr |=
@@ -1393,12 +1403,12 @@ void davinci_stop_dma(int lch)
                                }
                        }
                        if (lch < 32) {
-                               if (ptr_edmacc_regs->shadow[0].ser & (1 << 
lch)) {
+                               if (ptr_edmacc_regs->shadow[0].ser &
+                                       (1 << lch)) {
                                        dev_dbg(&edma_dev.dev, "SER=%x\n",
                                                ptr_edmacc_regs->shadow[0].ser);
                                        ptr_edmacc_regs->shadow[0].secr |=
                                            (1 << lch);
-                               } else {
                                }
                        } else {
                                if (ptr_edmacc_regs->
@@ -1445,11 +1455,13 @@ void davinci_stop_dma(int lch)
        } else {
        }
 }
+EXPORT_SYMBOL(davinci_stop_dma);
 
 /******************************************************************************
  *
  * DMA channel link - link the two logical channels passed through by linking
- *                    the link field of head to the param pointed by the 
lch_queue.
+ *                    the link field of head to the param pointed by the
+ *                    lch_queue.
  * ARGUMENTS:
  *      lch_head  - logical channel number, in which the link field is linked
  *                  to the param pointed to by lch_queue
@@ -1494,6 +1506,7 @@ void davinci_dma_link_lch(int lch_head, int lch_queue)
                dma_chan[lch_head].link_lch = lch_queue;
        }
 }
+EXPORT_SYMBOL(davinci_dma_link_lch);
 
 /******************************************************************************
  *
@@ -1530,6 +1543,7 @@ void davinci_dma_unlink_lch(int lch_head, int lch_queue)
                dma_chan[lch_head].link_lch = -1;
        }
 }
+EXPORT_SYMBOL(davinci_dma_unlink_lch);
 
 /******************************************************************************
  *
@@ -1571,6 +1585,7 @@ void davinci_dma_chain_lch(int lch_head, int lch_queue)
                    paramentry[lch_head].opt |= (lch_queue & 0x3f) << 12;
        }
 }
+EXPORT_SYMBOL(davinci_dma_chain_lch);
 
 /******************************************************************************
  *
@@ -1607,6 +1622,7 @@ void davinci_dma_unchain_lch(int lch_head, int lch_queue)
                ptr_edmacc_regs->paramentry[lch_head].opt &= ~TCCHEN;
        }
 }
+EXPORT_SYMBOL(davinci_dma_unchain_lch);
 
 /******************************************************************************
  *
@@ -1650,6 +1666,7 @@ void davinci_clean_channel(int ch_no)
                }
        }
 }
+EXPORT_SYMBOL(davinci_clean_channel);
 
 /******************************************************************************
  *
@@ -1670,7 +1687,7 @@ static int dma_ccerr_handler_l(int sound_curr_lch, void 
*ch_status)
        return IRQ_HANDLED;
 }
 
-static int dma_tc1err_handler_l (int sound_curr_lch, void *ch_status)
+static int dma_tc1err_handler_l(int sound_curr_lch, void *ch_status)
 {
        dev_dbg(&edma_dev.dev, "dma_tc1err_handler\n");
        (*cb[2]) ();
@@ -1719,19 +1736,3 @@ int register_dma_interrupts(intr_callback cb1, 
intr_callback cb2,
 }
 
 arch_initcall(arch_dma_init);
-EXPORT_SYMBOL(davinci_start_dma);
-EXPORT_SYMBOL(davinci_dma_link_lch);
-EXPORT_SYMBOL(davinci_set_dma_params);
-EXPORT_SYMBOL(davinci_get_dma_params);
-EXPORT_SYMBOL(davinci_set_dma_transfer_params);
-EXPORT_SYMBOL(davinci_set_dma_dest_index);
-EXPORT_SYMBOL(davinci_set_dma_src_index);
-EXPORT_SYMBOL(davinci_set_dma_dest_params);
-EXPORT_SYMBOL(davinci_set_dma_src_params);
-EXPORT_SYMBOL(davinci_request_dma);
-EXPORT_SYMBOL(davinci_stop_dma);
-EXPORT_SYMBOL(davinci_clean_channel);
-EXPORT_SYMBOL(davinci_free_dma);
-EXPORT_SYMBOL(davinci_dma_chain_lch);
-EXPORT_SYMBOL(davinci_dma_unchain_lch);
-EXPORT_SYMBOL(davinci_dma_unlink_lch);
-- 
1.5.5

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to