@@ -67,6 +67,10 @@ static const struct v4l2_fwnode_bus_conv {
V4L2_FWNODE_BUS_TYPE_DPI,
V4L2_MBUS_DPI,
"DPI",
+ }, {
+ V4L2_FWNODE_BUS_TYPE_DISPLAYPORT,
+ V4L2_MBUS_DISPLAYPORT,
+ "DisplayPort",
}
};
@@ -417,6 +421,33 @@ v4l2_fwnode_endpoint_parse_csi1_bus(struct fwnode_handle *fwnode,
vep->bus_type = V4L2_MBUS_CSI1;
}
+static int
+v4l2_fwnode_endpoint_parse_dp_bus(struct fwnode_handle *fwnode,
+ struct v4l2_fwnode_endpoint *vep,
+ enum v4l2_mbus_type bus_type)
+{
+ struct v4l2_mbus_config_displayport *bus = &vep->bus.displayport;
+ u32 array[4];
+ int count;
+ int i;
+
+ count = fwnode_property_count_u32(fwnode, "data-lanes");
+ if (count < 0)
+ return count;
+ if (!(count == 1 || count == 2 || count == 4))
+ return -EINVAL;
+ fwnode_property_read_u32_array(fwnode, "data-lanes", array, count);
+
+ for (i = 0; i < count; i++)
+ bus->data_lanes[i] = array[i];
+ bus->num_data_lanes = count;
+ bus->multi_stream_support = fwnode_property_present(fwnode, "multi-stream-support");
+
+ vep->bus_type = V4L2_MBUS_DISPLAYPORT;
+
+ return 0;
+}
+
static int __v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
struct v4l2_fwnode_endpoint *vep)
{
@@ -482,6 +513,13 @@ static int __v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
v4l2_fwnode_endpoint_parse_parallel_bus(fwnode, vep,
vep->bus_type);
+ break;
+ case V4L2_MBUS_DISPLAYPORT:
+ rval = v4l2_fwnode_endpoint_parse_dp_bus(fwnode, vep,
+ vep->bus_type);
+ if (rval)
+ return rval;
+
break;
default:
pr_warn("unsupported bus type %u\n", mbus_type);
@@ -36,6 +36,8 @@
* @bus.mipi_csi2: embedded &struct v4l2_mbus_config_mipi_csi2.
* Used if the bus is MIPI Alliance's Camera Serial
* Interface version 2 (MIPI CSI2).
+ * @bus.displayport: embedded &struct v4l2_mbus_config_displayport.
+ * Used if the bus is VESA DisplayPort.
* @link_frequencies: array of supported link frequencies
* @nr_of_link_frequencies: number of elements in link_frequenccies array
*/
@@ -46,6 +48,7 @@ struct v4l2_fwnode_endpoint {
struct v4l2_mbus_config_parallel parallel;
struct v4l2_mbus_config_mipi_csi1 mipi_csi1;
struct v4l2_mbus_config_mipi_csi2 mipi_csi2;
+ struct v4l2_mbus_config_displayport displayport;
} bus;
u64 *link_frequencies;
unsigned int nr_of_link_frequencies;
@@ -166,6 +169,7 @@ struct v4l2_fwnode_connector {
* @V4L2_FWNODE_BUS_TYPE_PARALLEL: Camera Parallel Interface bus
* @V4L2_FWNODE_BUS_TYPE_BT656: BT.656 video format bus-type
* @V4L2_FWNODE_BUS_TYPE_DPI: Video Parallel Interface bus
+ * @V4L2_FWNODE_BUS_TYPE_DISPLAYPORT: DisplayPort bus
* @NR_OF_V4L2_FWNODE_BUS_TYPE: Number of bus-types
*/
enum v4l2_fwnode_bus_type {
@@ -177,6 +181,7 @@ enum v4l2_fwnode_bus_type {
V4L2_FWNODE_BUS_TYPE_PARALLEL,
V4L2_FWNODE_BUS_TYPE_BT656,
V4L2_FWNODE_BUS_TYPE_DPI,
+ V4L2_FWNODE_BUS_TYPE_DISPLAYPORT,
NR_OF_V4L2_FWNODE_BUS_TYPE
};
@@ -120,6 +120,18 @@ struct v4l2_mbus_config_mipi_csi1 {
unsigned char clock_lane;
};
+/**
+ * struct v4l2_mbus_config_displayport - DisplayPort data bus configuration
+ * @data_lanes: an array of physical data lane indexes
+ * @num_data_lanes: number of data lanes
+ * @multi_stream_support: multi stream transport support
+ */
+struct v4l2_mbus_config_displayport {
+ unsigned char data_lanes[4];
+ unsigned char num_data_lanes;
+ bool multi_stream_support;
+};
+
/**
* enum v4l2_mbus_type - media bus type
* @V4L2_MBUS_UNKNOWN: unknown bus type, no V4L2 mediabus configuration
@@ -131,6 +143,7 @@ struct v4l2_mbus_config_mipi_csi1 {
* @V4L2_MBUS_CSI2_DPHY: MIPI CSI-2 serial interface, with D-PHY
* @V4L2_MBUS_CSI2_CPHY: MIPI CSI-2 serial interface, with C-PHY
* @V4L2_MBUS_DPI: MIPI VIDEO DPI interface
+ * @V4L2_MBUS_DISPLAYPORT: DisplayPort interface
* @V4L2_MBUS_INVALID: invalid bus type (keep as last)
*/
enum v4l2_mbus_type {
@@ -142,6 +155,7 @@ enum v4l2_mbus_type {
V4L2_MBUS_CSI2_DPHY,
V4L2_MBUS_CSI2_CPHY,
V4L2_MBUS_DPI,
+ V4L2_MBUS_DISPLAYPORT,
V4L2_MBUS_INVALID,
};
@@ -159,6 +173,8 @@ enum v4l2_mbus_type {
* @bus.mipi_csi2: embedded &struct v4l2_mbus_config_mipi_csi2.
* Used if the bus is MIPI Alliance's Camera Serial
* Interface version 2 (MIPI CSI2).
+ * @bus.displayport: embedded &struct v4l2_mbus_config_displayport.
+ * Used if the bus is VESA DisplayPort interface.
*/
struct v4l2_mbus_config {
enum v4l2_mbus_type type;
@@ -166,6 +182,7 @@ struct v4l2_mbus_config {
struct v4l2_mbus_config_parallel parallel;
struct v4l2_mbus_config_mipi_csi1 mipi_csi1;
struct v4l2_mbus_config_mipi_csi2 mipi_csi2;
+ struct v4l2_mbus_config_displayport displayport;
} bus;
};
Add new definitions, a config struct, and a parser for the DisplayPort media bus. Signed-off-by: Paweł Anikiel <panikiel@google.com> --- drivers/media/v4l2-core/v4l2-fwnode.c | 38 +++++++++++++++++++++++++++ include/media/v4l2-fwnode.h | 5 ++++ include/media/v4l2-mediabus.h | 17 ++++++++++++ 3 files changed, 60 insertions(+)