summaryrefslogtreecommitdiffstats
path: root/include/media/v4l2-of.h
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@iki.fi>2015-03-22 21:48:26 +0100
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-27 21:04:28 +0200
commit698da18e082c8fdfa675bee6338e3f9864d5d7ee (patch)
tree36400cabe4da4f3c47b8588e81cf6797f3197d0e /include/media/v4l2-of.h
parent[media] v4l: of: Instead of zeroing bus_type and bus field separately, unify ... (diff)
downloadlinux-698da18e082c8fdfa675bee6338e3f9864d5d7ee.tar.xz
linux-698da18e082c8fdfa675bee6338e3f9864d5d7ee.zip
[media] v4l: of: Parse variable length properties --- link-frequencies
The link-frequencies property is a variable length array of link frequencies in an endpoint. The array is needed by an increasing number of drivers, so it makes sense to add it to struct v4l2_of_endpoint. However, the length of the array is variable and the size of struct v4l2_of_endpoint is fixed since it is allocated by the caller. The options here are 1. to define a fixed maximum limit of link frequencies that has to be the global maximum of all boards. This is seen as problematic since the maximum could be largish, and everyone hitting the problem would need to submit a patch to fix it, or 2. parse the property in every driver. This doesn't sound appealing as two of the three implementations submitted to linux-media were wrong, and one of them was even merged before this was noticed, or 3. change the interface so that allocating and releasing memory according to the size of the array is possible. This is what the patch does. v4l2_of_alloc_parse_endpoint() is just like v4l2_of_parse_endpoint(), but it will allocate the memory resources needed to store struct v4l2_of_endpoint and the additional arrays pointed to by this struct. A corresponding release function v4l2_of_free_endpoint() is provided to release the memory allocated by v4l2_of_alloc_parse_endpoint(). In addition to this, the link-frequencies property is parsed as well, and the result is stored to struct v4l2_of_endpoint field link_frequencies. Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'include/media/v4l2-of.h')
-rw-r--r--include/media/v4l2-of.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
index 6c85c079544f..241e98aee40e 100644
--- a/include/media/v4l2-of.h
+++ b/include/media/v4l2-of.h
@@ -57,6 +57,8 @@ struct v4l2_of_bus_parallel {
* @base: struct of_endpoint containing port, id, and local of_node
* @bus_type: bus type
* @bus: bus configuration data structure
+ * @link_frequencies: array of supported link frequencies
+ * @nr_of_link_frequencies: number of elements in link_frequenccies array
*/
struct v4l2_of_endpoint {
struct of_endpoint base;
@@ -66,6 +68,8 @@ struct v4l2_of_endpoint {
struct v4l2_of_bus_parallel parallel;
struct v4l2_of_bus_mipi_csi2 mipi_csi2;
} bus;
+ u64 *link_frequencies;
+ unsigned int nr_of_link_frequencies;
};
/**
@@ -85,6 +89,9 @@ struct v4l2_of_link {
#ifdef CONFIG_OF
int v4l2_of_parse_endpoint(const struct device_node *node,
struct v4l2_of_endpoint *endpoint);
+struct v4l2_of_endpoint *v4l2_of_alloc_parse_endpoint(
+ const struct device_node *node);
+void v4l2_of_free_endpoint(struct v4l2_of_endpoint *endpoint);
int v4l2_of_parse_link(const struct device_node *node,
struct v4l2_of_link *link);
void v4l2_of_put_link(struct v4l2_of_link *link);
@@ -96,6 +103,16 @@ static inline int v4l2_of_parse_endpoint(const struct device_node *node,
return -ENOSYS;
}
+struct v4l2_of_endpoint *v4l2_of_alloc_parse_endpoint(
+ const struct device_node *node)
+{
+ return NULL;
+}
+
+static void v4l2_of_free_endpoint(struct v4l2_of_endpoint *endpoint)
+{
+}
+
static inline int v4l2_of_parse_link(const struct device_node *node,
struct v4l2_of_link *link)
{