Guennadi Liakhovetski | 99fd133 | 2012-09-26 05:24:03 -0300 | [diff] [blame] | 1 | /* |
| 2 | * V4L2 OF binding parsing library |
| 3 | * |
Sylwester Nawrocki | c6e8d96 | 2013-04-02 11:41:19 -0300 | [diff] [blame] | 4 | * Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd. |
| 5 | * Author: Sylwester Nawrocki <s.nawrocki@samsung.com> |
| 6 | * |
Guennadi Liakhovetski | 99fd133 | 2012-09-26 05:24:03 -0300 | [diff] [blame] | 7 | * Copyright (C) 2012 Renesas Electronics Corp. |
| 8 | * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de> |
| 9 | * |
Guennadi Liakhovetski | 99fd133 | 2012-09-26 05:24:03 -0300 | [diff] [blame] | 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> |
Philipp Zabel | fd9fdb7 | 2014-02-10 22:01:48 +0100 | [diff] [blame] | 20 | #include <linux/of_graph.h> |
Guennadi Liakhovetski | 99fd133 | 2012-09-26 05:24:03 -0300 | [diff] [blame] | 21 | |
| 22 | #include <media/v4l2-mediabus.h> |
| 23 | |
| 24 | struct 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 |
| 32 | */ |
| 33 | struct v4l2_of_bus_mipi_csi2 { |
| 34 | unsigned int flags; |
| 35 | unsigned char data_lanes[4]; |
| 36 | unsigned char clock_lane; |
| 37 | unsigned short num_data_lanes; |
| 38 | }; |
| 39 | |
| 40 | /** |
| 41 | * struct v4l2_of_bus_parallel - parallel data bus data structure |
| 42 | * @flags: media bus (V4L2_MBUS_*) flags |
| 43 | * @bus_width: bus width in bits |
| 44 | * @data_shift: data shift in bits |
| 45 | */ |
| 46 | struct v4l2_of_bus_parallel { |
| 47 | unsigned int flags; |
| 48 | unsigned char bus_width; |
| 49 | unsigned char data_shift; |
| 50 | }; |
| 51 | |
| 52 | /** |
| 53 | * struct v4l2_of_endpoint - the endpoint data structure |
Philipp Zabel | f2a575f | 2014-02-14 11:53:56 +0100 | [diff] [blame] | 54 | * @base: struct of_endpoint containing port, id, and local of_node |
Guennadi Liakhovetski | 99fd133 | 2012-09-26 05:24:03 -0300 | [diff] [blame] | 55 | * @bus_type: bus type |
| 56 | * @bus: bus configuration data structure |
| 57 | * @head: list head for this structure |
| 58 | */ |
| 59 | struct v4l2_of_endpoint { |
Philipp Zabel | f2a575f | 2014-02-14 11:53:56 +0100 | [diff] [blame] | 60 | struct of_endpoint base; |
Guennadi Liakhovetski | 99fd133 | 2012-09-26 05:24:03 -0300 | [diff] [blame] | 61 | enum v4l2_mbus_type bus_type; |
| 62 | union { |
| 63 | struct v4l2_of_bus_parallel parallel; |
| 64 | struct v4l2_of_bus_mipi_csi2 mipi_csi2; |
| 65 | } bus; |
| 66 | struct list_head head; |
| 67 | }; |
| 68 | |
| 69 | #ifdef CONFIG_OF |
Laurent Pinchart | 9ff889b | 2013-05-17 07:31:04 -0300 | [diff] [blame] | 70 | int v4l2_of_parse_endpoint(const struct device_node *node, |
| 71 | struct v4l2_of_endpoint *endpoint); |
Guennadi Liakhovetski | 99fd133 | 2012-09-26 05:24:03 -0300 | [diff] [blame] | 72 | #else /* CONFIG_OF */ |
| 73 | |
| 74 | static inline int v4l2_of_parse_endpoint(const struct device_node *node, |
| 75 | struct v4l2_of_endpoint *link) |
| 76 | { |
| 77 | return -ENOSYS; |
| 78 | } |
| 79 | |
Guennadi Liakhovetski | 99fd133 | 2012-09-26 05:24:03 -0300 | [diff] [blame] | 80 | #endif /* CONFIG_OF */ |
| 81 | |
| 82 | #endif /* _V4L2_OF_H */ |