[<prev] [next>] [day] [month] [year] [list]
Message-ID: <415275a6-7b3c-0550-6ed4-01245f385331@tronnes.org>
Date: Sat, 1 Oct 2022 14:37:43 +0200
From: Noralf Trønnes <noralf@...nnes.org>
To: Maxime Ripard <maxime@...no.tech>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Chen-Yu Tsai <wens@...e.org>,
Karol Herbst <kherbst@...hat.com>,
Samuel Holland <samuel@...lland.org>,
Lyude Paul <lyude@...hat.com>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Daniel Vetter <daniel@...ll.ch>,
Thomas Zimmermann <tzimmermann@...e.de>,
Emma Anholt <emma@...olt.net>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Ben Skeggs <bskeggs@...hat.com>,
David Airlie <airlied@...ux.ie>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>
Cc: linux-arm-kernel@...ts.infradead.org,
dri-devel@...ts.freedesktop.org,
Geert Uytterhoeven <geert@...ux-m68k.org>,
intel-gfx@...ts.freedesktop.org, linux-sunxi@...ts.linux.dev,
Hans de Goede <hdegoede@...hat.com>,
nouveau@...ts.freedesktop.org,
Mateusz Kwiatkowski <kfyatek+publicgit@...il.com>,
Dave Stevenson <dave.stevenson@...pberrypi.com>,
linux-kernel@...r.kernel.org, Dom Cobley <dom@...pberrypi.com>,
Phil Elwell <phil@...pberrypi.com>,
Noralf Trønnes <noralf@...nnes.org>
Subject: Re: [PATCH v4 30/30] drm/sun4i: tv: Convert to the new TV mode
property
Den 29.09.2022 18.31, skrev Maxime Ripard:
> Now that the core can deal fine with analog TV modes, let's convert the
> sun4i TV driver to leverage those new features.
>
> Signed-off-by: Maxime Ripard <maxime@...no.tech>
> ---
> drivers/gpu/drm/sun4i/sun4i_tv.c | 148 ++++++++++++++-------------------------
> drivers/gpu/drm/vc4/vc4_vec.c | 5 +-
> 2 files changed, 54 insertions(+), 99 deletions(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
> @@ -467,35 +398,46 @@ static const struct drm_encoder_helper_funcs sun4i_tv_helper_funcs = {
>
> static int sun4i_tv_comp_get_modes(struct drm_connector *connector)
> {
> - int i;
> + struct drm_display_mode *mode;
> + int count = 0;
>
> - for (i = 0; i < ARRAY_SIZE(tv_modes); i++) {
> - struct drm_display_mode *mode;
> - const struct tv_mode *tv_mode = &tv_modes[i];
> -
> - mode = drm_mode_create(connector->dev);
> - if (!mode) {
> - DRM_ERROR("Failed to create a new display mode\n");
> - return 0;
> - }
> + mode = drm_mode_analog_ntsc_480i(connector->dev);
> + if (!mode) {
> + DRM_ERROR("Failed to create a new display mode\n");
> + return -ENOMEM;
> + }
>
> - strcpy(mode->name, tv_mode->name);
> + mode->type |= DRM_MODE_TYPE_PREFERRED;
> + drm_mode_probed_add(connector, mode);
> + count += 1;
>
> - sun4i_tv_mode_to_drm_mode(tv_mode, mode);
> - drm_mode_probed_add(connector, mode);
> + mode = drm_mode_analog_pal_576i(connector->dev);
> + if (!mode) {
> + DRM_ERROR("Failed to create a new display mode\n");
> + return -ENOMEM;
> }
>
> - return i;
> + drm_mode_probed_add(connector, mode);
> + count += 1;
> +
> + return count;
count is always 2 so you can just return 2.
Acked-by: Noralf Trønnes <noralf@...nnes.org>
> }
This stray hunk belongs to the vc4 TV mode patch I guess:
> diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c
> index 8d37d7ba9b2a..88b4330bfa39 100644
> --- a/drivers/gpu/drm/vc4/vc4_vec.c
> +++ b/drivers/gpu/drm/vc4/vc4_vec.c
> @@ -322,7 +322,7 @@ vc4_vec_tv_mode_lookup(unsigned int mode)
> return NULL;
> }
>
> -static const struct drm_prop_enum_list tv_mode_names[] = {
> +static const struct drm_prop_enum_list legacy_tv_mode_names[] = {
> { VC4_VEC_TV_MODE_NTSC, "NTSC", },
> { VC4_VEC_TV_MODE_NTSC_443, "NTSC-443", },
> { VC4_VEC_TV_MODE_NTSC_J, "NTSC-J", },
> @@ -498,7 +498,8 @@ static int vc4_vec_connector_init(struct drm_device *dev, struct vc4_vec *vec)
> DRM_MODE_TV_MODE_NTSC);
>
> prop = drm_property_create_enum(dev, 0, "mode",
> - tv_mode_names, ARRAY_SIZE(tv_mode_names));
> + legacy_tv_mode_names,
> + ARRAY_SIZE(legacy_tv_mode_names));
> if (!prop)
> return -ENOMEM;
> vec->legacy_tv_mode_property = prop;
>
Noralf.
Powered by blists - more mailing lists