Просмотр исходного кода

v4l: of: Parse endpoint channel information for BT656 bus

For BT656 bus, there can be more than one video time multiplexed.
These are called as channels. There can be multiple methods of
multiplexing, commonly used are, single channel, 2chan, 4chan
pixel multiplexed and line multiplexed(variable chan num).

Also, the channel numbers for the multiplexed videos can vary.
Add support for describing the channel numbers and multiplexing method
in the device tree endpoint node for the BT656 video interface.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Nikhil Devshatwar 10 лет назад
Родитель
Сommit
c358d498d6
2 измененных файлов с 24 добавлено и 0 удалено
  1. 21 0
      drivers/media/v4l2-core/v4l2-fwnode.c
  2. 3 0
      include/media/v4l2-fwnode.h

+ 21 - 0
drivers/media/v4l2-core/v4l2-fwnode.c

@@ -114,6 +114,7 @@ static void v4l2_fwnode_endpoint_parse_parallel_bus(
 	struct v4l2_fwnode_bus_parallel *bus = &vep->bus.parallel;
 	unsigned int flags = 0;
 	u32 v;
+	int rval;
 
 	if (!fwnode_property_read_u32(fwnode, "hsync-active", &v))
 		flags |= v ? V4L2_MBUS_HSYNC_ACTIVE_HIGH :
@@ -158,6 +159,26 @@ static void v4l2_fwnode_endpoint_parse_parallel_bus(
 		flags |= v ? V4L2_MBUS_DATA_ENABLE_HIGH :
 			V4L2_MBUS_DATA_ENABLE_LOW;
 
+	if (vep->bus_type == V4L2_MBUS_BT656) {
+		if (fwnode_property_present(fwnode, "pixel-mux"))
+			bus->pixmux = 1;
+		else
+			bus->pixmux = 0;
+
+		bus->num_channels = 0;
+		rval = fwnode_property_read_u8_array(fwnode, "channels",
+						     NULL, 0);
+		if (rval > 0) {
+			bus->num_channels = min_t(int,
+						  ARRAY_SIZE(bus->channels),
+						  rval);
+
+			fwnode_property_read_u8_array(fwnode, "channels",
+						      bus->channels,
+						      bus->num_channels);
+		}
+	}
+
 	bus->flags = flags;
 
 }

+ 3 - 0
include/media/v4l2-fwnode.h

@@ -57,6 +57,9 @@ struct v4l2_fwnode_bus_parallel {
 	unsigned int flags;
 	unsigned char bus_width;
 	unsigned char data_shift;
+	unsigned char num_channels;
+	unsigned char pixmux;
+	unsigned char channels[16];
 };
 
 /**