Lines Matching +full:mixer +full:- +full:tcon

1 // SPDX-License-Identifier: GPL-2.0-or-later
11 #include <linux/dma-mapping.h>
248 return -EINVAL; in sun8i_mixer_drm_format_to_hw()
255 regmap_write(engine->regs, SUN8I_MIXER_GLOBAL_DBUFF, in sun8i_mixer_commit()
263 struct sun8i_mixer *mixer = engine_to_sun8i_mixer(engine); in sun8i_layers_init() local
266 planes = devm_kcalloc(drm->dev, in sun8i_layers_init()
267 mixer->cfg->vi_num + mixer->cfg->ui_num + 1, in sun8i_layers_init()
270 return ERR_PTR(-ENOMEM); in sun8i_layers_init()
272 for (i = 0; i < mixer->cfg->vi_num; i++) { in sun8i_layers_init()
275 layer = sun8i_vi_layer_init_one(drm, mixer, i); in sun8i_layers_init()
277 dev_err(drm->dev, in sun8i_layers_init()
282 planes[i] = &layer->plane; in sun8i_layers_init()
285 for (i = 0; i < mixer->cfg->ui_num; i++) { in sun8i_layers_init()
288 layer = sun8i_ui_layer_init_one(drm, mixer, i); in sun8i_layers_init()
290 dev_err(drm->dev, "Couldn't initialize %s plane\n", in sun8i_layers_init()
295 planes[mixer->cfg->vi_num + i] = &layer->plane; in sun8i_layers_init()
319 ep = of_graph_get_endpoint_by_regs(node, 1, -1); in sun8i_mixer_of_get_id()
321 return -EINVAL; in sun8i_mixer_of_get_id()
326 return -EINVAL; in sun8i_mixer_of_get_id()
338 struct sun4i_drv *drv = drm->dev_private; in sun8i_mixer_bind()
339 struct sun8i_mixer *mixer; in sun8i_mixer_bind() local
347 * The mixer uses single 32-bit register to store memory in sun8i_mixer_bind()
348 * addresses, so that it cannot deal with 64-bit memory in sun8i_mixer_bind()
350 * Restrict the DMA mask so that the mixer won't be in sun8i_mixer_bind()
355 dev_err(dev, "Cannot do 32-bit DMA.\n"); in sun8i_mixer_bind()
359 mixer = devm_kzalloc(dev, sizeof(*mixer), GFP_KERNEL); in sun8i_mixer_bind()
360 if (!mixer) in sun8i_mixer_bind()
361 return -ENOMEM; in sun8i_mixer_bind()
362 dev_set_drvdata(dev, mixer); in sun8i_mixer_bind()
363 mixer->engine.ops = &sun8i_engine_ops; in sun8i_mixer_bind()
364 mixer->engine.node = dev->of_node; in sun8i_mixer_bind()
366 if (of_find_property(dev->of_node, "iommus", NULL)) { in sun8i_mixer_bind()
371 * DRM doesn't do per-device allocation either, so we in sun8i_mixer_bind()
374 ret = of_dma_configure(drm->dev, dev->of_node, true); in sun8i_mixer_bind()
382 * mixer id but work nevertheless because matching between in sun8i_mixer_bind()
383 * TCON and mixer is done by comparing node pointers (old in sun8i_mixer_bind()
387 mixer->engine.id = sun8i_mixer_of_get_id(dev->of_node); in sun8i_mixer_bind()
389 mixer->cfg = of_device_get_match_data(dev); in sun8i_mixer_bind()
390 if (!mixer->cfg) in sun8i_mixer_bind()
391 return -EINVAL; in sun8i_mixer_bind()
398 mixer->engine.regs = devm_regmap_init_mmio(dev, regs, in sun8i_mixer_bind()
400 if (IS_ERR(mixer->engine.regs)) { in sun8i_mixer_bind()
401 dev_err(dev, "Couldn't create the mixer regmap\n"); in sun8i_mixer_bind()
402 return PTR_ERR(mixer->engine.regs); in sun8i_mixer_bind()
405 mixer->reset = devm_reset_control_get(dev, NULL); in sun8i_mixer_bind()
406 if (IS_ERR(mixer->reset)) { in sun8i_mixer_bind()
408 return PTR_ERR(mixer->reset); in sun8i_mixer_bind()
411 ret = reset_control_deassert(mixer->reset); in sun8i_mixer_bind()
417 mixer->bus_clk = devm_clk_get(dev, "bus"); in sun8i_mixer_bind()
418 if (IS_ERR(mixer->bus_clk)) { in sun8i_mixer_bind()
419 dev_err(dev, "Couldn't get the mixer bus clock\n"); in sun8i_mixer_bind()
420 ret = PTR_ERR(mixer->bus_clk); in sun8i_mixer_bind()
423 clk_prepare_enable(mixer->bus_clk); in sun8i_mixer_bind()
425 mixer->mod_clk = devm_clk_get(dev, "mod"); in sun8i_mixer_bind()
426 if (IS_ERR(mixer->mod_clk)) { in sun8i_mixer_bind()
427 dev_err(dev, "Couldn't get the mixer module clock\n"); in sun8i_mixer_bind()
428 ret = PTR_ERR(mixer->mod_clk); in sun8i_mixer_bind()
434 * reason for the mixer to be functional. Make sure it's the in sun8i_mixer_bind()
437 if (mixer->cfg->mod_rate) in sun8i_mixer_bind()
438 clk_set_rate(mixer->mod_clk, mixer->cfg->mod_rate); in sun8i_mixer_bind()
440 clk_prepare_enable(mixer->mod_clk); in sun8i_mixer_bind()
442 list_add_tail(&mixer->engine.list, &drv->engine_list); in sun8i_mixer_bind()
444 base = sun8i_blender_base(mixer); in sun8i_mixer_bind()
446 /* Reset registers and disable unused sub-engines */ in sun8i_mixer_bind()
447 if (mixer->cfg->is_de3) { in sun8i_mixer_bind()
449 regmap_write(mixer->engine.regs, i, 0); in sun8i_mixer_bind()
451 regmap_write(mixer->engine.regs, SUN50I_MIXER_FCE_EN, 0); in sun8i_mixer_bind()
452 regmap_write(mixer->engine.regs, SUN50I_MIXER_PEAK_EN, 0); in sun8i_mixer_bind()
453 regmap_write(mixer->engine.regs, SUN50I_MIXER_LCTI_EN, 0); in sun8i_mixer_bind()
454 regmap_write(mixer->engine.regs, SUN50I_MIXER_BLS_EN, 0); in sun8i_mixer_bind()
455 regmap_write(mixer->engine.regs, SUN50I_MIXER_FCC_EN, 0); in sun8i_mixer_bind()
456 regmap_write(mixer->engine.regs, SUN50I_MIXER_DNS_EN, 0); in sun8i_mixer_bind()
457 regmap_write(mixer->engine.regs, SUN50I_MIXER_DRC_EN, 0); in sun8i_mixer_bind()
458 regmap_write(mixer->engine.regs, SUN50I_MIXER_FMT_EN, 0); in sun8i_mixer_bind()
459 regmap_write(mixer->engine.regs, SUN50I_MIXER_CDC0_EN, 0); in sun8i_mixer_bind()
460 regmap_write(mixer->engine.regs, SUN50I_MIXER_CDC1_EN, 0); in sun8i_mixer_bind()
463 regmap_write(mixer->engine.regs, i, 0); in sun8i_mixer_bind()
465 regmap_write(mixer->engine.regs, SUN8I_MIXER_FCE_EN, 0); in sun8i_mixer_bind()
466 regmap_write(mixer->engine.regs, SUN8I_MIXER_BWS_EN, 0); in sun8i_mixer_bind()
467 regmap_write(mixer->engine.regs, SUN8I_MIXER_LTI_EN, 0); in sun8i_mixer_bind()
468 regmap_write(mixer->engine.regs, SUN8I_MIXER_PEAK_EN, 0); in sun8i_mixer_bind()
469 regmap_write(mixer->engine.regs, SUN8I_MIXER_ASE_EN, 0); in sun8i_mixer_bind()
470 regmap_write(mixer->engine.regs, SUN8I_MIXER_FCC_EN, 0); in sun8i_mixer_bind()
471 regmap_write(mixer->engine.regs, SUN8I_MIXER_DCSC_EN, 0); in sun8i_mixer_bind()
474 /* Enable the mixer */ in sun8i_mixer_bind()
475 regmap_write(mixer->engine.regs, SUN8I_MIXER_GLOBAL_CTL, in sun8i_mixer_bind()
479 regmap_write(mixer->engine.regs, SUN8I_MIXER_BLEND_BKCOLOR(base), in sun8i_mixer_bind()
486 regmap_write(mixer->engine.regs, SUN8I_MIXER_BLEND_PIPE_CTL(base), in sun8i_mixer_bind()
488 regmap_write(mixer->engine.regs, SUN8I_MIXER_BLEND_ATTR_FCOLOR(base, 0), in sun8i_mixer_bind()
491 plane_cnt = mixer->cfg->vi_num + mixer->cfg->ui_num; in sun8i_mixer_bind()
493 regmap_write(mixer->engine.regs, in sun8i_mixer_bind()
497 regmap_update_bits(mixer->engine.regs, SUN8I_MIXER_BLEND_PIPE_CTL(base), in sun8i_mixer_bind()
503 clk_disable_unprepare(mixer->bus_clk); in sun8i_mixer_bind()
505 reset_control_assert(mixer->reset); in sun8i_mixer_bind()
512 struct sun8i_mixer *mixer = dev_get_drvdata(dev); in sun8i_mixer_unbind() local
514 list_del(&mixer->engine.list); in sun8i_mixer_unbind()
516 clk_disable_unprepare(mixer->mod_clk); in sun8i_mixer_unbind()
517 clk_disable_unprepare(mixer->bus_clk); in sun8i_mixer_unbind()
518 reset_control_assert(mixer->reset); in sun8i_mixer_unbind()
528 return component_add(&pdev->dev, &sun8i_mixer_ops); in sun8i_mixer_probe()
533 component_del(&pdev->dev, &sun8i_mixer_ops); in sun8i_mixer_remove()
620 .compatible = "allwinner,sun8i-a83t-de2-mixer-0",
624 .compatible = "allwinner,sun8i-a83t-de2-mixer-1",
628 .compatible = "allwinner,sun8i-h3-de2-mixer-0",
632 .compatible = "allwinner,sun8i-r40-de2-mixer-0",
636 .compatible = "allwinner,sun8i-r40-de2-mixer-1",
640 .compatible = "allwinner,sun8i-v3s-de2-mixer",
644 .compatible = "allwinner,sun50i-a64-de2-mixer-0",
648 .compatible = "allwinner,sun50i-a64-de2-mixer-1",
652 .compatible = "allwinner,sun50i-h6-de3-mixer-0",
663 .name = "sun8i-mixer",
670 MODULE_DESCRIPTION("Allwinner DE2 Mixer driver");