Skip to contentSkip to conversation

OMAP3 camera driver LSC support

PATCH New Mohit Jalori 1 participant 1 message Jul 1, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 12/16 OMAP3 camera driver LSC support

From: Mohit Jalori <[email protected]>

ARM: OMAP: OMAP34XXCAM: ISP CCDC LSC support.

Adding support for CCDC Lens Shading Compensator.

---
 drivers/media/video/isp/isp.c        |   28 +++++
 drivers/media/video/isp/ispccdc.c    |  195 ++++++++++++++++++++++++++++++++++-
 drivers/media/video/isp/ispccdc.h    |    8 +
 include/asm-arm/arch-omap/isp_user.h |   31 +++++
 4 files changed, 261 insertions(+), 1 deletion(-)
drivers/media/video/isp/isp.c +28 -0
@@ -324,6 +324,17 @@ int isp_set_callback(enum isp_callback_t
 					IRQENABLE_TLBMISS,
 					ISPMMU_IRQENABLE);
 		break;
+	case CBK_LSC_ISR:
+		omap_writel(IRQ0ENABLE_CCDC_LSC_DONE_IRQ |
+					IRQ0ENABLE_CCDC_LSC_PREF_COMP_IRQ |
+					IRQ0ENABLE_CCDC_LSC_PREF_ERR_IRQ,
+					ISP_IRQ0STATUS);
+		omap_writel(omap_readl(ISP_IRQ0ENABLE) |
+					IRQ0ENABLE_CCDC_LSC_DONE_IRQ |
+					IRQ0ENABLE_CCDC_LSC_PREF_COMP_IRQ |
+					IRQ0ENABLE_CCDC_LSC_PREF_ERR_IRQ,
+					ISP_IRQ0ENABLE);
+		break;
 	default:
 		break;
 	}
@@ -374,6 +385,13 @@ int isp_unset_callback(enum isp_callback
 						~IRQ0ENABLE_HS_VS_IRQ,
 						ISP_IRQ0ENABLE);
 		break;
+	case CBK_LSC_ISR:
+		omap_writel(omap_readl(ISP_IRQ0ENABLE) &
+					~(IRQ0ENABLE_CCDC_LSC_DONE_IRQ |
+					IRQ0ENABLE_CCDC_LSC_PREF_COMP_IRQ |
+					IRQ0ENABLE_CCDC_LSC_PREF_ERR_IRQ),
+					ISP_IRQ0ENABLE);
+		break;
 	default:
 		break;
 	}
@@ -848,6 +866,15 @@ static irqreturn_t omap34xx_isp_isr(int 
 		is_irqhandled = 1;
 	}
 
+	if (irqstatus & LSC_PRE_ERR) {
+		printk(KERN_ERR "isp_sr: LSC_PRE_ERR \n");
+		omap_writel(irqstatus, ISP_IRQ0STATUS);
+		ispccdc_enable_lsc(0);
+		ispccdc_enable_lsc(1);
+		spin_unlock_irqrestore(&isp_obj.lock, irqflags);
+		return IRQ_HANDLED;
+	}
+
 	if (irqstatus & IRQ0STATUS_CSIB_IRQ) {
 		u32 ispcsi1_irqstatus;
 
@@ -929,6 +956,7 @@ void isp_stop()
 	omapisp_unset_callback();
 
 	if (ispmodule_obj.isp_pipeline & OMAP_ISP_CCDC) {
+		ispccdc_enable_lsc(0);
 		ispccdc_enable(0);
 		timeout = 0;
 		while (ispccdc_busy() && (timeout < 20)) {
drivers/media/video/isp/ispccdc.c +194 -1

249 lines not on this page · raw message

drivers/media/video/isp/ispccdc.h +8 -0
@@ -23,6 +23,14 @@
 
 #include <asm/arch/isp_user.h>
 
+#ifndef CONFIG_ARCH_OMAP3410
+# define cpu_is_omap3410()		0
+# define is_isplsc_activated()		1
+#else
+# define cpu_is_omap3410()		1
+# define is_isplsc_activated()		0
+#endif
+
 #ifdef OMAP_ISPCCDC_DEBUG
 # define is_ispccdc_debug_enabled()		1
 #else
include/asm-arm/arch-omap/isp_user.h +31 -0
@@ -60,6 +60,37 @@ enum vpif_freq {
 };
 
 /**
+ * struct ispccdc_lsc_config - Structure for LSC configuration.
+ * @offset: Table Offset of the gain table.
+ * @gain_mode_n: Vertical dimension of a paxel in LSC configuration.
+ * @gain_mode_m: Horizontal dimension of a paxel in LSC configuration.
+ * @gain_format: Gain table format.
+ * @fmtsph: Start pixel horizontal from start of the HS sync pulse.
+ * @fmtlnh: Number of pixels in horizontal direction to use for the data
+ *          reformatter.
+ * @fmtslv: Start line from start of VS sync pulse for the data reformatter.
+ * @fmtlnv: Number of lines in vertical direction for the data reformatter.
+ * @initial_x: X position, in pixels, of the first active pixel in reference
+ *             to the first active paxel. Must be an even number.
+ * @initial_y: Y position, in pixels, of the first active pixel in reference
+ *             to the first active paxel. Must be an even number.
+ * @size: Size of LSC gain table. Filled when loaded from userspace.
+ */
+struct ispccdc_lsc_config {
+	u8 offset;
+	u8 gain_mode_n;
+	u8 gain_mode_m;
+	u8 gain_format;
+	u16 fmtsph;
+	u16 fmtlnh;
+	u16 fmtslv;
+	u16 fmtlnv;
+	u8 initial_x;
+	u8 initial_y;
+	u32 size;
+};
+
+/**
  * struct ispccdc_bclamp - Structure for Optical & Digital black clamp subtract
  * @obgain: Optical black average gain.
  * @obstpixel: Start Pixel w.r.t. HS pulse in Optical black sample.

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list