]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
drm: xilinx: cresample: Add input/output video format dts prop
authorHyun Kwon <hyun.kwon@xilinx.com>
Thu, 14 Nov 2013 20:16:28 +0000 (12:16 -0800)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 15 Nov 2013 08:36:26 +0000 (09:36 +0100)
Add input/output video format dts prop. It requires to detect
formats of IP and provide proper information to users.
xilinx_cresample_get_input/output_format() functions are added.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Documentation/devicetree/bindings/drm/xilinx/cresample.txt
arch/arm/boot/dts/zynq-zc702-drm-v4l2.dts
drivers/gpu/drm/xilinx/xilinx_cresample.c
drivers/gpu/drm/xilinx/xilinx_cresample.h

index 817ec94892203696d43c8e14edf42ec5f94de05a..177ab58bfc9da4097e80c713cd70b3c1df945dd3 100644 (file)
@@ -5,10 +5,18 @@ Xilinx CRESAMPLE provides the chroma resampling of YUV formats.
 Required properties:
  - compatible: value should be "xlnx,v-cresample-3.01.a"
  - reg: base address and size of the CRESAMPLE IP
+ - xlnx,input-format, xlnx,output-format: the input/output video formats of
+   CRESAMPLE. The value should be one of following format strings.
+
+       yuv422
+       yuv444
+       yuv420
 
 Example:
 
        v_cresample_0: v-cresample@40020000 {
                compatible = "xlnx,v-cresample-3.01.a";
                reg = <0x40020000 0x10000>;
+               xlnx,input-format = "yuv444";
+               xlnx,output-format = "yuv422";
        };
index dd3333951d7e746f41e0c1f61eec12655eff6193..9f4a174ee8989a8b4abfc9d9c4a800938cae6e57 100644 (file)
                cresample_0: v-cresample@40020000 {
                        compatible = "xlnx,v-cresample-4.0";
                        reg = <0x40020000 0x10000>;
-                       xlnx,input-format = <1>;
-                       xlnx,output-format = <0>;
+                       xlnx,input-format = "yuv444";
+                       xlnx,output-format = "yuv422";
                };
 
                rgb2ycrcb_0: v-rgb2ycrcb@40030000 {
index 2bb6d24a4eec28130153efc7b1fa3d226d1ab568..1afe3a588f97d0b352b6371b72bb45bb9102371b 100644 (file)
@@ -38,6 +38,8 @@
 
 struct xilinx_cresample {
        void __iomem *base;
+       const char *input_format_name;
+       const char *output_format_name;
 };
 
 /* enable cresample */
@@ -83,6 +85,20 @@ void xilinx_cresample_reset(struct xilinx_cresample *cresample)
                          reg | CRESAMPLE_CTL_RU);
 }
 
+/* get an input format */
+const char *
+xilinx_cresample_get_input_format_name(struct xilinx_cresample *cresample)
+{
+       return cresample->input_format_name;
+}
+
+/* get an output format */
+const char *
+xilinx_cresample_get_output_format_name(struct xilinx_cresample *cresample)
+{
+       return cresample->output_format_name;
+}
+
 struct xilinx_cresample *xilinx_cresample_probe(struct device *dev,
                                                struct device_node *node)
 {
@@ -104,6 +120,20 @@ struct xilinx_cresample *xilinx_cresample_probe(struct device *dev,
        if (IS_ERR(cresample->base))
                return ERR_CAST(cresample->base);
 
+       ret = of_property_read_string(node, "xlnx,input-format",
+                                     &cresample->input_format_name);
+       if (ret) {
+               dev_warn(dev, "failed to get an input format prop\n");
+               return ERR_PTR(ret);
+       }
+
+       ret = of_property_read_string(node, "xlnx,output-format",
+                                     &cresample->output_format_name);
+       if (ret) {
+               dev_warn(dev, "failed to get an output format prop\n");
+               return ERR_PTR(ret);
+       }
+
        xilinx_cresample_reset(cresample);
 
        return cresample;
index 5ee0f703bf6c657dcf06c419dfee364749b3f088..34323c72288163d79badc79a4693e81a9e781728 100644 (file)
@@ -26,6 +26,11 @@ void xilinx_cresample_reset(struct xilinx_cresample *cresample);
 void xilinx_cresample_enable(struct xilinx_cresample *cresample);
 void xilinx_cresample_disable(struct xilinx_cresample *cresample);
 
+const char *
+xilinx_cresample_get_input_format_name(struct xilinx_cresample *cresample);
+const char *
+xilinx_cresample_get_output_format_name(struct xilinx_cresample *cresample);
+
 struct device;
 struct device_node;