]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
drm: xlnx: bridge: Add support for VTC as bridge
authorVishal Sagar <vishal.sagar@xilinx.com>
Mon, 11 Jun 2018 12:20:13 +0000 (17:50 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 19 Jun 2018 08:29:14 +0000 (10:29 +0200)
Adds support to have VTC as a bridge by adding API for
setting timings based on the videomode.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/gpu/drm/xlnx/xlnx_bridge.c
drivers/gpu/drm/xlnx/xlnx_bridge.h

index ad706a5666bf0f04a87a472208d4f359d5f0dff4..6ee462ada6768e9d12f95d54a448d629151d5f33 100644 (file)
@@ -52,6 +52,7 @@ struct xlnx_bridge_helper {
 
 static struct xlnx_bridge_helper helper;
 
+struct videomode;
 /*
  * Client functions
  */
@@ -209,6 +210,34 @@ int xlnx_bridge_get_output_fmts(struct xlnx_bridge *bridge,
 }
 EXPORT_SYMBOL(xlnx_bridge_get_output_fmts);
 
+/**
+ * xlnx_bridge_set_timing - Set the video timing
+ * @bridge: bridge to set
+ * @vm: Videomode
+ *
+ * Set the video mode so that timing can be generated using this
+ * by the video timing controller.
+ *
+ * Return: 0 on success. -ENOENT if no callback, -EFAULT if in error state,
+ * or return code from callback.
+ */
+int xlnx_bridge_set_timing(struct xlnx_bridge *bridge, struct videomode *vm)
+{
+       if (!bridge)
+               return 0;
+
+       if (helper.error)
+               return -EFAULT;
+
+       if (bridge->set_timing) {
+               bridge->set_timing(bridge, vm);
+               return 0;
+       }
+
+       return -ENOENT;
+}
+EXPORT_SYMBOL(xlnx_bridge_set_timing);
+
 /**
  * of_xlnx_bridge_get - Get the corresponding Xlnx bridge instance
  * @bridge_np: The device node of the bridge device
index 2dd5ca196a9a01512aa331e6500e57eb1ed9c47b..64330169bd2228833756ff5a5373295b1a25e1ba 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef _XLNX_BRIDGE_H_
 #define _XLNX_BRIDGE_H_
 
+struct videomode;
+
 struct xlnx_bridge_debugfs_file;
 
 /**
@@ -32,6 +34,7 @@ struct xlnx_bridge_debugfs_file;
  * @get_input_fmts: callback to get supported input formats.
  * @set_output: callback to set the output
  * @get_output_fmts: callback to get supported output formats.
+ * @set_timing: callback to set timing in connected video timing controller.
  * @debugfs_file: for debugfs support
  */
 struct xlnx_bridge {
@@ -48,6 +51,7 @@ struct xlnx_bridge {
                          u32 width, u32 height, u32 bus_fmt);
        int (*get_output_fmts)(struct xlnx_bridge *bridge,
                               const u32 **fmts, u32 *count);
+       int (*set_timing)(struct xlnx_bridge *bridge, struct videomode *vm);
        struct xlnx_bridge_debugfs_file *debugfs_file;
 };
 
@@ -75,6 +79,7 @@ int xlnx_bridge_set_output(struct xlnx_bridge *bridge,
                           u32 width, u32 height, u32 bus_fmt);
 int xlnx_bridge_get_output_fmts(struct xlnx_bridge *bridge,
                                const u32 **fmts, u32 *count);
+int xlnx_bridge_set_timing(struct xlnx_bridge *bridge, struct videomode *vm);
 struct xlnx_bridge *of_xlnx_bridge_get(struct device_node *bridge_np);
 void of_xlnx_bridge_put(struct xlnx_bridge *bridge);
 
@@ -141,6 +146,14 @@ static inline int xlnx_bridge_get_output_fmts(struct xlnx_bridge *bridge,
        return 0;
 }
 
+static int xlnx_bridge_set_timing(struct xlnx_bridge *bridge,
+                                 struct videomode *vm)
+{
+       if (bridge)
+               return -ENODEV;
+       return 0;
+}
+
 static inline struct xlnx_bridge *
 of_xlnx_bridge_get(struct device_node *bridge_np)
 {