Re: [PATCH v2 32/41] drm/vc4: vec: Convert to the new TV mode property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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

> 
> +};



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux