aboutsummaryrefslogtreecommitdiffstats
path: root/include/media/v4l2-of.h
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2012-09-26 04:24:03 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-31 09:34:09 -0400
commit99fd133f907afdb430942d8d2ae53faa438adfe8 (patch)
treee26faf4e708531d713aee69a0b3355324a9ba046 /include/media/v4l2-of.h
parent53c5b6c95f1850b0f95b445e0c6f1c133b00bfef (diff)
[media] Add a V4L2 OF parser
Add a V4L2 OF parser, implementing bindings documented in Documentation/devicetree/bindings/media/video-interfaces.txt. [s.nawrocki@samsung.com: various corrections and improvements since the initial version] Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media/v4l2-of.h')
-rw-r--r--include/media/v4l2-of.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
new file mode 100644
index 000000000000..00f91473498c
--- /dev/null
+++ b/include/media/v4l2-of.h
@@ -0,0 +1,111 @@
1/*
2 * V4L2 OF binding parsing library
3 *
4 * Copyright (C) 2012 Renesas Electronics Corp.
5 * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
6 *
7 * Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd.
8 * Sylwester Nawrocki <s.nawrocki@samsung.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 */
14#ifndef _V4L2_OF_H
15#define _V4L2_OF_H
16
17#include <linux/list.h>
18#include <linux/types.h>
19#include <linux/errno.h>
20
21#include <media/v4l2-mediabus.h>
22
23struct device_node;
24
25/**
26 * struct v4l2_of_bus_mipi_csi2 - MIPI CSI-2 bus data structure
27 * @flags: media bus (V4L2_MBUS_*) flags
28 * @data_lanes: an array of physical data lane indexes
29 * @clock_lane: physical lane index of the clock lane
30 * @num_data_lanes: number of data lanes
31 */
32struct v4l2_of_bus_mipi_csi2 {
33 unsigned int flags;
34 unsigned char data_lanes[4];
35 unsigned char clock_lane;
36 unsigned short num_data_lanes;
37};
38
39/**
40 * struct v4l2_of_bus_parallel - parallel data bus data structure
41 * @flags: media bus (V4L2_MBUS_*) flags
42 * @bus_width: bus width in bits
43 * @data_shift: data shift in bits
44 */
45struct v4l2_of_bus_parallel {
46 unsigned int flags;
47 unsigned char bus_width;
48 unsigned char data_shift;
49};
50
51/**
52 * struct v4l2_of_endpoint - the endpoint data structure
53 * @port: identifier (value of reg property) of a port this endpoint belongs to
54 * @id: identifier (value of reg property) of this endpoint
55 * @local_node: pointer to device_node of this endpoint
56 * @remote: phandle to remote endpoint node
57 * @bus_type: bus type
58 * @bus: bus configuration data structure
59 * @head: list head for this structure
60 */
61struct v4l2_of_endpoint {
62 unsigned int port;
63 unsigned int id;
64 const struct device_node *local_node;
65 const __be32 *remote;
66 enum v4l2_mbus_type bus_type;
67 union {
68 struct v4l2_of_bus_parallel parallel;
69 struct v4l2_of_bus_mipi_csi2 mipi_csi2;
70 } bus;
71 struct list_head head;
72};
73
74#ifdef CONFIG_OF
75void v4l2_of_parse_endpoint(const struct device_node *node,
76 struct v4l2_of_endpoint *link);
77struct device_node *v4l2_of_get_next_endpoint(const struct device_node *parent,
78 struct device_node *previous);
79struct device_node *v4l2_of_get_remote_port_parent(
80 const struct device_node *node);
81struct device_node *v4l2_of_get_remote_port(const struct device_node *node);
82#else /* CONFIG_OF */
83
84static inline int v4l2_of_parse_endpoint(const struct device_node *node,
85 struct v4l2_of_endpoint *link)
86{
87 return -ENOSYS;
88}
89
90static inline struct device_node *v4l2_of_get_next_endpoint(
91 const struct device_node *parent,
92 struct device_node *previous)
93{
94 return NULL;
95}
96
97static inline struct device_node *v4l2_of_get_remote_port_parent(
98 const struct device_node *node)
99{
100 return NULL;
101}
102
103static inline struct device_node *v4l2_of_get_remote_port(
104 const struct device_node *node)
105{
106 return NULL;
107}
108
109#endif /* CONFIG_OF */
110
111#endif /* _V4L2_OF_H */