media: v4l2-fwnode: add v4l2_fwnode_connector

Currently every driver needs to parse the connector endpoints by it self.
This is the initial work to make this generic. A generic connector has
common members and connector specific members. The common members are:
  - type
  - label (optional)
  - links
  - nr_of_links

The specific members are stored within a union, since only one of them
can be available at the time. Since this is the initial support the
patch adds only the analog-connector specific ones.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Marco Felsch 2020-03-12 11:31:42 +01:00 committed by Mauro Carvalho Chehab
parent 5e316ff52c
commit a5e1deec4e

View File

@ -127,6 +127,63 @@ struct v4l2_fwnode_link {
unsigned int remote_id;
};
/**
* enum v4l2_connector_type - connector type
* @V4L2_CONN_UNKNOWN: unknown connector type, no V4L2 connector configuration
* @V4L2_CONN_COMPOSITE: analog composite connector
* @V4L2_CONN_SVIDEO: analog svideo connector
*/
enum v4l2_connector_type {
V4L2_CONN_UNKNOWN,
V4L2_CONN_COMPOSITE,
V4L2_CONN_SVIDEO,
};
/**
* struct v4l2_connector_link - connector link data structure
* @head: structure to be used to add the link to the
* &struct v4l2_fwnode_connector
* @fwnode_link: &struct v4l2_fwnode_link link between the connector and the
* device the connector belongs to.
*/
struct v4l2_connector_link {
struct list_head head;
struct v4l2_fwnode_link fwnode_link;
};
/**
* struct v4l2_fwnode_connector_analog - analog connector data structure
* @sdtv_stds: sdtv standards this connector supports, set to V4L2_STD_ALL
* if no restrictions are specified.
*/
struct v4l2_fwnode_connector_analog {
v4l2_std_id sdtv_stds;
};
/**
* struct v4l2_fwnode_connector - the connector data structure
* @name: the connector device name
* @label: optional connector label
* @type: connector type
* @links: list of all connector &struct v4l2_connector_link links
* @nr_of_links: total number of links
* @connector: connector configuration
* @connector.analog: analog connector configuration
* &struct v4l2_fwnode_connector_analog
*/
struct v4l2_fwnode_connector {
const char *name;
const char *label;
enum v4l2_connector_type type;
struct list_head links;
unsigned int nr_of_links;
union {
struct v4l2_fwnode_connector_analog analog;
/* future connectors */
} connector;
};
/**
* v4l2_fwnode_endpoint_parse() - parse all fwnode node properties
* @fwnode: pointer to the endpoint's fwnode handle