[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <199cf4b3-8ace-e047-3050-b810cf0c6b63@tronnes.org>
Date: Tue, 30 Aug 2022 21:01:08 +0200
From: Noralf Trønnes <noralf@...nnes.org>
To: Maxime Ripard <maxime@...no.tech>,
Maxime Ripard <mripard@...nel.org>,
Ben Skeggs <bskeggs@...hat.com>,
David Airlie <airlied@...ux.ie>, Chen-Yu Tsai <wens@...e.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Lyude Paul <lyude@...hat.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Samuel Holland <samuel@...lland.org>,
Karol Herbst <kherbst@...hat.com>,
Emma Anholt <emma@...olt.net>, Daniel Vetter <daniel@...ll.ch>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>
Cc: Hans de Goede <hdegoede@...hat.com>,
linux-arm-kernel@...ts.infradead.org,
Phil Elwell <phil@...pberrypi.com>,
intel-gfx@...ts.freedesktop.org,
Dave Stevenson <dave.stevenson@...pberrypi.com>,
dri-devel@...ts.freedesktop.org, Dom Cobley <dom@...pberrypi.com>,
linux-kernel@...r.kernel.org, nouveau@...ts.freedesktop.org,
linux-sunxi@...ts.linux.dev,
Mateusz Kwiatkowski <kfyatek+publicgit@...il.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Noralf Trønnes <noralf@...nnes.org>
Subject: Re: [PATCH v2 32/41] drm/vc4: vec: Convert to the new TV mode
property
Den 29.08.2022 15.11, skrev Maxime Ripard:
> Now that the core can deal fine with analog TV modes, let's convert the vc4
>
> VEC driver to leverage those new features.
>
>
>
> We've added some backward compatibility to support the old TV mode property
>
> and translate it into the new TV norm property.
>
>
>
> Signed-off-by: Maxime Ripard <maxime@...no.tech>
>
>
>
> diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c
>
> index ba6f81908923..58286acf4b9e 100644
>
> --- a/drivers/gpu/drm/vc4/vc4_vec.c
>
> +++ b/drivers/gpu/drm/vc4/vc4_vec.c
> @@ -192,7 +200,7 @@ enum vc4_vec_tv_mode_id {
>
> };
>
>
>
> struct vc4_vec_tv_mode {
>
> - const struct drm_display_mode *mode;
>
> + unsigned int mode;
>
> u32 config0;
>
> u32 config1;
>
> u32 custom_freq;
>
> @@ -226,28 +234,50 @@ static const struct debugfs_reg32 vec_regs[] = {
>
> };
>
>
>
> static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = {
>
> - [VC4_VEC_TV_MODE_NTSC] = {
>
> - .mode = &drm_mode_480i,
>
> + {
>
> + .mode = DRM_MODE_TV_MODE_NTSC_M,
>
> .config0 = VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN,
>
> .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>
> },
>
> - [VC4_VEC_TV_MODE_NTSC_J] = {
>
> - .mode = &drm_mode_480i,
>
> + {
>
> + .mode = DRM_MODE_TV_MODE_NTSC_J,
>
> .config0 = VEC_CONFIG0_NTSC_STD,
>
> .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>
> },
>
> - [VC4_VEC_TV_MODE_PAL] = {
>
> - .mode = &drm_mode_576i,
>
> + {
>
> + .mode = DRM_MODE_TV_MODE_PAL_B,
>
> .config0 = VEC_CONFIG0_PAL_BDGHI_STD,
>
> .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>
> },
>
> - [VC4_VEC_TV_MODE_PAL_M] = {
>
> - .mode = &drm_mode_480i,
>
> + {
>
> + .mode = DRM_MODE_TV_MODE_PAL_M,
>
> .config0 = VEC_CONFIG0_PAL_M_STD,
>
> .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>
> },
>
> };
>
>
>
> +static inline const struct vc4_vec_tv_mode *
>
> +vc4_vec_tv_mode_lookup(unsigned int mode)
>
> +{
>
> + unsigned int i;
>
> +
>
> + for (i = 0; i < ARRAY_SIZE(vc4_vec_tv_modes); i++) {
>
> + const struct vc4_vec_tv_mode *tv_mode = &vc4_vec_tv_modes[i];
>
> +
>
> + if (tv_mode->mode == mode)
>
> + return tv_mode;
>
> + }
>
> +
>
> + return NULL;
>
> +}
>
> +
>
> +static const struct drm_prop_enum_list tv_mode_names[] = {
Maybe call it legacy_tv_mode_enums?
>
> + { VC4_VEC_TV_MODE_NTSC, "NTSC", },
>
> + { VC4_VEC_TV_MODE_NTSC_J, "NTSC-J", },
>
> + { VC4_VEC_TV_MODE_PAL, "PAL", },
>
> + { VC4_VEC_TV_MODE_PAL_M, "PAL-M", },
If you use DRM_MODE_TV_MODE_* here you don't need to translate the value
using the switch statement in get/set property, you can use the value
directly to get/set tv.mode.
Noralf.
>
> +};
Powered by blists - more mailing lists