]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
drm: xilinx: plane: Add the format property in the planes node
authorHyun Kwon <hyun.kwon@xilinx.com>
Tue, 6 May 2014 02:52:43 +0000 (19:52 -0700)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 8 May 2014 06:48:41 +0000 (08:48 +0200)
Add the format property in the planes node. This allows to configure
the pixel format properly as the format can differ depending on configuration.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/gpu/drm/xilinx/xilinx_drm_plane.c

index ff05b4c51acd4ee68c11e8daeb8db8acf6842850..bbaf9d5a0f2b6e1c2add8089dce569f85d71238f 100644 (file)
@@ -813,6 +813,7 @@ static int
 xilinx_drm_plane_init_manager(struct xilinx_drm_plane_manager *manager)
 {
        unsigned int format;
+       uint32_t drm_format;
        int ret = 0;
 
        if (manager->osd) {
@@ -820,12 +821,12 @@ xilinx_drm_plane_init_manager(struct xilinx_drm_plane_manager *manager)
                manager->max_width = xilinx_osd_get_max_width(manager->osd);
 
                format = xilinx_osd_get_format(manager->osd);
-               ret = xilinx_drm_format_by_code(format, &manager->format);
+               ret = xilinx_drm_format_by_code(format, &drm_format);
+               if (drm_format != manager->format)
+                       ret = -EINVAL;
        } else {
                /* without osd, only one plane is supported */
                manager->num_planes = 1;
-               /* YUV422 based on the current pipeline design without osd */
-               manager->format = DRM_FORMAT_YUYV;
                manager->max_width = 4096;
        }
 
@@ -838,6 +839,7 @@ xilinx_drm_plane_probe_manager(struct drm_device *drm)
        struct xilinx_drm_plane_manager *manager;
        struct device *dev = drm->dev;
        struct device_node *sub_node;
+       const char *format;
        int ret;
 
        manager = devm_kzalloc(dev, sizeof(*manager), GFP_KERNEL);
@@ -851,6 +853,20 @@ xilinx_drm_plane_probe_manager(struct drm_device *drm)
                return ERR_PTR(-EINVAL);
        }
 
+       /* check the base pixel format of plane manager */
+       ret = of_property_read_string(manager->node, "xlnx,pixel-format",
+                                     &format);
+       if (ret < 0) {
+               DRM_ERROR("failed to get a plane manager format\n");
+               return ERR_PTR(ret);
+       }
+
+       ret = xilinx_drm_format_by_name(format, &manager->format);
+       if (ret < 0) {
+               DRM_ERROR("invalid plane manager format\n");
+               return ERR_PTR(ret);
+       }
+
        manager->drm = drm;
 
        /* probe an OSD. proceed even if there's no OSD */