]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - include/media/v4l2-of.h
[media] v4l: of: Remove the head field in struct v4l2_of_endpoint
[mirror_ubuntu-zesty-kernel.git] / include / media / v4l2-of.h
CommitLineData
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>
fd9fdb78 20#include <linux/of_graph.h>
99fd133f
GL
21
22#include <media/v4l2-mediabus.h>
23
24struct device_node;
25
26/**
27 * struct v4l2_of_bus_mipi_csi2 - MIPI CSI-2 bus data structure
28 * @flags: media bus (V4L2_MBUS_*) flags
29 * @data_lanes: an array of physical data lane indexes
30 * @clock_lane: physical lane index of the clock lane
31 * @num_data_lanes: number of data lanes
b6eec1c4
SA
32 * @lane_polarities: polarity of the lanes. The order is the same of
33 * the physical lanes.
99fd133f
GL
34 */
35struct v4l2_of_bus_mipi_csi2 {
36 unsigned int flags;
37 unsigned char data_lanes[4];
38 unsigned char clock_lane;
39 unsigned short num_data_lanes;
b6eec1c4 40 bool lane_polarities[5];
99fd133f
GL
41};
42
43/**
44 * struct v4l2_of_bus_parallel - parallel data bus data structure
45 * @flags: media bus (V4L2_MBUS_*) flags
46 * @bus_width: bus width in bits
47 * @data_shift: data shift in bits
48 */
49struct v4l2_of_bus_parallel {
50 unsigned int flags;
51 unsigned char bus_width;
52 unsigned char data_shift;
53};
54
55/**
56 * struct v4l2_of_endpoint - the endpoint data structure
f2a575f6 57 * @base: struct of_endpoint containing port, id, and local of_node
99fd133f
GL
58 * @bus_type: bus type
59 * @bus: bus configuration data structure
99fd133f
GL
60 */
61struct v4l2_of_endpoint {
f2a575f6 62 struct of_endpoint base;
99fd133f
GL
63 enum v4l2_mbus_type bus_type;
64 union {
65 struct v4l2_of_bus_parallel parallel;
66 struct v4l2_of_bus_mipi_csi2 mipi_csi2;
67 } bus;
99fd133f
GL
68};
69
c9bca8b3
LP
70/**
71 * struct v4l2_of_link - a link between two endpoints
72 * @local_node: pointer to device_node of this endpoint
73 * @local_port: identifier of the port this endpoint belongs to
74 * @remote_node: pointer to device_node of the remote endpoint
75 * @remote_port: identifier of the port the remote endpoint belongs to
76 */
77struct v4l2_of_link {
78 struct device_node *local_node;
79 unsigned int local_port;
80 struct device_node *remote_node;
81 unsigned int remote_port;
82};
83
99fd133f 84#ifdef CONFIG_OF
9ff889b6
LP
85int v4l2_of_parse_endpoint(const struct device_node *node,
86 struct v4l2_of_endpoint *endpoint);
c9bca8b3
LP
87int v4l2_of_parse_link(const struct device_node *node,
88 struct v4l2_of_link *link);
89void v4l2_of_put_link(struct v4l2_of_link *link);
99fd133f
GL
90#else /* CONFIG_OF */
91
92static inline int v4l2_of_parse_endpoint(const struct device_node *node,
93 struct v4l2_of_endpoint *link)
94{
95 return -ENOSYS;
96}
97
c9bca8b3
LP
98static inline int v4l2_of_parse_link(const struct device_node *node,
99 struct v4l2_of_link *link)
100{
101 return -ENOSYS;
102}
103
104static inline void v4l2_of_put_link(struct v4l2_of_link *link)
105{
106}
107
99fd133f
GL
108#endif /* CONFIG_OF */
109
110#endif /* _V4L2_OF_H */