aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2013-05-16 15:36:38 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-05-28 14:42:52 +0300
commitffa3fd21de8ab0db7962b612d4c6e17c0d88e9c2 (patch)
tree243464ded069260464e822e051f6aa2090b9deca
parentvideomode: don't allocate mem in of_get_display_timing() (diff)
downloadlinux-dev-ffa3fd21de8ab0db7962b612d4c6e17c0d88e9c2.tar.xz
linux-dev-ffa3fd21de8ab0db7962b612d4c6e17c0d88e9c2.zip
videomode: implement public of_get_display_timing()
The current of_get_display_timings() reads multiple display timings, allocating memory for the entries. However, most of the time when parsing display timings from DT data is needed, there's only one display timing as it's not common for a LCD panel to support multiple videomodes. This patch creates a new function: int of_get_display_timing(struct device_node *np, const char *name, struct display_timing *dt); which can be used to parse a single display timing entry from the given node name. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Philipp Zabel <p.zabel@pengutronix.de>
-rw-r--r--drivers/video/of_display_timing.c33
-rw-r--r--include/video/of_display_timing.h2
2 files changed, 32 insertions, 3 deletions
diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c
index 0e8102344b2e..9c0f17b2e6fb 100644
--- a/drivers/video/of_display_timing.c
+++ b/drivers/video/of_display_timing.c
@@ -53,10 +53,10 @@ static int parse_timing_property(struct device_node *np, const char *name,
}
/**
- * of_get_display_timing - parse display_timing entry from device_node
+ * of_parse_display_timing - parse display_timing entry from device_node
* @np: device_node with the properties
**/
-static int of_get_display_timing(struct device_node *np,
+static int of_parse_display_timing(struct device_node *np,
struct display_timing *dt)
{
u32 val = 0;
@@ -103,6 +103,33 @@ static int of_get_display_timing(struct device_node *np,
}
/**
+ * of_get_display_timing - parse a display_timing entry
+ * @np: device_node with the timing subnode
+ * @name: name of the timing node
+ * @dt: display_timing struct to fill
+ **/
+int of_get_display_timing(struct device_node *np, const char *name,
+ struct display_timing *dt)
+{
+ struct device_node *timing_np;
+
+ if (!np) {
+ pr_err("%s: no devicenode given\n", of_node_full_name(np));
+ return -EINVAL;
+ }
+
+ timing_np = of_find_node_by_name(np, name);
+ if (!timing_np) {
+ pr_err("%s: could not find node '%s'\n",
+ of_node_full_name(np), name);
+ return -ENOENT;
+ }
+
+ return of_parse_display_timing(timing_np, dt);
+}
+EXPORT_SYMBOL_GPL(of_get_display_timing);
+
+/**
* of_get_display_timings - parse all display_timing entries from a device_node
* @np: device_node with the subnodes
**/
@@ -177,7 +204,7 @@ struct display_timings *of_get_display_timings(struct device_node *np)
goto timingfail;
}
- r = of_get_display_timing(entry, dt);
+ r = of_parse_display_timing(entry, dt);
if (r) {
/*
* to not encourage wrong devicetrees, fail in case of
diff --git a/include/video/of_display_timing.h b/include/video/of_display_timing.h
index 8016eb727cf3..6562ad965889 100644
--- a/include/video/of_display_timing.h
+++ b/include/video/of_display_timing.h
@@ -14,6 +14,8 @@ struct display_timings;
#define OF_USE_NATIVE_MODE -1
+int of_get_display_timing(struct device_node *np, const char *name,
+ struct display_timing *dt);
struct display_timings *of_get_display_timings(struct device_node *np);
int of_display_timings_exist(struct device_node *np);