]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/gpu/drm/omapdrm/dss/dsi.c
drm/omap: omap_display_timings: Use display_flags for pixel data edge
[karo-tx-linux.git] / drivers / gpu / drm / omapdrm / dss / dsi.c
index e1be5e795cd807aadb0cff143ca526fb8612440b..ba3a2da7c80d501abc21bfed1a129c4d4a6bdc76 100644 (file)
@@ -3326,7 +3326,7 @@ static void dsi_config_vp_num_line_buffers(struct platform_device *dsidev)
                 * Don't use line buffers if width is greater than the video
                 * port's line buffer size
                 */
-               if (dsi->line_buffer_size <= timings->x_res * bpp / 8)
+               if (dsi->line_buffer_size <= timings->hactive * bpp / 8)
                        num_line_buffers = 0;
                else
                        num_line_buffers = 2;
@@ -3494,7 +3494,7 @@ static void dsi_config_cmd_mode_interleaving(struct platform_device *dsidev)
 
        exiths_clk = ths_exit + tclk_trail;
 
-       width_bytes = DIV_ROUND_UP(timings->x_res * bpp, 8);
+       width_bytes = DIV_ROUND_UP(timings->hactive * bpp, 8);
        bllp = hbp + hfp + hsa + DIV_ROUND_UP(width_bytes + 6, ndl);
 
        if (!hsa_blanking_mode) {
@@ -3713,7 +3713,7 @@ static void dsi_proto_timings(struct platform_device *dsidev)
                t_he = hsync_end ?
                        ((hsa == 0 && ndl == 3) ? 1 : DIV_ROUND_UP(4, ndl)) : 0;
 
-               width_bytes = DIV_ROUND_UP(timings->x_res * bpp, 8);
+               width_bytes = DIV_ROUND_UP(timings->hactive * bpp, 8);
 
                /* TL = t_HS + HSA + t_HE + HFP + ceil((WC + 6) / NDL) + HBP */
                tl = DIV_ROUND_UP(4, ndl) + (hsync_end ? hsa : 0) + t_he + hfp +
@@ -3722,7 +3722,7 @@ static void dsi_proto_timings(struct platform_device *dsidev)
                DSSDBG("HBP: %d, HFP: %d, HSA: %d, TL: %d TXBYTECLKHS\n", hbp,
                        hfp, hsync_end ? hsa : 0, tl);
                DSSDBG("VBP: %d, VFP: %d, VSA: %d, VACT: %d lines\n", vbp, vfp,
-                       vsa, timings->y_res);
+                       vsa, timings->vactive);
 
                r = dsi_read_reg(dsidev, DSI_VM_TIMING1);
                r = FLD_MOD(r, hbp, 11, 0);     /* HBP */
@@ -3738,7 +3738,7 @@ static void dsi_proto_timings(struct platform_device *dsidev)
                dsi_write_reg(dsidev, DSI_VM_TIMING2, r);
 
                r = dsi_read_reg(dsidev, DSI_VM_TIMING3);
-               r = FLD_MOD(r, timings->y_res, 14, 0);  /* VACT */
+               r = FLD_MOD(r, timings->vactive, 14, 0);        /* VACT */
                r = FLD_MOD(r, tl, 31, 16);             /* TL */
                dsi_write_reg(dsidev, DSI_VM_TIMING3, r);
        }
@@ -3856,7 +3856,7 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
                /* MODE, 1 = video mode */
                REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 1, 4, 4);
 
-               word_count = DIV_ROUND_UP(dsi->timings.x_res * bpp, 8);
+               word_count = DIV_ROUND_UP(dsi->timings.hactive * bpp, 8);
 
                dsi_vc_write_long_header(dsidev, channel, data_type,
                                word_count, 0);
@@ -3918,8 +3918,8 @@ static void dsi_update_screen_dispc(struct platform_device *dsidev)
        int r;
        const unsigned channel = dsi->update_channel;
        const unsigned line_buf_size = dsi->line_buffer_size;
-       u16 w = dsi->timings.x_res;
-       u16 h = dsi->timings.y_res;
+       u16 w = dsi->timings.hactive;
+       u16 h = dsi->timings.vactive;
 
        DSSDBG("dsi_update_screen_dispc(%dx%d)\n", w, h);
 
@@ -4056,8 +4056,8 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
        dsi->framedone_callback = callback;
        dsi->framedone_data = data;
 
-       dw = dsi->timings.x_res;
-       dh = dsi->timings.y_res;
+       dw = dsi->timings.hactive;
+       dh = dsi->timings.vactive;
 
 #ifdef DSI_PERF_MEASURE
        dsi->update_bytes = dw * dh *
@@ -4122,11 +4122,15 @@ static int dsi_display_init_dispc(struct platform_device *dsidev,
         * override interlace, logic level and edge related parameters in
         * omap_video_timings with default values
         */
-       dsi->timings.interlace = false;
-       dsi->timings.hsync_level = OMAPDSS_SIG_ACTIVE_HIGH;
-       dsi->timings.vsync_level = OMAPDSS_SIG_ACTIVE_HIGH;
-       dsi->timings.data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE;
-       dsi->timings.de_level = OMAPDSS_SIG_ACTIVE_HIGH;
+       dsi->timings.flags &= ~DISPLAY_FLAGS_INTERLACED;
+       dsi->timings.flags &= ~DISPLAY_FLAGS_HSYNC_LOW;
+       dsi->timings.flags |= DISPLAY_FLAGS_HSYNC_HIGH;
+       dsi->timings.flags &= ~DISPLAY_FLAGS_VSYNC_LOW;
+       dsi->timings.flags |= DISPLAY_FLAGS_VSYNC_HIGH;
+       dsi->timings.flags &= ~DISPLAY_FLAGS_PIXDATA_NEGEDGE;
+       dsi->timings.flags |= DISPLAY_FLAGS_PIXDATA_POSEDGE;
+       dsi->timings.flags &= ~DISPLAY_FLAGS_DE_LOW;
+       dsi->timings.flags |= DISPLAY_FLAGS_DE_HIGH;
        dsi->timings.sync_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE;
 
        dss_mgr_set_timings(channel, &dsi->timings);
@@ -4331,7 +4335,7 @@ static void print_dsi_vm(const char *str,
 
        wc = DIV_ROUND_UP(t->hact * t->bitspp, 8);
        pps = DIV_ROUND_UP(wc + 6, t->ndl); /* pixel packet size */
-       bl = t->hss + t->hsa + t->hse + t->hbp + t->hfp;
+       bl = t->hss + t->hsa + t->hse + t->hbp + t->hfront_porch;
        tot = bl + pps;
 
 #define TO_DSI_T(x) ((u32)div64_u64((u64)x * 1000000000llu, byteclk))
@@ -4340,14 +4344,14 @@ static void print_dsi_vm(const char *str,
                        "%u/%u/%u/%u/%u/%u = %u + %u = %u\n",
                        str,
                        byteclk,
-                       t->hss, t->hsa, t->hse, t->hbp, pps, t->hfp,
+                       t->hss, t->hsa, t->hse, t->hbp, pps, t->hfront_porch,
                        bl, pps, tot,
                        TO_DSI_T(t->hss),
                        TO_DSI_T(t->hsa),
                        TO_DSI_T(t->hse),
                        TO_DSI_T(t->hbp),
                        TO_DSI_T(pps),
-                       TO_DSI_T(t->hfp),
+                       TO_DSI_T(t->hfront_porch),
 
                        TO_DSI_T(bl),
                        TO_DSI_T(pps),
@@ -4361,8 +4365,8 @@ static void print_dispc_vm(const char *str, const struct omap_video_timings *t)
        unsigned long pck = t->pixelclock;
        int hact, bl, tot;
 
-       hact = t->x_res;
-       bl = t->hsw + t->hbp + t->hfp;
+       hact = t->hactive;
+       bl = t->hsync_len + t->hbp + t->hfront_porch;
        tot = hact + bl;
 
 #define TO_DISPC_T(x) ((u32)div64_u64((u64)x * 1000000000llu, pck))
@@ -4371,12 +4375,12 @@ static void print_dispc_vm(const char *str, const struct omap_video_timings *t)
                        "%u/%u/%u/%u = %u + %u = %u\n",
                        str,
                        pck,
-                       t->hsw, t->hbp, hact, t->hfp,
+                       t->hsync_len, t->hbp, hact, t->hfront_porch,
                        bl, hact, tot,
-                       TO_DISPC_T(t->hsw),
+                       TO_DISPC_T(t->hsync_len),
                        TO_DISPC_T(t->hbp),
                        TO_DISPC_T(hact),
-                       TO_DISPC_T(t->hfp),
+                       TO_DISPC_T(t->hfront_porch),
                        TO_DISPC_T(bl),
                        TO_DISPC_T(hact),
                        TO_DISPC_T(tot));
@@ -4396,13 +4400,13 @@ static void print_dsi_dispc_vm(const char *str,
        dsi_tput = (u64)byteclk * t->ndl * 8;
        pck = (u32)div64_u64(dsi_tput, t->bitspp);
        dsi_hact = DIV_ROUND_UP(DIV_ROUND_UP(t->hact * t->bitspp, 8) + 6, t->ndl);
-       dsi_htot = t->hss + t->hsa + t->hse + t->hbp + dsi_hact + t->hfp;
+       dsi_htot = t->hss + t->hsa + t->hse + t->hbp + dsi_hact + t->hfront_porch;
 
        vm.pixelclock = pck;
-       vm.hsw = div64_u64((u64)(t->hsa + t->hse) * pck, byteclk);
+       vm.hsync_len = div64_u64((u64)(t->hsa + t->hse) * pck, byteclk);
        vm.hbp = div64_u64((u64)t->hbp * pck, byteclk);
-       vm.hfp = div64_u64((u64)t->hfp * pck, byteclk);
-       vm.x_res = t->hact;
+       vm.hfront_porch = div64_u64((u64)t->hfront_porch * pck, byteclk);
+       vm.hactive = t->hact;
 
        print_dispc_vm(str, &vm);
 }
@@ -4421,10 +4425,10 @@ static bool dsi_cm_calc_dispc_cb(int lckd, int pckd, unsigned long lck,
 
        *t = *ctx->config->timings;
        t->pixelclock = pck;
-       t->x_res = ctx->config->timings->x_res;
-       t->y_res = ctx->config->timings->y_res;
-       t->hsw = t->hfp = t->hbp = t->vsw = 1;
-       t->vfp = t->vbp = 0;
+       t->hactive = ctx->config->timings->hactive;
+       t->vactive = ctx->config->timings->vactive;
+       t->hsync_len = t->hfront_porch = t->hback_porch = t->vsync_len = 1;
+       t->vfront_porch = t->vback_porch = 0;
 
        return true;
 }
@@ -4525,9 +4529,10 @@ static bool dsi_vm_calc_blanking(struct dsi_clk_calc_ctx *ctx)
        dispc_pck = ctx->dispc_cinfo.pck;
        dispc_tput = (u64)dispc_pck * bitspp;
 
-       xres = req_vm->x_res;
+       xres = req_vm->hactive;
 
-       panel_hbl = req_vm->hfp + req_vm->hbp + req_vm->hsw;
+       panel_hbl = req_vm->hfront_porch + req_vm->hback_porch +
+                   req_vm->hsync_len;
        panel_htot = xres + panel_hbl;
 
        dsi_hact = DIV_ROUND_UP(DIV_ROUND_UP(xres * bitspp, 8) + 6, ndl);
@@ -4557,7 +4562,7 @@ static bool dsi_vm_calc_blanking(struct dsi_clk_calc_ctx *ctx)
        hss = DIV_ROUND_UP(4, ndl);
 
        if (cfg->trans_mode == OMAP_DSS_DSI_PULSE_MODE) {
-               if (ndl == 3 && req_vm->hsw == 0)
+               if (ndl == 3 && req_vm->hsync_len == 0)
                        hse = 1;
                else
                        hse = DIV_ROUND_UP(4, ndl);
@@ -4596,14 +4601,14 @@ static bool dsi_vm_calc_blanking(struct dsi_clk_calc_ctx *ctx)
 
        if (cfg->trans_mode != OMAP_DSS_DSI_PULSE_MODE) {
                hsa = 0;
-       } else if (ndl == 3 && req_vm->hsw == 0) {
+       } else if (ndl == 3 && req_vm->hsync_len == 0) {
                hsa = 0;
        } else {
-               hsa = div64_u64((u64)req_vm->hsw * byteclk, req_pck_nom);
+               hsa = div64_u64((u64)req_vm->hsync_len * byteclk, req_pck_nom);
                hsa = max(hsa - hse, 1);
        }
 
-       hbp = div64_u64((u64)req_vm->hbp * byteclk, req_pck_nom);
+       hbp = div64_u64((u64)req_vm->hback_porch * byteclk, req_pck_nom);
        hbp = max(hbp, 1);
 
        hfp = dsi_hbl - (hss + hsa + hse + hbp);
@@ -4633,10 +4638,10 @@ static bool dsi_vm_calc_blanking(struct dsi_clk_calc_ctx *ctx)
        dsi_vm->hact = xres;
        dsi_vm->hfp = hfp;
 
-       dsi_vm->vsa = req_vm->vsw;
-       dsi_vm->vbp = req_vm->vbp;
-       dsi_vm->vact = req_vm->y_res;
-       dsi_vm->vfp = req_vm->vfp;
+       dsi_vm->vsa = req_vm->vsync_len;
+       dsi_vm->vbp = req_vm->vback_porch;
+       dsi_vm->vact = req_vm->vactive;
+       dsi_vm->vfp = req_vm->vfront_porch;
 
        dsi_vm->trans_mode = cfg->trans_mode;
 
@@ -4655,14 +4660,14 @@ static bool dsi_vm_calc_blanking(struct dsi_clk_calc_ctx *ctx)
        dispc_vm->pixelclock = dispc_pck;
 
        if (cfg->trans_mode == OMAP_DSS_DSI_PULSE_MODE) {
-               hsa = div64_u64((u64)req_vm->hsw * dispc_pck,
+               hsa = div64_u64((u64)req_vm->hsync_len * dispc_pck,
                                req_pck_nom);
                hsa = max(hsa, 1);
        } else {
                hsa = 1;
        }
 
-       hbp = div64_u64((u64)req_vm->hbp * dispc_pck, req_pck_nom);
+       hbp = div64_u64((u64)req_vm->hback_porch * dispc_pck, req_pck_nom);
        hbp = max(hbp, 1);
 
        hfp = dispc_hbl - hsa - hbp;
@@ -4685,9 +4690,9 @@ static bool dsi_vm_calc_blanking(struct dsi_clk_calc_ctx *ctx)
        if (hfp < 1)
                return false;
 
-       dispc_vm->hfp = hfp;
-       dispc_vm->hsw = hsa;
-       dispc_vm->hbp = hbp;
+       dispc_vm->hfront_porch = hfp;
+       dispc_vm->hsync_len = hsa;
+       dispc_vm->hback_porch = hbp;
 
        return true;
 }
@@ -5342,7 +5347,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
 
        dsi->phy_base = devm_ioremap(&dsidev->dev, res->start,
                resource_size(res));
-       if (!dsi->proto_base) {
+       if (!dsi->phy_base) {
                DSSERR("can't ioremap DSI PHY\n");
                return -ENOMEM;
        }
@@ -5362,7 +5367,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
 
        dsi->pll_base = devm_ioremap(&dsidev->dev, res->start,
                resource_size(res));
-       if (!dsi->proto_base) {
+       if (!dsi->pll_base) {
                DSSERR("can't ioremap DSI PLL\n");
                return -ENOMEM;
        }