Lines Matching refs:ldev
56 #define REG_OFS (ldev->caps.reg_ofs)
370 struct ltdc_device *ldev = ddev->dev_private; in ltdc_irq_thread() local
374 if (ldev->irq_status & ISR_LIF) in ltdc_irq_thread()
378 mutex_lock(&ldev->err_lock); in ltdc_irq_thread()
379 if (ldev->irq_status & ISR_FUIF) in ltdc_irq_thread()
380 ldev->error_status |= ISR_FUIF; in ltdc_irq_thread()
381 if (ldev->irq_status & ISR_TERRIF) in ltdc_irq_thread()
382 ldev->error_status |= ISR_TERRIF; in ltdc_irq_thread()
383 mutex_unlock(&ldev->err_lock); in ltdc_irq_thread()
391 struct ltdc_device *ldev = ddev->dev_private; in ltdc_irq() local
394 ldev->irq_status = reg_read(ldev->regs, LTDC_ISR); in ltdc_irq()
395 reg_write(ldev->regs, LTDC_ICR, ldev->irq_status); in ltdc_irq()
406 struct ltdc_device *ldev = crtc_to_ltdc(crtc); in ltdc_crtc_update_clut() local
419 reg_write(ldev->regs, LTDC_L1CLUTWR, val); in ltdc_crtc_update_clut()
426 struct ltdc_device *ldev = crtc_to_ltdc(crtc); in ltdc_crtc_atomic_enable() local
431 reg_write(ldev->regs, LTDC_BCCR, BCCR_BCBLACK); in ltdc_crtc_atomic_enable()
434 reg_set(ldev->regs, LTDC_IER, IER_RRIE | IER_FUIE | IER_TERRIE); in ltdc_crtc_atomic_enable()
437 reg_set(ldev->regs, LTDC_SRCR, SRCR_VBR); in ltdc_crtc_atomic_enable()
440 reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN); in ltdc_crtc_atomic_enable()
448 struct ltdc_device *ldev = crtc_to_ltdc(crtc); in ltdc_crtc_atomic_disable() local
456 reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN); in ltdc_crtc_atomic_disable()
459 reg_clear(ldev->regs, LTDC_IER, IER_RRIE | IER_FUIE | IER_TERRIE); in ltdc_crtc_atomic_disable()
462 reg_set(ldev->regs, LTDC_SRCR, SRCR_IMR); in ltdc_crtc_atomic_disable()
473 struct ltdc_device *ldev = crtc_to_ltdc(crtc); in ltdc_crtc_mode_valid() local
479 result = clk_round_rate(ldev->pixel_clk, target); in ltdc_crtc_mode_valid()
484 if (result > ldev->caps.pad_max_freq_hz) in ltdc_crtc_mode_valid()
512 struct ltdc_device *ldev = crtc_to_ltdc(crtc); in ltdc_crtc_mode_fixup() local
523 if (clk_set_rate(ldev->pixel_clk, rate) < 0) { in ltdc_crtc_mode_fixup()
528 adjusted_mode->clock = clk_get_rate(ldev->pixel_clk) / 1000; in ltdc_crtc_mode_fixup()
546 struct ltdc_device *ldev = crtc_to_ltdc(crtc); in ltdc_crtc_mode_set_nofb() local
596 reg_update_bits(ldev->regs, LTDC_GCR, in ltdc_crtc_mode_set_nofb()
601 reg_update_bits(ldev->regs, LTDC_SSCR, SSCR_VSH | SSCR_HSW, val); in ltdc_crtc_mode_set_nofb()
605 reg_update_bits(ldev->regs, LTDC_BPCR, BPCR_AVBP | BPCR_AHBP, val); in ltdc_crtc_mode_set_nofb()
609 reg_update_bits(ldev->regs, LTDC_AWCR, AWCR_AAW | AWCR_AAH, val); in ltdc_crtc_mode_set_nofb()
613 reg_update_bits(ldev->regs, LTDC_TWCR, TWCR_TOTALH | TWCR_TOTALW, val); in ltdc_crtc_mode_set_nofb()
615 reg_write(ldev->regs, LTDC_LIPCR, (accum_act_h + 1)); in ltdc_crtc_mode_set_nofb()
621 struct ltdc_device *ldev = crtc_to_ltdc(crtc); in ltdc_crtc_atomic_flush() local
630 reg_set(ldev->regs, LTDC_SRCR, SRCR_VBR); in ltdc_crtc_atomic_flush()
655 struct ltdc_device *ldev = crtc_to_ltdc(crtc); in ltdc_crtc_enable_vblank() local
658 reg_set(ldev->regs, LTDC_IER, IER_LIE); in ltdc_crtc_enable_vblank()
665 struct ltdc_device *ldev = crtc_to_ltdc(crtc); in ltdc_crtc_disable_vblank() local
668 reg_clear(ldev->regs, LTDC_IER, IER_LIE); in ltdc_crtc_disable_vblank()
676 struct ltdc_device *ldev = ddev->dev_private; in ltdc_crtc_scanoutpos() local
697 line = reg_read(ldev->regs, LTDC_CPSR) & CPSR_CYPOS; in ltdc_crtc_scanoutpos()
698 vactive_start = reg_read(ldev->regs, LTDC_BPCR) & BPCR_AVBP; in ltdc_crtc_scanoutpos()
699 vactive_end = reg_read(ldev->regs, LTDC_AWCR) & AWCR_AAH; in ltdc_crtc_scanoutpos()
700 vtotal = reg_read(ldev->regs, LTDC_TWCR) & TWCR_TOTALH; in ltdc_crtc_scanoutpos()
761 struct ltdc_device *ldev = plane_to_ltdc(plane); in ltdc_plane_atomic_update() local
790 bpcr = reg_read(ldev->regs, LTDC_BPCR); in ltdc_plane_atomic_update()
796 reg_update_bits(ldev->regs, LTDC_L1WHPCR + lofs, in ltdc_plane_atomic_update()
801 reg_update_bits(ldev->regs, LTDC_L1WVPCR + lofs, in ltdc_plane_atomic_update()
807 if (ldev->caps.pix_fmt_hw[val] == pf) in ltdc_plane_atomic_update()
815 reg_update_bits(ldev->regs, LTDC_L1PFCR + lofs, LXPFCR_PF, val); in ltdc_plane_atomic_update()
820 (x1 - x0 + 1) + (ldev->caps.bus_width >> 3) - 1; in ltdc_plane_atomic_update()
822 reg_update_bits(ldev->regs, LTDC_L1CFBLR + lofs, in ltdc_plane_atomic_update()
827 reg_update_bits(ldev->regs, LTDC_L1CACR + lofs, LXCACR_CONSTA, val); in ltdc_plane_atomic_update()
835 if (ldev->caps.non_alpha_only_l1 && in ltdc_plane_atomic_update()
839 reg_update_bits(ldev->regs, LTDC_L1BFCR + lofs, in ltdc_plane_atomic_update()
844 reg_update_bits(ldev->regs, LTDC_L1CFBLNR + lofs, LXCFBLNR_CFBLN, val); in ltdc_plane_atomic_update()
850 reg_write(ldev->regs, LTDC_L1CFBAR + lofs, paddr); in ltdc_plane_atomic_update()
855 reg_update_bits(ldev->regs, LTDC_L1CR + lofs, in ltdc_plane_atomic_update()
858 ldev->plane_fpsi[plane->index].counter++; in ltdc_plane_atomic_update()
860 mutex_lock(&ldev->err_lock); in ltdc_plane_atomic_update()
861 if (ldev->error_status & ISR_FUIF) { in ltdc_plane_atomic_update()
863 ldev->error_status &= ~ISR_FUIF; in ltdc_plane_atomic_update()
865 if (ldev->error_status & ISR_TERRIF) { in ltdc_plane_atomic_update()
867 ldev->error_status &= ~ISR_TERRIF; in ltdc_plane_atomic_update()
869 mutex_unlock(&ldev->err_lock); in ltdc_plane_atomic_update()
875 struct ltdc_device *ldev = plane_to_ltdc(plane); in ltdc_plane_atomic_disable() local
879 reg_clear(ldev->regs, LTDC_L1CR + lofs, LXCR_LEN); in ltdc_plane_atomic_disable()
889 struct ltdc_device *ldev = plane_to_ltdc(plane); in ltdc_plane_atomic_print_state() local
890 struct fps_info *fpsi = &ldev->plane_fpsi[plane->index]; in ltdc_plane_atomic_print_state()
936 struct ltdc_device *ldev = ddev->dev_private; in ltdc_plane_create() local
947 drm_fmt = to_drm_pixelformat(ldev->caps.pix_fmt_hw[i]); in ltdc_plane_create()
958 if (ldev->caps.non_alpha_only_l1 && in ltdc_plane_create()
993 struct ltdc_device *ldev = ddev->dev_private; in ltdc_crtc_init() local
1019 for (i = 1; i < ldev->caps.nb_layers; i++) { in ltdc_crtc_init()
1071 struct ltdc_device *ldev = ddev->dev_private; in ltdc_get_caps() local
1078 lcr = reg_read(ldev->regs, LTDC_LCR); in ltdc_get_caps()
1080 ldev->caps.nb_layers = clamp((int)lcr, 1, LTDC_MAX_LAYER); in ltdc_get_caps()
1083 gc2r = reg_read(ldev->regs, LTDC_GC2R); in ltdc_get_caps()
1085 ldev->caps.bus_width = 8 << bus_width_log2; in ltdc_get_caps()
1086 ldev->caps.hw_version = reg_read(ldev->regs, LTDC_IDR); in ltdc_get_caps()
1088 switch (ldev->caps.hw_version) { in ltdc_get_caps()
1091 ldev->caps.reg_ofs = REG_OFS_NONE; in ltdc_get_caps()
1092 ldev->caps.pix_fmt_hw = ltdc_pix_fmt_a0; in ltdc_get_caps()
1100 ldev->caps.non_alpha_only_l1 = true; in ltdc_get_caps()
1101 ldev->caps.pad_max_freq_hz = 90000000; in ltdc_get_caps()
1102 if (ldev->caps.hw_version == HWVER_10200) in ltdc_get_caps()
1103 ldev->caps.pad_max_freq_hz = 65000000; in ltdc_get_caps()
1106 ldev->caps.reg_ofs = REG_OFS_4; in ltdc_get_caps()
1107 ldev->caps.pix_fmt_hw = ltdc_pix_fmt_a1; in ltdc_get_caps()
1108 ldev->caps.non_alpha_only_l1 = false; in ltdc_get_caps()
1109 ldev->caps.pad_max_freq_hz = 150000000; in ltdc_get_caps()
1120 struct ltdc_device *ldev = ddev->dev_private; in ltdc_suspend() local
1123 clk_disable_unprepare(ldev->pixel_clk); in ltdc_suspend()
1128 struct ltdc_device *ldev = ddev->dev_private; in ltdc_resume() local
1133 ret = clk_prepare_enable(ldev->pixel_clk); in ltdc_resume()
1145 struct ltdc_device *ldev = ddev->dev_private; in ltdc_load() local
1177 mutex_init(&ldev->err_lock); in ltdc_load()
1179 ldev->pixel_clk = devm_clk_get(dev, "lcd"); in ltdc_load()
1180 if (IS_ERR(ldev->pixel_clk)) { in ltdc_load()
1181 if (PTR_ERR(ldev->pixel_clk) != -EPROBE_DEFER) in ltdc_load()
1183 return PTR_ERR(ldev->pixel_clk); in ltdc_load()
1186 if (clk_prepare_enable(ldev->pixel_clk)) { in ltdc_load()
1198 ldev->regs = devm_ioremap_resource(dev, res); in ltdc_load()
1199 if (IS_ERR(ldev->regs)) { in ltdc_load()
1201 ret = PTR_ERR(ldev->regs); in ltdc_load()
1206 reg_clear(ldev->regs, LTDC_IER, in ltdc_load()
1230 ldev->caps.hw_version); in ltdc_load()
1234 DRM_DEBUG_DRIVER("ltdc hw version 0x%08x\n", ldev->caps.hw_version); in ltdc_load()
1281 clk_disable_unprepare(ldev->pixel_clk); in ltdc_load()
1290 clk_disable_unprepare(ldev->pixel_clk); in ltdc_load()