Lines Matching +full:meson +full:- +full:gxbb +full:- +full:vpu

1 // SPDX-License-Identifier: GPL-2.0-or-later
16 #include <linux/soc/amlogic/meson-canvas.h>
41 #define DRIVER_NAME "meson"
42 #define DRIVER_DESC "Amlogic Meson DRM driver"
47 * VPU Handles the Global Video Processing, it includes management of the
52 * - Full reset of entire video processing HW blocks
53 * - Scaling and setup of the VPU clock
54 * - Bus clock gates
55 * - Powering up video processing HW blocks
56 * - Powering Up HDMI controller and PHY
72 struct meson_drm *priv = dev->dev_private; in meson_irq()
74 (void)readl_relaxed(priv->io_base + _REG(VENC_INTFLAG)); in meson_irq()
87 args->pitch = ALIGN(DIV_ROUND_UP(args->width * args->bpp, 8), SZ_64); in meson_dumb_create()
88 args->size = PAGE_ALIGN(args->pitch * args->height); in meson_dumb_create()
115 for_each_endpoint_of_node(dev->of_node, ep) { in meson_vpu_has_available_connectors()
145 writel_relaxed(value, priv->io_base + _REG(VPU_RDARB_MODE_L1C1)); in meson_vpu_init()
149 writel_relaxed(value, priv->io_base + _REG(VPU_RDARB_MODE_L1C2)); in meson_vpu_init()
154 writel_relaxed(value, priv->io_base + _REG(VPU_RDARB_MODE_L2C1)); in meson_vpu_init()
158 writel_relaxed(value, priv->io_base + _REG(VPU_WRARB_MODE_L2C1)); in meson_vpu_init()
192 return -ENODEV; in meson_drv_bind_master()
197 return -ENODEV; in meson_drv_bind_master()
205 ret = -ENOMEM; in meson_drv_bind_master()
208 drm->dev_private = priv; in meson_drv_bind_master()
209 priv->drm = drm; in meson_drv_bind_master()
210 priv->dev = dev; in meson_drv_bind_master()
211 priv->compat = match->compat; in meson_drv_bind_master()
212 priv->afbcd.ops = match->afbcd_ops; in meson_drv_bind_master()
214 regs = devm_platform_ioremap_resource_byname(pdev, "vpu"); in meson_drv_bind_master()
220 priv->io_base = regs; in meson_drv_bind_master()
224 ret = -EINVAL; in meson_drv_bind_master()
228 regs = devm_ioremap(dev, res->start, resource_size(res)); in meson_drv_bind_master()
230 ret = -EADDRNOTAVAIL; in meson_drv_bind_master()
234 priv->hhi = devm_regmap_init_mmio(dev, regs, in meson_drv_bind_master()
236 if (IS_ERR(priv->hhi)) { in meson_drv_bind_master()
237 dev_err(&pdev->dev, "Couldn't create the HHI regmap\n"); in meson_drv_bind_master()
238 ret = PTR_ERR(priv->hhi); in meson_drv_bind_master()
242 priv->canvas = meson_canvas_get(dev); in meson_drv_bind_master()
243 if (IS_ERR(priv->canvas)) { in meson_drv_bind_master()
244 ret = PTR_ERR(priv->canvas); in meson_drv_bind_master()
248 ret = meson_canvas_alloc(priv->canvas, &priv->canvas_id_osd1); in meson_drv_bind_master()
251 ret = meson_canvas_alloc(priv->canvas, &priv->canvas_id_vd1_0); in meson_drv_bind_master()
253 meson_canvas_free(priv->canvas, priv->canvas_id_osd1); in meson_drv_bind_master()
256 ret = meson_canvas_alloc(priv->canvas, &priv->canvas_id_vd1_1); in meson_drv_bind_master()
258 meson_canvas_free(priv->canvas, priv->canvas_id_osd1); in meson_drv_bind_master()
259 meson_canvas_free(priv->canvas, priv->canvas_id_vd1_0); in meson_drv_bind_master()
262 ret = meson_canvas_alloc(priv->canvas, &priv->canvas_id_vd1_2); in meson_drv_bind_master()
264 meson_canvas_free(priv->canvas, priv->canvas_id_osd1); in meson_drv_bind_master()
265 meson_canvas_free(priv->canvas, priv->canvas_id_vd1_0); in meson_drv_bind_master()
266 meson_canvas_free(priv->canvas, priv->canvas_id_vd1_1); in meson_drv_bind_master()
270 priv->vsync_irq = platform_get_irq(pdev, 0); in meson_drv_bind_master()
279 priv->limits = &meson_drm_soc_attrs[i].limits; in meson_drv_bind_master()
295 drm->mode_config.max_width = 3840; in meson_drv_bind_master()
296 drm->mode_config.max_height = 2160; in meson_drv_bind_master()
297 drm->mode_config.funcs = &meson_mode_config_funcs; in meson_drv_bind_master()
298 drm->mode_config.helper_private = &meson_mode_config_helpers; in meson_drv_bind_master()
306 if (priv->afbcd.ops) { in meson_drv_bind_master()
307 ret = priv->afbcd.ops->init(priv); in meson_drv_bind_master()
319 ret = component_bind_all(drm->dev, drm); in meson_drv_bind_master()
321 dev_err(drm->dev, "Couldn't bind all components\n"); in meson_drv_bind_master()
342 ret = request_irq(priv->vsync_irq, meson_irq, 0, drm->driver->name, drm); in meson_drv_bind_master()
361 free_irq(priv->vsync_irq, drm); in meson_drv_bind_master()
363 if (priv->afbcd.ops) in meson_drv_bind_master()
364 priv->afbcd.ops->exit(priv); in meson_drv_bind_master()
379 struct drm_device *drm = priv->drm; in meson_drv_unbind()
381 if (priv->canvas) { in meson_drv_unbind()
382 meson_canvas_free(priv->canvas, priv->canvas_id_osd1); in meson_drv_unbind()
383 meson_canvas_free(priv->canvas, priv->canvas_id_vd1_0); in meson_drv_unbind()
384 meson_canvas_free(priv->canvas, priv->canvas_id_vd1_1); in meson_drv_unbind()
385 meson_canvas_free(priv->canvas, priv->canvas_id_vd1_2); in meson_drv_unbind()
391 free_irq(priv->vsync_irq, drm); in meson_drv_unbind()
399 if (priv->afbcd.ops) in meson_drv_unbind()
400 priv->afbcd.ops->exit(priv); in meson_drv_unbind()
415 return drm_mode_config_helper_suspend(priv->drm); in meson_drv_pm_suspend()
429 if (priv->afbcd.ops) in meson_drv_pm_resume()
430 priv->afbcd.ops->init(priv); in meson_drv_pm_resume()
432 return drm_mode_config_helper_resume(priv->drm); in meson_drv_pm_resume()
437 struct meson_drm *priv = dev_get_drvdata(&pdev->dev); in meson_drv_shutdown()
442 drm_kms_helper_poll_fini(priv->drm); in meson_drv_shutdown()
443 drm_atomic_helper_shutdown(priv->drm); in meson_drv_shutdown()
448 { .compatible = "composite-video-connector" },
449 { .compatible = "svideo-connector" },
456 struct device_node *np = pdev->dev.of_node; in meson_drv_probe()
474 dev_dbg(&pdev->dev, "parent %pOF remote match add %pOF parent %s\n", in meson_drv_probe()
475 np, remote, dev_name(&pdev->dev)); in meson_drv_probe()
477 component_match_add(&pdev->dev, &match, component_compare_of, remote); in meson_drv_probe()
485 return meson_drv_bind_master(&pdev->dev, false); in meson_drv_probe()
489 dev_info(&pdev->dev, "Queued %d outputs on vpu\n", count); in meson_drv_probe()
491 return component_master_add_with_match(&pdev->dev, in meson_drv_probe()
502 component_master_del(&pdev->dev, &meson_drv_master_ops); in meson_drv_remove()
526 { .compatible = "amlogic,meson-gxbb-vpu",
528 { .compatible = "amlogic,meson-gxl-vpu",
530 { .compatible = "amlogic,meson-gxm-vpu",
532 { .compatible = "amlogic,meson-g12a-vpu",
547 .name = "meson-drm",