Commit | Line | Data |
---|---|---|
99fd133f GL |
1 | /* |
2 | * V4L2 OF binding parsing library | |
3 | * | |
c6e8d96d SN |
4 | * Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd. |
5 | * Author: Sylwester Nawrocki <s.nawrocki@samsung.com> | |
6 | * | |
99fd133f GL |
7 | * Copyright (C) 2012 Renesas Electronics Corp. |
8 | * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de> | |
9 | * | |
99fd133f GL |
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 | ||
23 | struct 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 | */ | |
32 | struct 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 | */ | |
45 | struct 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 | |
99fd133f GL |
56 | * @bus_type: bus type |
57 | * @bus: bus configuration data structure | |
58 | * @head: list head for this structure | |
59 | */ | |
60 | struct v4l2_of_endpoint { | |
61 | unsigned int port; | |
62 | unsigned int id; | |
63 | const struct device_node *local_node; | |
99fd133f GL |
64 | enum v4l2_mbus_type bus_type; |
65 | union { | |
66 | struct v4l2_of_bus_parallel parallel; | |
67 | struct v4l2_of_bus_mipi_csi2 mipi_csi2; | |
68 | } bus; | |
69 | struct list_head head; | |
70 | }; | |
71 | ||
72 | #ifdef CONFIG_OF | |
9ff889b6 LP |
73 | int v4l2_of_parse_endpoint(const struct device_node *node, |
74 | struct v4l2_of_endpoint *endpoint); | |
99fd133f GL |
75 | struct device_node *v4l2_of_get_next_endpoint(const struct device_node *parent, |
76 | struct device_node *previous); | |
77 | struct device_node *v4l2_of_get_remote_port_parent( | |
78 | const struct device_node *node); | |
79 | struct device_node *v4l2_of_get_remote_port(const struct device_node *node); | |
80 | #else /* CONFIG_OF */ | |
81 | ||
82 | static inline int v4l2_of_parse_endpoint(const struct device_node *node, | |
83 | struct v4l2_of_endpoint *link) | |
84 | { | |
85 | return -ENOSYS; | |
86 | } | |
87 | ||
88 | static inline struct device_node *v4l2_of_get_next_endpoint( | |
89 | const struct device_node *parent, | |
90 | struct device_node *previous) | |
91 | { | |
92 | return NULL; | |
93 | } | |
94 | ||
95 | static inline struct device_node *v4l2_of_get_remote_port_parent( | |
96 | const struct device_node *node) | |
97 | { | |
98 | return NULL; | |
99 | } | |
100 | ||
101 | static inline struct device_node *v4l2_of_get_remote_port( | |
102 | const struct device_node *node) | |
103 | { | |
104 | return NULL; | |
105 | } | |
106 | ||
107 | #endif /* CONFIG_OF */ | |
108 | ||
109 | #endif /* _V4L2_OF_H */ |