[PATCH 13/17] video: rockchip: Add rk3328 vop support

Johan Jonker jbx6244 at yandex.com
Sat Dec 16 23:45:00 CET 2023


Hi Jagan,

In  your patch U-boot users must add a new file for each new Rockchip SoC.

With the VOP2 introduction the VOP1 structures and functions are frozen/stabilized.

My proposal would be to use a file simular to Linux rockchip_vop_reg.c and port it to U-boot as is done in the manufacturer tree.

Together with a simple basic rockchip_vop.c to start with.

Not sure if we need a kind of DRM frame work.

Question: What do the U-boot maintainers think of this DRM implementation in use by Rockchip. Is that a route that useful for mainline?

Let me know your ideas.

Johan


On 12/11/23 09:59, Jagan Teki wrote:
> From: Jagan Teki <jagan at edgeble.ai>
>
> Add support for Rockchip RK3328 VOP.
>
> Signed-off-by: Jagan Teki <jagan at edgeble.ai>
> ---
>  drivers/video/rockchip/Makefile     |  1 +
>  drivers/video/rockchip/rk3328_vop.c | 66 +++++++++++++++++++++++++++++
>  2 files changed, 67 insertions(+)
>  create mode 100644 drivers/video/rockchip/rk3328_vop.c
>
> diff --git a/drivers/video/rockchip/Makefile b/drivers/video/rockchip/Makefile
> index 4991303c73..f55beceebf 100644
> --- a/drivers/video/rockchip/Makefile
> +++ b/drivers/video/rockchip/Makefile
> @@ -6,6 +6,7 @@
>  ifdef CONFIG_VIDEO_ROCKCHIP
>  obj-y += rk_vop.o
>  obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288_vop.o
> +obj-$(CONFIG_ROCKCHIP_RK3328) += rk3328_vop.o
>  obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399_vop.o
>  obj-$(CONFIG_DISPLAY_ROCKCHIP_EDP) += rk_edp.o
>  obj-$(CONFIG_DISPLAY_ROCKCHIP_LVDS) += rk_lvds.o
> diff --git a/drivers/video/rockchip/rk3328_vop.c b/drivers/video/rockchip/rk3328_vop.c
> new file mode 100644
> index 0000000000..2512314e64
> --- /dev/null
> +++ b/drivers/video/rockchip/rk3328_vop.c
> @@ -0,0 +1,66 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (c) 2023 Edgeble AI Technologies Pvt. Ltd.
> + */
> +
> +#include <common.h>
> +#include <dm.h>
> +#include <video.h>
> +#include <asm/io.h>
> +#include "rk_vop.h"
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +static void rk3328_set_pin_polarity(struct udevice *dev,
> +				    enum vop_modes mode, u32 polarity)
> +{
> +	struct rk_vop_priv *priv = dev_get_priv(dev);
> +	struct rk3288_vop *regs = priv->regs;
> +
> +	switch (mode) {
> +	case VOP_MODE_HDMI:
> +		clrsetbits_le32(&regs->dsp_ctrl1,
> +				M_RK3399_DSP_HDMI_POL,
> +				V_RK3399_DSP_HDMI_POL(polarity));
> +		break;
> +	default:
> +		debug("%s: unsupported output mode %x\n", __func__, mode);
> +	}
> +}
> +
> +static int rk3328_vop_probe(struct udevice *dev)
> +{
> +	/* Before relocation we don't need to do anything */
> +	if (!(gd->flags & GD_FLG_RELOC))
> +		return 0;
> +
> +	return rk_vop_probe(dev);
> +}
> +
> +struct rkvop_driverdata rk3328_driverdata = {
> +	.dsp_offset = 0x490,
> +	.win_offset = 0xd0,
> +	.features = VOP_FEATURE_OUTPUT_10BIT,
> +	.set_pin_polarity = rk3328_set_pin_polarity,
> +};
> +
> +static const struct udevice_id rk3328_vop_ids[] = {
> +	{
> +		.compatible = "rockchip,rk3328-vop",
> +		.data = (ulong)&rk3328_driverdata
> +	},
> +	{ /* sentile */ }
> +};
> +
> +static const struct video_ops rk3328_vop_ops = {
> +};
> +
> +U_BOOT_DRIVER(rk3328_vop) = {
> +	.name	= "rk3328_vop",
> +	.id	= UCLASS_VIDEO,
> +	.of_match = rk3328_vop_ids,
> +	.ops	= &rk3328_vop_ops,
> +	.bind	= rk_vop_bind,
> +	.probe	= rk3328_vop_probe,
> +	.priv_auto	= sizeof(struct rk_vop_priv),
> +};


More information about the U-Boot mailing list