Lines Matching full:backend
35 /* backend <-> TCON muxing selection done in backend */
83 void sun4i_backend_layer_enable(struct sun4i_backend *backend, in sun4i_backend_layer_enable() argument
96 regmap_update_bits(backend->engine.regs, SUN4I_BACKEND_MODCTL_REG, in sun4i_backend_layer_enable()
171 int sun4i_backend_update_layer_coord(struct sun4i_backend *backend, in sun4i_backend_update_layer_coord() argument
181 regmap_write(backend->engine.regs, SUN4I_BACKEND_LAYSIZE_REG(layer), in sun4i_backend_update_layer_coord()
188 regmap_write(backend->engine.regs, SUN4I_BACKEND_LAYCOOR_REG(layer), in sun4i_backend_update_layer_coord()
195 static int sun4i_backend_update_yuv_format(struct sun4i_backend *backend, in sun4i_backend_update_yuv_format() argument
206 regmap_write(backend->engine.regs, in sun4i_backend_update_yuv_format()
214 regmap_update_bits(backend->engine.regs, SUN4I_BACKEND_ATTCTL_REG0(layer), in sun4i_backend_update_yuv_format()
247 regmap_write(backend->engine.regs, SUN4I_BACKEND_IYUVCTL_REG, val); in sun4i_backend_update_yuv_format()
252 int sun4i_backend_update_layer_formats(struct sun4i_backend *backend, in sun4i_backend_update_layer_formats() argument
261 regmap_update_bits(backend->engine.regs, SUN4I_BACKEND_ATTCTL_REG0(layer), in sun4i_backend_update_layer_formats()
267 regmap_update_bits(backend->engine.regs, in sun4i_backend_update_layer_formats()
274 return sun4i_backend_update_yuv_format(backend, layer, plane); in sun4i_backend_update_layer_formats()
282 regmap_update_bits(backend->engine.regs, in sun4i_backend_update_layer_formats()
289 int sun4i_backend_update_layer_frontend(struct sun4i_backend *backend, in sun4i_backend_update_layer_frontend() argument
301 regmap_update_bits(backend->engine.regs, in sun4i_backend_update_layer_frontend()
306 regmap_update_bits(backend->engine.regs, in sun4i_backend_update_layer_frontend()
313 static int sun4i_backend_update_yuv_buffer(struct sun4i_backend *backend, in sun4i_backend_update_yuv_buffer() argument
319 regmap_write(backend->engine.regs, SUN4I_BACKEND_IYUVADD_REG(0), paddr); in sun4i_backend_update_yuv_buffer()
322 regmap_write(backend->engine.regs, SUN4I_BACKEND_IYUVLINEWIDTH_REG(0), in sun4i_backend_update_yuv_buffer()
328 int sun4i_backend_update_layer_buffer(struct sun4i_backend *backend, in sun4i_backend_update_layer_buffer() argument
338 regmap_write(backend->engine.regs, in sun4i_backend_update_layer_buffer()
347 return sun4i_backend_update_yuv_buffer(backend, fb, dma_addr); in sun4i_backend_update_layer_buffer()
352 regmap_write(backend->engine.regs, in sun4i_backend_update_layer_buffer()
359 regmap_update_bits(backend->engine.regs, SUN4I_BACKEND_LAYFB_H4ADD_REG, in sun4i_backend_update_layer_buffer()
366 int sun4i_backend_update_layer_zpos(struct sun4i_backend *backend, int layer, in sun4i_backend_update_layer_zpos() argument
376 regmap_update_bits(backend->engine.regs, SUN4I_BACKEND_ATTCTL_REG0(layer), in sun4i_backend_update_layer_zpos()
385 void sun4i_backend_cleanup_layer(struct sun4i_backend *backend, in sun4i_backend_cleanup_layer() argument
388 regmap_update_bits(backend->engine.regs, in sun4i_backend_cleanup_layer()
411 struct sun4i_backend *backend = layer->backend; in sun4i_backend_plane_uses_frontend() local
415 if (IS_ERR(backend->frontend)) in sun4i_backend_plane_uses_frontend()
425 * TODO: The backend alone allows 2x and 4x integer scaling, including in sun4i_backend_plane_uses_frontend()
427 * Use the backend directly instead of the frontend in this case, with in sun4i_backend_plane_uses_frontend()
435 * Here the format is supported by both the frontend and the backend in sun4i_backend_plane_uses_frontend()
436 * and no frontend scaling is required, so use the backend directly. in sun4i_backend_plane_uses_frontend()
473 struct sun4i_backend *backend = engine_to_sun4i_backend(engine); in sun4i_backend_atomic_check() local
564 if (backend->quirks->supports_lowest_plane_alpha) in sun4i_backend_atomic_check()
573 if (!backend->quirks->supports_lowest_plane_alpha && in sun4i_backend_atomic_check()
612 struct sun4i_backend *backend = engine_to_sun4i_backend(engine); in sun4i_backend_vblank_quirk() local
613 struct sun4i_frontend *frontend = backend->frontend; in sun4i_backend_vblank_quirk()
623 * This is due to the fact that the backend will not take into in sun4i_backend_vblank_quirk()
632 spin_lock(&backend->frontend_lock); in sun4i_backend_vblank_quirk()
633 if (backend->frontend_teardown) { in sun4i_backend_vblank_quirk()
635 backend->frontend_teardown = false; in sun4i_backend_vblank_quirk()
637 spin_unlock(&backend->frontend_lock); in sun4i_backend_vblank_quirk()
655 DRM_DEBUG_DRIVER("Switching display backend interlaced mode %s\n", in sun4i_backend_mode_set()
660 struct sun4i_backend *backend = dev_get_drvdata(dev); in sun4i_backend_init_sat() local
663 backend->sat_reset = devm_reset_control_get(dev, "sat"); in sun4i_backend_init_sat()
664 if (IS_ERR(backend->sat_reset)) { in sun4i_backend_init_sat()
666 return PTR_ERR(backend->sat_reset); in sun4i_backend_init_sat()
669 ret = reset_control_deassert(backend->sat_reset); in sun4i_backend_init_sat()
675 backend->sat_clk = devm_clk_get(dev, "sat"); in sun4i_backend_init_sat()
676 if (IS_ERR(backend->sat_clk)) { in sun4i_backend_init_sat()
678 ret = PTR_ERR(backend->sat_clk); in sun4i_backend_init_sat()
682 ret = clk_prepare_enable(backend->sat_clk); in sun4i_backend_init_sat()
691 reset_control_assert(backend->sat_reset); in sun4i_backend_init_sat()
696 struct sun4i_backend *backend = dev_get_drvdata(dev); in sun4i_backend_free_sat() local
698 clk_disable_unprepare(backend->sat_clk); in sun4i_backend_free_sat()
699 reset_control_assert(backend->sat_reset); in sun4i_backend_free_sat()
705 * The display backend can take video output from the display frontend, or
708 * tree with of_graph, and we use it here to figure out which backend, if
786 struct sun4i_backend *backend; in sun4i_backend_bind() local
791 backend = devm_kzalloc(dev, sizeof(*backend), GFP_KERNEL); in sun4i_backend_bind()
792 if (!backend) in sun4i_backend_bind()
794 dev_set_drvdata(dev, backend); in sun4i_backend_bind()
795 spin_lock_init(&backend->frontend_lock); in sun4i_backend_bind()
810 backend->engine.node = dev->of_node; in sun4i_backend_bind()
811 backend->engine.ops = &sun4i_backend_engine_ops; in sun4i_backend_bind()
812 backend->engine.id = sun4i_backend_of_get_id(dev->of_node); in sun4i_backend_bind()
813 if (backend->engine.id < 0) in sun4i_backend_bind()
814 return backend->engine.id; in sun4i_backend_bind()
816 backend->frontend = sun4i_backend_find_frontend(drv, dev->of_node); in sun4i_backend_bind()
817 if (IS_ERR(backend->frontend)) in sun4i_backend_bind()
824 backend->reset = devm_reset_control_get(dev, NULL); in sun4i_backend_bind()
825 if (IS_ERR(backend->reset)) { in sun4i_backend_bind()
827 return PTR_ERR(backend->reset); in sun4i_backend_bind()
830 ret = reset_control_deassert(backend->reset); in sun4i_backend_bind()
836 backend->bus_clk = devm_clk_get(dev, "ahb"); in sun4i_backend_bind()
837 if (IS_ERR(backend->bus_clk)) { in sun4i_backend_bind()
838 dev_err(dev, "Couldn't get the backend bus clock\n"); in sun4i_backend_bind()
839 ret = PTR_ERR(backend->bus_clk); in sun4i_backend_bind()
842 clk_prepare_enable(backend->bus_clk); in sun4i_backend_bind()
844 backend->mod_clk = devm_clk_get(dev, "mod"); in sun4i_backend_bind()
845 if (IS_ERR(backend->mod_clk)) { in sun4i_backend_bind()
846 dev_err(dev, "Couldn't get the backend module clock\n"); in sun4i_backend_bind()
847 ret = PTR_ERR(backend->mod_clk); in sun4i_backend_bind()
851 ret = clk_set_rate_exclusive(backend->mod_clk, 300000000); in sun4i_backend_bind()
857 clk_prepare_enable(backend->mod_clk); in sun4i_backend_bind()
859 backend->ram_clk = devm_clk_get(dev, "ram"); in sun4i_backend_bind()
860 if (IS_ERR(backend->ram_clk)) { in sun4i_backend_bind()
861 dev_err(dev, "Couldn't get the backend RAM clock\n"); in sun4i_backend_bind()
862 ret = PTR_ERR(backend->ram_clk); in sun4i_backend_bind()
865 clk_prepare_enable(backend->ram_clk); in sun4i_backend_bind()
868 "allwinner,sun8i-a33-display-backend")) { in sun4i_backend_bind()
876 backend->engine.regs = devm_regmap_init_mmio(dev, regs, in sun4i_backend_bind()
878 if (IS_ERR(backend->engine.regs)) { in sun4i_backend_bind()
879 dev_err(dev, "Couldn't create the backend regmap\n"); in sun4i_backend_bind()
880 return PTR_ERR(backend->engine.regs); in sun4i_backend_bind()
883 list_add_tail(&backend->engine.list, &drv->engine_list); in sun4i_backend_bind()
886 * Many of the backend's layer configuration registers have in sun4i_backend_bind()
894 regmap_write(backend->engine.regs, i, 0); in sun4i_backend_bind()
897 regmap_write(backend->engine.regs, SUN4I_BACKEND_REGBUFFCTL_REG, in sun4i_backend_bind()
900 /* Enable the backend */ in sun4i_backend_bind()
901 regmap_write(backend->engine.regs, SUN4I_BACKEND_MODCTL_REG, in sun4i_backend_bind()
910 * and TCONs, so we select the backend with same ID. in sun4i_backend_bind()
918 regmap_update_bits(backend->engine.regs, in sun4i_backend_bind()
921 (backend->engine.id in sun4i_backend_bind()
926 backend->quirks = quirks; in sun4i_backend_bind()
931 clk_disable_unprepare(backend->ram_clk); in sun4i_backend_bind()
933 clk_rate_exclusive_put(backend->mod_clk); in sun4i_backend_bind()
934 clk_disable_unprepare(backend->mod_clk); in sun4i_backend_bind()
936 clk_disable_unprepare(backend->bus_clk); in sun4i_backend_bind()
938 reset_control_assert(backend->reset); in sun4i_backend_bind()
945 struct sun4i_backend *backend = dev_get_drvdata(dev); in sun4i_backend_unbind() local
947 list_del(&backend->engine.list); in sun4i_backend_unbind()
950 "allwinner,sun8i-a33-display-backend")) in sun4i_backend_unbind()
953 clk_disable_unprepare(backend->ram_clk); in sun4i_backend_unbind()
954 clk_rate_exclusive_put(backend->mod_clk); in sun4i_backend_unbind()
955 clk_disable_unprepare(backend->mod_clk); in sun4i_backend_unbind()
956 clk_disable_unprepare(backend->bus_clk); in sun4i_backend_unbind()
957 reset_control_assert(backend->reset); in sun4i_backend_unbind()
998 .compatible = "allwinner,sun4i-a10-display-backend",
1002 .compatible = "allwinner,sun5i-a13-display-backend",
1006 .compatible = "allwinner,sun6i-a31-display-backend",
1010 .compatible = "allwinner,sun7i-a20-display-backend",
1014 .compatible = "allwinner,sun8i-a23-display-backend",
1018 .compatible = "allwinner,sun8i-a33-display-backend",
1022 .compatible = "allwinner,sun9i-a80-display-backend",
1033 .name = "sun4i-backend",
1040 MODULE_DESCRIPTION("Allwinner A10 Display Backend Driver");