mwifiex: fix typo in PCIe adapter NULL check
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / exynos / exynos_drm_fimd.c
index ae0153badaf9539f4d8bd7a8345c4dd701aa71b9..bf0d9baca2bc2436c077cf62391da74fe2288e83 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
+#include <linux/of_device.h>
 #include <linux/pm_runtime.h>
 
 #include <video/samsung_fimd.h>
@@ -106,9 +107,28 @@ struct fimd_context {
        struct exynos_drm_panel_info *panel;
 };
 
+#ifdef CONFIG_OF
+static const struct of_device_id fimd_driver_dt_match[] = {
+       { .compatible = "samsung,exynos4-fimd",
+         .data = &exynos4_fimd_driver_data },
+       { .compatible = "samsung,exynos5-fimd",
+         .data = &exynos5_fimd_driver_data },
+       {},
+};
+MODULE_DEVICE_TABLE(of, fimd_driver_dt_match);
+#endif
+
 static inline struct fimd_driver_data *drm_fimd_get_driver_data(
        struct platform_device *pdev)
 {
+#ifdef CONFIG_OF
+       const struct of_device_id *of_id =
+                       of_match_device(fimd_driver_dt_match, &pdev->dev);
+
+       if (of_id)
+               return (struct fimd_driver_data *)of_id->data;
+#endif
+
        return (struct fimd_driver_data *)
                platform_get_device_id(pdev)->driver_data;
 }
@@ -243,7 +263,9 @@ static void fimd_commit(struct device *dev)
 
        /* setup horizontal and vertical display size. */
        val = VIDTCON2_LINEVAL(timing->yres - 1) |
-              VIDTCON2_HOZVAL(timing->xres - 1);
+              VIDTCON2_HOZVAL(timing->xres - 1) |
+              VIDTCON2_LINEVAL_E(timing->yres - 1) |
+              VIDTCON2_HOZVAL_E(timing->xres - 1);
        writel(val, ctx->regs + driver_data->timing_base + VIDTCON2);
 
        /* setup clock source, clock divider, enable dma. */
@@ -518,12 +540,16 @@ static void fimd_win_commit(struct device *dev, int zpos)
 
        /* buffer size */
        val = VIDW_BUF_SIZE_OFFSET(win_data->buf_offsize) |
-               VIDW_BUF_SIZE_PAGEWIDTH(win_data->line_size);
+               VIDW_BUF_SIZE_PAGEWIDTH(win_data->line_size) |
+               VIDW_BUF_SIZE_OFFSET_E(win_data->buf_offsize) |
+               VIDW_BUF_SIZE_PAGEWIDTH_E(win_data->line_size);
        writel(val, ctx->regs + VIDWx_BUF_SIZE(win, 0));
 
        /* OSD position */
        val = VIDOSDxA_TOPLEFT_X(win_data->offset_x) |
-               VIDOSDxA_TOPLEFT_Y(win_data->offset_y);
+               VIDOSDxA_TOPLEFT_Y(win_data->offset_y) |
+               VIDOSDxA_TOPLEFT_X_E(win_data->offset_x) |
+               VIDOSDxA_TOPLEFT_Y_E(win_data->offset_y);
        writel(val, ctx->regs + VIDOSD_A(win));
 
        last_x = win_data->offset_x + win_data->ovl_width;
@@ -533,7 +559,9 @@ static void fimd_win_commit(struct device *dev, int zpos)
        if (last_y)
                last_y--;
 
-       val = VIDOSDxB_BOTRIGHT_X(last_x) | VIDOSDxB_BOTRIGHT_Y(last_y);
+       val = VIDOSDxB_BOTRIGHT_X(last_x) | VIDOSDxB_BOTRIGHT_Y(last_y) |
+               VIDOSDxB_BOTRIGHT_X_E(last_x) | VIDOSDxB_BOTRIGHT_Y_E(last_y);
+
        writel(val, ctx->regs + VIDOSD_B(win));
 
        DRM_DEBUG_KMS("osd pos: tx = %d, ty = %d, bx = %d, by = %d\n",
@@ -1083,5 +1111,6 @@ struct platform_driver fimd_driver = {
                .name   = "exynos4-fb",
                .owner  = THIS_MODULE,
                .pm     = &fimd_pm_ops,
+               .of_match_table = of_match_ptr(fimd_driver_dt_match),
        },
 };