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@xxxxxxxxxx> > --- > 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@xxxxxxxxxxx> > } 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.