[PATCH v7 16/23] drm/probe-helper: Provide a TV get_modes helper

Maxime Ripard maxime at cerno.tech
Wed Nov 9 07:41:33 PST 2022


Hi Noralf,

On Mon, Nov 07, 2022 at 07:11:27PM +0100, Noralf Trønnes wrote:
> 
> 
> Den 07.11.2022 15.16, skrev Maxime Ripard:
> > From: Noralf Trønnes <noralf at tronnes.org>
> > 
> > Most of the TV connectors will need a similar get_modes implementation
> > that will, depending on the drivers' capabilities, register the 480i and
> > 576i modes.
> > 
> > That implementation will also need to set the preferred flag and order
> > the modes based on the driver and users preferrence.
> > 
> > This is especially important to guarantee that a userspace stack such as
> > Xorg can start and pick up the preferred mode while maintaining a
> > working output.
> > 
> > Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
> > Signed-off-by: Maxime Ripard <maxime at cerno.tech>
> > 
> > ---
> > Changes in v7:
> > - Used Noralf's implementation
> > 
> > Changes in v6:
> > - New patch
> > ---
> >  drivers/gpu/drm/drm_probe_helper.c | 97 ++++++++++++++++++++++++++++++++++++++
> >  include/drm/drm_probe_helper.h     |  1 +
> >  2 files changed, 98 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> > index 2fc21df709bc..edb2e4c4530a 100644
> > --- a/drivers/gpu/drm/drm_probe_helper.c
> > +++ b/drivers/gpu/drm/drm_probe_helper.c
> > @@ -1147,3 +1147,100 @@ int drm_connector_helper_get_modes(struct drm_connector *connector)
> >  	return count;
> >  }
> >  EXPORT_SYMBOL(drm_connector_helper_get_modes);
> > +
> > +static bool tv_mode_supported(struct drm_connector *connector,
> > +			      enum drm_connector_tv_mode mode)
> > +{
> > +	struct drm_device *dev = connector->dev;
> > +	struct drm_property *property = dev->mode_config.tv_mode_property;
> > +
> > +	unsigned int i;
> > +
> > +	for (i = 0; i < property->num_values; i++)
> > +		if (property->values[i] == mode)
> > +			return true;
> > +
> > +	return false;
> > +}
> 
> This function is not used in the new implementation.
>
> I hope you have tested this patch since I didn't even compile test my
> implementation (probably should have said so...)

You nailed it ;)

I had tested it (but missed the warning), and added unit tests to make
sure it was behaving properly, and it did. I'll send the unit tests in
my next version.

Thanks
Maxime



More information about the linux-arm-kernel mailing list