diff mbox

[0/2] Fix issues with frame reception from CSI on i.MX31

Message ID 20110128084655.0e6eddb5@wker (mailing list archive)
State RFC
Headers show

Commit Message

Anatolij Gustschin Jan. 28, 2011, 7:46 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/dma/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c
index d696915..f9fa0b3 100644
--- a/drivers/dma/ipu/ipu_idmac.c
+++ b/drivers/dma/ipu/ipu_idmac.c
@@ -8,7 +8,7 @@ 
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#define DEBUG
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/err.h>
@@ -910,6 +910,8 @@  static dma_cookie_t idmac_tx_submit(struct dma_async_tx_descriptor *tx)
 		goto dequeue;
 	}
 
+	dump_idmac_reg(ipu);
+
 	if (ichan->status < IPU_CHANNEL_ENABLED) {
 		ret = ipu_enable_channel(idmac, ichan);
 		if (ret < 0) {
@@ -1472,22 +1474,106 @@  static void idmac_terminate_all(struct dma_chan *chan)
 static irqreturn_t ic_sof_irq(int irq, void *dev_id)
 {
 	struct idmac_channel *ichan = dev_id;
+	struct idmac *idmac = to_idmac(ichan->dma_chan.device);
+	struct ipu *ipu = to_ipu(idmac);
 	printk(KERN_DEBUG "Got SOF IRQ %d on Channel %d\n",
 	       irq, ichan->dma_chan.chan_id);
-	disable_irq_nosync(irq);
+	dump_idmac_reg(ipu);
+	printk(KERN_DEBUG "__________________________________________\n");
+	/*disable_irq_nosync(irq);*/
 	return IRQ_HANDLED;
 }
 
 static irqreturn_t ic_eof_irq(int irq, void *dev_id)
 {
 	struct idmac_channel *ichan = dev_id;
+	struct idmac *idmac = to_idmac(ichan->dma_chan.device);
+	struct ipu *ipu = to_ipu(idmac);
 	printk(KERN_DEBUG "Got EOF IRQ %d on Channel %d\n",
 	       irq, ichan->dma_chan.chan_id);
-	disable_irq_nosync(irq);
+	dump_idmac_reg(ipu);
+	printk(KERN_DEBUG "__________________________________________\n");
+	/*disable_irq_nosync(irq);*/
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t ic_nf_ack_irq(int irq, void *dev_id)
+{
+	struct idmac_channel *ichan = dev_id;
+	struct idmac *idmac = to_idmac(ichan->dma_chan.device);
+	struct ipu *ipu = to_ipu(idmac);
+	printk(KERN_DEBUG "Got NF ACK IRQ %d on Channel %d\n",
+	       irq, ichan->dma_chan.chan_id);
+	dump_idmac_reg(ipu);
+	printk(KERN_DEBUG "__________________________________________\n");
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t ic_nfb4_eof_err_irq(int irq, void *dev_id)
+{
+	struct idmac_channel *ichan = dev_id;
+	struct idmac *idmac = to_idmac(ichan->dma_chan.device);
+	struct ipu *ipu = to_ipu(idmac);
+	printk(KERN_DEBUG "Got NF B4 EOF ERR IRQ %d on Channel %d\n",
+	       irq, ichan->dma_chan.chan_id);
+	dump_idmac_reg(ipu);
+	printk(KERN_DEBUG "__________________________________________\n");
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t ic_bay_ovf_err_irq(int irq, void *dev_id)
+{
+	struct idmac_channel *ichan = dev_id;
+	struct idmac *idmac = to_idmac(ichan->dma_chan.device);
+	struct ipu *ipu = to_ipu(idmac);
+	printk(KERN_DEBUG "Got BAYER BUF OVF ERR IRQ %d on Channel %d\n",
+	       irq, ichan->dma_chan.chan_id);
+	dump_idmac_reg(ipu);
+	printk(KERN_DEBUG "__________________________________________\n");
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t ic_enc_ovf_err_irq(int irq, void *dev_id)
+{
+	struct idmac_channel *ichan = dev_id;
+	struct idmac *idmac = to_idmac(ichan->dma_chan.device);
+	struct ipu *ipu = to_ipu(idmac);
+	printk(KERN_DEBUG "Got ENC BUF OVF ERR IRQ %d on Channel %d\n",
+	       irq, ichan->dma_chan.chan_id);
+	dump_idmac_reg(ipu);
+	printk(KERN_DEBUG "__________________________________________\n");
 	return IRQ_HANDLED;
 }
 
+static irqreturn_t ic_bay_frm_lost_err_irq(int irq, void *dev_id)
+{
+	struct idmac_channel *ichan = dev_id;
+	struct idmac *idmac = to_idmac(ichan->dma_chan.device);
+	struct ipu *ipu = to_ipu(idmac);
+	printk(KERN_DEBUG "Got BAYER FRM LOST ERR IRQ %d on Channel %d\n",
+	       irq, ichan->dma_chan.chan_id);
+	dump_idmac_reg(ipu);
+	printk(KERN_DEBUG "__________________________________________\n");
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t ic_enc_frm_lost_err_irq(int irq, void *dev_id)
+{
+	struct idmac_channel *ichan = dev_id;
+	struct idmac *idmac = to_idmac(ichan->dma_chan.device);
+	struct ipu *ipu = to_ipu(idmac);
+	printk(KERN_DEBUG "Got ENC FRM LOST ERR IRQ %d on Channel %d\n",
+	       irq, ichan->dma_chan.chan_id);
+	dump_idmac_reg(ipu);
+	printk(KERN_DEBUG "__________________________________________\n");
+	return IRQ_HANDLED;
+}
+
+
 static int ic_sof = -EINVAL, ic_eof = -EINVAL;
+static int ic_nf_ack = -EINVAL, ic_nfb4_eof_err = -EINVAL;
+static int ic_bay_ovf_err = -EINVAL, ic_enc_ovf_err = -EINVAL;
+static int ic_bay_frm_lost_err = -EINVAL, ic_enc_frm_lost_err = -EINVAL;
 #endif
 
 static int idmac_alloc_chan_resources(struct dma_chan *chan)
@@ -1526,12 +1612,33 @@  static int idmac_alloc_chan_resources(struct dma_chan *chan)
 
 #ifdef DEBUG
 	if (chan->chan_id == IDMAC_IC_7) {
+		ic_nf_ack = ipu_irq_map(39);
+		if (ic_nf_ack > 0)
+			request_irq(ic_nf_ack, ic_nf_ack_irq, 0, "DMAIC NF ACK", ichan);
 		ic_sof = ipu_irq_map(69);
 		if (ic_sof > 0)
 			request_irq(ic_sof, ic_sof_irq, 0, "IC SOF", ichan);
 		ic_eof = ipu_irq_map(70);
 		if (ic_eof > 0)
 			request_irq(ic_eof, ic_eof_irq, 0, "IC EOF", ichan);
+		ic_nfb4_eof_err = ipu_irq_map(103);
+		if (ic_nfb4_eof_err > 0)
+			request_irq(ic_nfb4_eof_err, ic_nfb4_eof_err_irq, 0, "IC NFB4EOF ERR", ichan);
+
+		ic_bay_ovf_err = ipu_irq_map(128);
+		if (ic_bay_ovf_err > 0)
+			request_irq(ic_bay_ovf_err, ic_bay_ovf_err_irq, 0, "BAYER BUF OVF ERR", ichan);
+		ic_enc_ovf_err = ipu_irq_map(129);
+		if (ic_enc_ovf_err > 0)
+			request_irq(ic_enc_ovf_err, ic_enc_ovf_err_irq, 0, "ENC BUF OVF ERR", ichan);
+
+		ic_bay_frm_lost_err = ipu_irq_map(139);
+		if (ic_bay_frm_lost_err > 0)
+			request_irq(ic_bay_frm_lost_err, ic_bay_frm_lost_err_irq, 0, "BAYER FRM LOST ERR", ichan);
+
+		ic_enc_frm_lost_err = ipu_irq_map(140);
+		if (ic_enc_frm_lost_err > 0)
+			request_irq(ic_enc_frm_lost_err, ic_enc_frm_lost_err_irq, 0, "ENC FRM LOST ERR", ichan);
 	}
 #endif
 
@@ -1562,6 +1669,11 @@  static void idmac_free_chan_resources(struct dma_chan *chan)
 	if (ichan->status > IPU_CHANNEL_FREE) {
 #ifdef DEBUG
 		if (chan->chan_id == IDMAC_IC_7) {
+			if (ic_nf_ack > 0) {
+				free_irq(ic_nf_ack, ichan);
+				ipu_irq_unmap(39);
+				ic_nf_ack = -EINVAL;
+			}
 			if (ic_sof > 0) {
 				free_irq(ic_sof, ichan);
 				ipu_irq_unmap(69);
@@ -1572,6 +1684,31 @@  static void idmac_free_chan_resources(struct dma_chan *chan)
 				ipu_irq_unmap(70);
 				ic_eof = -EINVAL;
 			}
+			if (ic_nfb4_eof_err > 0) {
+				free_irq(ic_nfb4_eof_err, ichan);
+				ipu_irq_unmap(103);
+				ic_nfb4_eof_err = -EINVAL;
+			}
+			if (ic_bay_ovf_err > 0) {
+				free_irq(ic_bay_ovf_err, ichan);
+				ipu_irq_unmap(128);
+				ic_bay_ovf_err = -EINVAL;
+			}
+			if (ic_enc_ovf_err > 0) {
+				free_irq(ic_enc_ovf_err, ichan);
+				ipu_irq_unmap(129);
+				ic_enc_ovf_err = -EINVAL;
+			}
+			if (ic_bay_frm_lost_err > 0) {
+				free_irq(ic_bay_frm_lost_err, ichan);
+				ipu_irq_unmap(139);
+				ic_bay_frm_lost_err = -EINVAL;
+			}
+			if (ic_enc_frm_lost_err > 0) {
+				free_irq(ic_enc_frm_lost_err, ichan);
+				ipu_irq_unmap(140);
+				ic_enc_frm_lost_err = -EINVAL;
+			}
 		}
 #endif
 		free_irq(ichan->eof_irq, ichan);
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c
index 2322798..9e566dd 100644
--- a/drivers/media/video/mx3_camera.c
+++ b/drivers/media/video/mx3_camera.c
@@ -8,7 +8,7 @@ 
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#define DEBUG
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/version.h>