Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Sakari Ailus <sakari.ailus <at> nokia.com>
Subject: [RFC]V4L2 internal device: Add a call for querying slave interface properties
Newsgroups: gmane.comp.video.video4linux
Date: Tuesday 7th August 2007 11:45:13 UTC (over 10 years ago)
Hi.

This patch adds a new ioctl call to the V4L2 internal interface. It 
allows querying the slave about the properties of its physical 
interface, e.g. the type of the interface and on parallel interface the 
polarity of latch clock.

I have put the additional definitions to videodev2.h. Do you think they 
would be better located in v4l2-int-device.h? The question is mainly 
whether these definitions are (and will be) meaningful only in the 
context of this interface or not.

Comments are of course most welcome.

(As you might have guessed, the parallel interface is used on N800 (OMAP 
2 + TCM825x). Sorry for the line breaks, I'm putting this as an 
attachment as well.)

---
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index d16a2b5..c222244 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1408,6 +1408,59 @@ struct v4l2_chip_ident {
  };

  /*
+ *     I N T E R N A L   D E V I C E   I N T E R F A C E
+ *
+ */
+
+/* Slave device interface type. */
+enum v4l2_if_type {
+       /*
+        * Parallel 8-, 10- or 12-bit interface, used by for example
+        * on certain image sensors.
+        */
+       V4L2_IF_TYPE_PARALLEL,
+};
+
+/*
+ * 0: Frame begins when vsync is high.
+ * 1: Frame begins when vsync changes from low to high.
+ */
+#define V4L2_IF_TYPE_PARALLEL_FRAME_START_ON_RISING_VS (0x1 << 0)
+/* Use Bt synchronisation codes for sync correction. */
+#define V4L2_IF_TYPE_PARALLEL_BT_SYNC_CORRECT          (0x1 << 1)
+/* Swap every two adjacent image data elements. */
+#define V4L2_IF_TYPE_PARALLEL_SWAP                     (0x1 << 2)
+/* Inverted latch clock polarity from slave. */
+#define V4L2_IF_TYPE_PARALLEL_LATCH_CLK_INV            (0x1 << 3)
+/* Hs polarity. 0 is active high, 1 active low. */
+#define V4L2_IF_TYPE_PARALLEL_NOBT_HS_INV              (0x1 << 4)
+/* Vs polarity. 0 is active high, 1 active low. */
+#define V4L2_IF_TYPE_PARALLEL_NOBT_VS_INV              (0x1 << 5)
+
+/* Parallel interface operational modes. */
+#define V4L2_IF_TYPE_PARALLEL_MODE_MASK                        (0x7 << 6)
+/*
+ * Modes without Bt synchronisation codes. Separate synchronisation
+ * signal lines are used.
+ */
+#define V4L2_IF_TYPE_PARALLEL_MODE_NOBT_8BIT           (0x0 << 6)
+#define V4L2_IF_TYPE_PARALLEL_MODE_NOBT_10BIT          (0x1 << 6)
+#define V4L2_IF_TYPE_PARALLEL_MODE_NOBT_12BIT          (0x2 << 6)
+/*
+ * Use Bt synchronisation codes. The vertical and horizontal
+ * synchronisation is done based on synchronisation codes.
+ */
+#define V4L2_IF_TYPE_PARALLEL_MODE_BT_8BIT             (0x3 << 6)
+#define V4L2_IF_TYPE_PARALLEL_MODE_BT_10BIT            (0x4 << 6)
+
+struct v4l2_ifparm {
+       enum v4l2_if_type if_type;
+       union {
+               u32 parallel_flags;
+       } u;
+};
+
+/*
   *     I O C T L   C O D E S   F O R   V I D E O   D E V I C E S
   *
   */
diff --git a/include/media/v4l2-int-device.h 
b/include/media/v4l2-int-device.h
index 2b6fc11..5b144b9 100644
--- a/include/media/v4l2-int-device.h
+++ b/include/media/v4l2-int-device.h
@@ -62,10 +62,12 @@ enum v4l2_int_ioctl_num {
         vidioc_int_dev_exit_num,
         /* Set device power state: 0 is off, non-zero is on. */
         vidioc_int_s_power_num,
-       /* Get parallel interface clock speed for current settings. */
+       /* Get slave interface parameters. */
+       vidioc_int_g_ifparm_num,
+       /* Get external clock speed for current slave settings. */
         vidioc_int_g_ext_clk_num,
         /*
-        * Tell what the parallel interface clock speed actually is.
+        * Tell what the generated interface clock speed actually is.
          */
         vidioc_int_s_ext_clk_num,
         /* Does the slave need to be reset after VIDIOC_DQBUF? */
@@ -199,6 +201,7 @@ V4L2_INT_WRAPPER_1(s_parm, struct v4l2_streamparm, *);
  V4L2_INT_WRAPPER_0(dev_init);
  V4L2_INT_WRAPPER_0(dev_exit);
  V4L2_INT_WRAPPER_1(s_power, int, );
+V4L2_INT_WRAPPER_1(g_ifparm, struct v4l2_ifparm, *);
  V4L2_INT_WRAPPER_1(s_ext_clk, u32, );
  V4L2_INT_WRAPPER_1(g_ext_clk, u32, *);
  V4L2_INT_WRAPPER_1(g_needs_reset, void, *);
---

-- 
Sakari Ailus
[email protected]
 
CD: 2ms