Re: [PATCH v1 34/35] drm/modes: Introduce the tv_mode property as a command-line option

2022-08-28 Thread Noralf Trønnes



Den 26.08.2022 08.46, skrev Maxime Ripard:
> On Thu, Aug 25, 2022 at 02:41:27PM +0200, Noralf Trønnes wrote:
>> Den 24.08.2022 17.45, skrev Maxime Ripard:
>>> Hi Noralf,
>>>
>>> On Sat, Aug 20, 2022 at 10:18:47PM +0200, Noralf Trønnes wrote:
 Den 29.07.2022 18.35, skrev Maxime Ripard:
> Our new tv mode option allows to specify the TV mode from a property.
> However, it can still be useful, for example to avoid any boot time
> artifact, to set that property directly from the kernel command line.
>
> Let's add some code to allow it, and some unit tests to exercise that 
> code.
>
> Signed-off-by: Maxime Ripard 
>

 In the subject it says "tv_mode property", but the property is called
 "tv norm", so the option should be tv_norm?
>>>
>>> Yeah... I don't know. mode is taken but it's obviously the best name. So
>>> I went with norm to avoid the (internal) conflict but I left mode for
>>> the user facing property.
>>>
>>> I'm not sure what's best here, or maybe we can pick another name entirely?
>>>
>>
>> Why not just call it "tv mode" or even better "TV Mode". The state
>> member can be called tv_mode, but the mode_config member will need a
>> temporary name until the "mode" property is removed. tv_tv_mode or maybe
>> connector_tv_mode?
> 
> Yeah, that seems like a good idea. Would legacy_tv_mode work for you?
> 

Oh yeah, renaming the "mode" property, that works fine.

Noralf.


Re: [PATCH v1 34/35] drm/modes: Introduce the tv_mode property as a command-line option

2022-08-25 Thread Maxime Ripard
On Thu, Aug 25, 2022 at 02:41:27PM +0200, Noralf Trønnes wrote:
> Den 24.08.2022 17.45, skrev Maxime Ripard:
> > Hi Noralf,
> > 
> > On Sat, Aug 20, 2022 at 10:18:47PM +0200, Noralf Trønnes wrote:
> >> Den 29.07.2022 18.35, skrev Maxime Ripard:
> >>> Our new tv mode option allows to specify the TV mode from a property.
> >>> However, it can still be useful, for example to avoid any boot time
> >>> artifact, to set that property directly from the kernel command line.
> >>>
> >>> Let's add some code to allow it, and some unit tests to exercise that 
> >>> code.
> >>>
> >>> Signed-off-by: Maxime Ripard 
> >>>
> >>
> >> In the subject it says "tv_mode property", but the property is called
> >> "tv norm", so the option should be tv_norm?
> > 
> > Yeah... I don't know. mode is taken but it's obviously the best name. So
> > I went with norm to avoid the (internal) conflict but I left mode for
> > the user facing property.
> > 
> > I'm not sure what's best here, or maybe we can pick another name entirely?
> > 
> 
> Why not just call it "tv mode" or even better "TV Mode". The state
> member can be called tv_mode, but the mode_config member will need a
> temporary name until the "mode" property is removed. tv_tv_mode or maybe
> connector_tv_mode?

Yeah, that seems like a good idea. Would legacy_tv_mode work for you?

> But IMO, if there are no users of this property, adding it should have a
> drm maintainers ack.

Yep, of course :)

Maxime


signature.asc
Description: PGP signature


Re: [PATCH v1 34/35] drm/modes: Introduce the tv_mode property as a command-line option

2022-08-25 Thread Noralf Trønnes



Den 24.08.2022 17.45, skrev Maxime Ripard:
> Hi Noralf,
> 
> On Sat, Aug 20, 2022 at 10:18:47PM +0200, Noralf Trønnes wrote:
>> Den 29.07.2022 18.35, skrev Maxime Ripard:
>>> Our new tv mode option allows to specify the TV mode from a property.
>>> However, it can still be useful, for example to avoid any boot time
>>> artifact, to set that property directly from the kernel command line.
>>>
>>> Let's add some code to allow it, and some unit tests to exercise that code.
>>>
>>> Signed-off-by: Maxime Ripard 
>>>
>>
>> In the subject it says "tv_mode property", but the property is called
>> "tv norm", so the option should be tv_norm?
> 
> Yeah... I don't know. mode is taken but it's obviously the best name. So
> I went with norm to avoid the (internal) conflict but I left mode for
> the user facing property.
> 
> I'm not sure what's best here, or maybe we can pick another name entirely?
> 

Why not just call it "tv mode" or even better "TV Mode". The state
member can be called tv_mode, but the mode_config member will need a
temporary name until the "mode" property is removed. tv_tv_mode or maybe
connector_tv_mode?

But IMO, if there are no users of this property, adding it should have a
drm maintainers ack.

Noralf.


Re: [PATCH v1 34/35] drm/modes: Introduce the tv_mode property as a command-line option

2022-08-24 Thread Mateusz Kwiatkowski
Hi Maxime & Noralf,

W dniu 24.08.2022 o 17:45, Maxime Ripard pisze:
> Hi Noralf,
>
> On Sat, Aug 20, 2022 at 10:18:47PM +0200, Noralf Trønnes wrote:
>> Den 29.07.2022 18.35, skrev Maxime Ripard:
>>> Our new tv mode option allows to specify the TV mode from a property.
>>> However, it can still be useful, for example to avoid any boot time
>>> artifact, to set that property directly from the kernel command line.
>>>
>>> Let's add some code to allow it, and some unit tests to exercise that code.
>>>
>>> Signed-off-by: Maxime Ripard 
>>>
>>
>> In the subject it says "tv_mode property", but the property is called
>> "tv norm", so the option should be tv_norm?
>
> Yeah... I don't know. mode is taken but it's obviously the best name. So
> I went with norm to avoid the (internal) conflict but I left mode for
> the user facing property.
>
> I'm not sure what's best here, or maybe we can pick another name entirely?

I think "standard" and "system" are also fairly common names for this property.

I once had an old multi-standard Sharp CRT TV that allowed manually selecting
the expected color encoding (PAL/SECAM/NTSC/NTSC-443), and the relevant button
on the remote was labeled "SYSTEM".

V4L2 calls this "standard", see include/uapi/linux/videodev2.h, compare with
v4l2_std_id, V4L2_STD_* etc.

BTW, maybe reusing those V4L2 constants, or aligning the numerical values,
would make some sense?

>
> Maxime

Best regards,
Mateusz Kwiatkowski


Re: [PATCH v1 34/35] drm/modes: Introduce the tv_mode property as a command-line option

2022-08-24 Thread Maxime Ripard
Hi Noralf,

On Sat, Aug 20, 2022 at 10:18:47PM +0200, Noralf Trønnes wrote:
> Den 29.07.2022 18.35, skrev Maxime Ripard:
> > Our new tv mode option allows to specify the TV mode from a property.
> > However, it can still be useful, for example to avoid any boot time
> > artifact, to set that property directly from the kernel command line.
> > 
> > Let's add some code to allow it, and some unit tests to exercise that code.
> > 
> > Signed-off-by: Maxime Ripard 
> > 
> 
> In the subject it says "tv_mode property", but the property is called
> "tv norm", so the option should be tv_norm?

Yeah... I don't know. mode is taken but it's obviously the best name. So
I went with norm to avoid the (internal) conflict but I left mode for
the user facing property.

I'm not sure what's best here, or maybe we can pick another name entirely?

Maxime


signature.asc
Description: PGP signature


Re: [PATCH v1 34/35] drm/modes: Introduce the tv_mode property as a command-line option

2022-08-20 Thread Noralf Trønnes



Den 29.07.2022 18.35, skrev Maxime Ripard:
> Our new tv mode option allows to specify the TV mode from a property.
> However, it can still be useful, for example to avoid any boot time
> artifact, to set that property directly from the kernel command line.
> 
> Let's add some code to allow it, and some unit tests to exercise that code.
> 
> Signed-off-by: Maxime Ripard 
> 

In the subject it says "tv_mode property", but the property is called
"tv norm", so the option should be tv_norm?

Noralf.

> diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c 
> b/drivers/gpu/drm/drm_atomic_state_helper.c
> index fce5569bd66a..49da8d8236f5 100644
> --- a/drivers/gpu/drm/drm_atomic_state_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_state_helper.c
> @@ -490,6 +490,7 @@ 
> EXPORT_SYMBOL(drm_atomic_helper_connector_tv_margins_reset);
>  void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector)
>  {
>   struct drm_device *dev = connector->dev;
> + struct drm_cmdline_mode *cmdline = &connector->cmdline_mode;
>   struct drm_connector_state *state = connector->state;
>   struct drm_property *prop;
>   uint64_t val;
> @@ -500,6 +501,9 @@ void drm_atomic_helper_connector_tv_reset(struct 
> drm_connector *connector)
>  prop, &val))
>   state->tv.norm = val;
>  
> + if (cmdline->tv_mode)
> + state->tv.norm = cmdline->tv_mode;
> +
>   prop = dev->mode_config.tv_select_subconnector_property;
>   if (prop)
>   if (!drm_object_property_get_default_value(&connector->base,
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index ecb2e83cf860..3634ac9f787d 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -1677,6 +1677,80 @@ static int drm_mode_parse_panel_orientation(const char 
> *delim,
>   return 0;
>  }
>  
> +#define TV_OPTION_EQUAL(value, len, option) \
> + ((strlen(option) == len) && !strncmp(value, option, len))
> +
> +static int drm_mode_parse_tv_mode(const char *delim,
> +   struct drm_cmdline_mode *mode)
> +{
> + const char *value;
> + unsigned int len;
> +
> + if (*delim != '=')
> + return -EINVAL;
> +
> + value = delim + 1;
> + delim = strchr(value, ',');
> + if (!delim)
> + delim = value + strlen(value);
> +
> + len = delim - value;
> + if (TV_OPTION_EQUAL(value, len, "NTSC-443"))
> + mode->tv_mode = DRM_MODE_TV_NORM_NTSC_443;
> + else if (TV_OPTION_EQUAL(value, len, "NTSC-J"))
> + mode->tv_mode = DRM_MODE_TV_NORM_NTSC_J;
> + else if (TV_OPTION_EQUAL(value, len, "NTSC-M"))
> + mode->tv_mode = DRM_MODE_TV_NORM_NTSC_M;
> + else if (TV_OPTION_EQUAL(value, len, "PAL-60"))
> + mode->tv_mode = DRM_MODE_TV_NORM_PAL_60;
> + else if (TV_OPTION_EQUAL(value, len, "PAL-B"))
> + mode->tv_mode = DRM_MODE_TV_NORM_PAL_B;
> + else if (TV_OPTION_EQUAL(value, len, "PAL-D"))
> + mode->tv_mode = DRM_MODE_TV_NORM_PAL_D;
> + else if (TV_OPTION_EQUAL(value, len, "PAL-G"))
> + mode->tv_mode = DRM_MODE_TV_NORM_PAL_G;
> + else if (TV_OPTION_EQUAL(value, len, "PAL-H"))
> + mode->tv_mode = DRM_MODE_TV_NORM_PAL_H;
> + else if (TV_OPTION_EQUAL(value, len, "PAL-I"))
> + mode->tv_mode = DRM_MODE_TV_NORM_PAL_I;
> + else if (TV_OPTION_EQUAL(value, len, "PAL-M"))
> + mode->tv_mode = DRM_MODE_TV_NORM_PAL_M;
> + else if (TV_OPTION_EQUAL(value, len, "PAL-N"))
> + mode->tv_mode = DRM_MODE_TV_NORM_PAL_N;
> + else if (TV_OPTION_EQUAL(value, len, "PAL-NC"))
> + mode->tv_mode = DRM_MODE_TV_NORM_PAL_NC;
> + else if (TV_OPTION_EQUAL(value, len, "SECAM-60"))
> + mode->tv_mode = DRM_MODE_TV_NORM_SECAM_60;
> + else if (TV_OPTION_EQUAL(value, len, "SECAM-B"))
> + mode->tv_mode = DRM_MODE_TV_NORM_SECAM_B;
> + else if (TV_OPTION_EQUAL(value, len, "SECAM-D"))
> + mode->tv_mode = DRM_MODE_TV_NORM_SECAM_D;
> + else if (TV_OPTION_EQUAL(value, len, "SECAM-G"))
> + mode->tv_mode = DRM_MODE_TV_NORM_SECAM_G;
> + else if (TV_OPTION_EQUAL(value, len, "SECAM-K"))
> + mode->tv_mode = DRM_MODE_TV_NORM_SECAM_K;
> + else if (TV_OPTION_EQUAL(value, len, "SECAM-K1"))
> + mode->tv_mode = DRM_MODE_TV_NORM_SECAM_K1;
> + else if (TV_OPTION_EQUAL(value, len, "SECAM-L"))
> + mode->tv_mode = DRM_MODE_TV_NORM_SECAM_L;
> + else if (TV_OPTION_EQUAL(value, len, "HD480I"))
> + mode->tv_mode = DRM_MODE_TV_NORM_HD480I;
> + else if (TV_OPTION_EQUAL(value, len, "HD480P"))
> + mode->tv_mode = DRM_MODE_TV_NORM_HD480P;
> + else if (TV_OPTION_EQUAL(value, len, "HD576I"))
> + mode->tv_mode = DRM_MODE_TV_NORM_HD576I;
> + else if (TV_OPTION_EQUAL(value, len, "HD576P")

Re: [PATCH v1 34/35] drm/modes: Introduce the tv_mode property as a command-line option

2022-08-16 Thread Maxime Ripard
On Fri, Aug 12, 2022 at 03:31:19PM +0200, Geert Uytterhoeven wrote:
> Hi Maxime,
> 
> On Fri, Jul 29, 2022 at 6:37 PM Maxime Ripard  wrote:
> > Our new tv mode option allows to specify the TV mode from a property.
> > However, it can still be useful, for example to avoid any boot time
> > artifact, to set that property directly from the kernel command line.
> >
> > Let's add some code to allow it, and some unit tests to exercise that code.
> >
> > Signed-off-by: Maxime Ripard 
> 
> Thanks for your patch!
> 
> > --- a/drivers/gpu/drm/drm_modes.c
> > +++ b/drivers/gpu/drm/drm_modes.c
> > @@ -1677,6 +1677,80 @@ static int drm_mode_parse_panel_orientation(const 
> > char *delim,
> > return 0;
> >  }
> >
> > +#define TV_OPTION_EQUAL(value, len, option) \
> > +   ((strlen(option) == len) && !strncmp(value, option, len))
> > +
> > +static int drm_mode_parse_tv_mode(const char *delim,
> > + struct drm_cmdline_mode *mode)
> > +{
> > +   const char *value;
> > +   unsigned int len;
> > +
> > +   if (*delim != '=')
> > +   return -EINVAL;
> > +
> > +   value = delim + 1;
> > +   delim = strchr(value, ',');
> > +   if (!delim)
> > +   delim = value + strlen(value);
> > +
> > +   len = delim - value;
> > +   if (TV_OPTION_EQUAL(value, len, "NTSC-443"))
> > +   mode->tv_mode = DRM_MODE_TV_NORM_NTSC_443;
> > +   else if (TV_OPTION_EQUAL(value, len, "NTSC-J"))
> > +   mode->tv_mode = DRM_MODE_TV_NORM_NTSC_J;
> > +   else if (TV_OPTION_EQUAL(value, len, "NTSC-M"))
> > +   mode->tv_mode = DRM_MODE_TV_NORM_NTSC_M;
> 
> [...]
> 
> You already have the array tv_norm_values[] from "[PATCH v1 05/35]
> drm/connector: Add TV standard property". Can't you export that, and
> loop over that array instead?

I'm not sure, the command line doesn't follow the same conventions than
the property names for a number of conventions, but at the same time we
should try to keep it as consistent as possible...

Then again, Jani and Thomas didn't seem too fond about exposing data as
part of the API, so I'm not sure how we could expose that properly.

> > +   else if (TV_OPTION_EQUAL(value, len, "HD480I"))
> > +   mode->tv_mode = DRM_MODE_TV_NORM_HD480I;
> > +   else if (TV_OPTION_EQUAL(value, len, "HD480P"))
> > +   mode->tv_mode = DRM_MODE_TV_NORM_HD480P;
> > +   else if (TV_OPTION_EQUAL(value, len, "HD576I"))
> > +   mode->tv_mode = DRM_MODE_TV_NORM_HD576I;
> > +   else if (TV_OPTION_EQUAL(value, len, "HD576P"))
> > +   mode->tv_mode = DRM_MODE_TV_NORM_HD576P;
> > +   else if (TV_OPTION_EQUAL(value, len, "HD720P"))
> > +   mode->tv_mode = DRM_MODE_TV_NORM_HD720P;
> > +   else if (TV_OPTION_EQUAL(value, len, "HD1080I"))
> > +   mode->tv_mode = DRM_MODE_TV_NORM_HD1080I;
> 
> The names in tv_norm_values[] use lower-case, while you use upper-case
> here.

Indeed, I'll fix it, thanks!
Maxime


signature.asc
Description: PGP signature


Re: [PATCH v1 34/35] drm/modes: Introduce the tv_mode property as a command-line option

2022-08-12 Thread Geert Uytterhoeven
Hi Maxime,

On Fri, Jul 29, 2022 at 6:37 PM Maxime Ripard  wrote:
> Our new tv mode option allows to specify the TV mode from a property.
> However, it can still be useful, for example to avoid any boot time
> artifact, to set that property directly from the kernel command line.
>
> Let's add some code to allow it, and some unit tests to exercise that code.
>
> Signed-off-by: Maxime Ripard 

Thanks for your patch!

> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -1677,6 +1677,80 @@ static int drm_mode_parse_panel_orientation(const char 
> *delim,
> return 0;
>  }
>
> +#define TV_OPTION_EQUAL(value, len, option) \
> +   ((strlen(option) == len) && !strncmp(value, option, len))
> +
> +static int drm_mode_parse_tv_mode(const char *delim,
> + struct drm_cmdline_mode *mode)
> +{
> +   const char *value;
> +   unsigned int len;
> +
> +   if (*delim != '=')
> +   return -EINVAL;
> +
> +   value = delim + 1;
> +   delim = strchr(value, ',');
> +   if (!delim)
> +   delim = value + strlen(value);
> +
> +   len = delim - value;
> +   if (TV_OPTION_EQUAL(value, len, "NTSC-443"))
> +   mode->tv_mode = DRM_MODE_TV_NORM_NTSC_443;
> +   else if (TV_OPTION_EQUAL(value, len, "NTSC-J"))
> +   mode->tv_mode = DRM_MODE_TV_NORM_NTSC_J;
> +   else if (TV_OPTION_EQUAL(value, len, "NTSC-M"))
> +   mode->tv_mode = DRM_MODE_TV_NORM_NTSC_M;

[...]

You already have the array tv_norm_values[] from "[PATCH v1 05/35]
drm/connector: Add TV standard property". Can't you export that, and
loop over that array instead?

> +   else if (TV_OPTION_EQUAL(value, len, "HD480I"))
> +   mode->tv_mode = DRM_MODE_TV_NORM_HD480I;
> +   else if (TV_OPTION_EQUAL(value, len, "HD480P"))
> +   mode->tv_mode = DRM_MODE_TV_NORM_HD480P;
> +   else if (TV_OPTION_EQUAL(value, len, "HD576I"))
> +   mode->tv_mode = DRM_MODE_TV_NORM_HD576I;
> +   else if (TV_OPTION_EQUAL(value, len, "HD576P"))
> +   mode->tv_mode = DRM_MODE_TV_NORM_HD576P;
> +   else if (TV_OPTION_EQUAL(value, len, "HD720P"))
> +   mode->tv_mode = DRM_MODE_TV_NORM_HD720P;
> +   else if (TV_OPTION_EQUAL(value, len, "HD1080I"))
> +   mode->tv_mode = DRM_MODE_TV_NORM_HD1080I;

The names in tv_norm_values[] use lower-case, while you use upper-case
here.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


[PATCH v1 34/35] drm/modes: Introduce the tv_mode property as a command-line option

2022-07-29 Thread Maxime Ripard
Our new tv mode option allows to specify the TV mode from a property.
However, it can still be useful, for example to avoid any boot time
artifact, to set that property directly from the kernel command line.

Let's add some code to allow it, and some unit tests to exercise that code.

Signed-off-by: Maxime Ripard 

diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c 
b/drivers/gpu/drm/drm_atomic_state_helper.c
index fce5569bd66a..49da8d8236f5 100644
--- a/drivers/gpu/drm/drm_atomic_state_helper.c
+++ b/drivers/gpu/drm/drm_atomic_state_helper.c
@@ -490,6 +490,7 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_tv_margins_reset);
 void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector)
 {
struct drm_device *dev = connector->dev;
+   struct drm_cmdline_mode *cmdline = &connector->cmdline_mode;
struct drm_connector_state *state = connector->state;
struct drm_property *prop;
uint64_t val;
@@ -500,6 +501,9 @@ void drm_atomic_helper_connector_tv_reset(struct 
drm_connector *connector)
   prop, &val))
state->tv.norm = val;
 
+   if (cmdline->tv_mode)
+   state->tv.norm = cmdline->tv_mode;
+
prop = dev->mode_config.tv_select_subconnector_property;
if (prop)
if (!drm_object_property_get_default_value(&connector->base,
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index ecb2e83cf860..3634ac9f787d 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1677,6 +1677,80 @@ static int drm_mode_parse_panel_orientation(const char 
*delim,
return 0;
 }
 
+#define TV_OPTION_EQUAL(value, len, option) \
+   ((strlen(option) == len) && !strncmp(value, option, len))
+
+static int drm_mode_parse_tv_mode(const char *delim,
+ struct drm_cmdline_mode *mode)
+{
+   const char *value;
+   unsigned int len;
+
+   if (*delim != '=')
+   return -EINVAL;
+
+   value = delim + 1;
+   delim = strchr(value, ',');
+   if (!delim)
+   delim = value + strlen(value);
+
+   len = delim - value;
+   if (TV_OPTION_EQUAL(value, len, "NTSC-443"))
+   mode->tv_mode = DRM_MODE_TV_NORM_NTSC_443;
+   else if (TV_OPTION_EQUAL(value, len, "NTSC-J"))
+   mode->tv_mode = DRM_MODE_TV_NORM_NTSC_J;
+   else if (TV_OPTION_EQUAL(value, len, "NTSC-M"))
+   mode->tv_mode = DRM_MODE_TV_NORM_NTSC_M;
+   else if (TV_OPTION_EQUAL(value, len, "PAL-60"))
+   mode->tv_mode = DRM_MODE_TV_NORM_PAL_60;
+   else if (TV_OPTION_EQUAL(value, len, "PAL-B"))
+   mode->tv_mode = DRM_MODE_TV_NORM_PAL_B;
+   else if (TV_OPTION_EQUAL(value, len, "PAL-D"))
+   mode->tv_mode = DRM_MODE_TV_NORM_PAL_D;
+   else if (TV_OPTION_EQUAL(value, len, "PAL-G"))
+   mode->tv_mode = DRM_MODE_TV_NORM_PAL_G;
+   else if (TV_OPTION_EQUAL(value, len, "PAL-H"))
+   mode->tv_mode = DRM_MODE_TV_NORM_PAL_H;
+   else if (TV_OPTION_EQUAL(value, len, "PAL-I"))
+   mode->tv_mode = DRM_MODE_TV_NORM_PAL_I;
+   else if (TV_OPTION_EQUAL(value, len, "PAL-M"))
+   mode->tv_mode = DRM_MODE_TV_NORM_PAL_M;
+   else if (TV_OPTION_EQUAL(value, len, "PAL-N"))
+   mode->tv_mode = DRM_MODE_TV_NORM_PAL_N;
+   else if (TV_OPTION_EQUAL(value, len, "PAL-NC"))
+   mode->tv_mode = DRM_MODE_TV_NORM_PAL_NC;
+   else if (TV_OPTION_EQUAL(value, len, "SECAM-60"))
+   mode->tv_mode = DRM_MODE_TV_NORM_SECAM_60;
+   else if (TV_OPTION_EQUAL(value, len, "SECAM-B"))
+   mode->tv_mode = DRM_MODE_TV_NORM_SECAM_B;
+   else if (TV_OPTION_EQUAL(value, len, "SECAM-D"))
+   mode->tv_mode = DRM_MODE_TV_NORM_SECAM_D;
+   else if (TV_OPTION_EQUAL(value, len, "SECAM-G"))
+   mode->tv_mode = DRM_MODE_TV_NORM_SECAM_G;
+   else if (TV_OPTION_EQUAL(value, len, "SECAM-K"))
+   mode->tv_mode = DRM_MODE_TV_NORM_SECAM_K;
+   else if (TV_OPTION_EQUAL(value, len, "SECAM-K1"))
+   mode->tv_mode = DRM_MODE_TV_NORM_SECAM_K1;
+   else if (TV_OPTION_EQUAL(value, len, "SECAM-L"))
+   mode->tv_mode = DRM_MODE_TV_NORM_SECAM_L;
+   else if (TV_OPTION_EQUAL(value, len, "HD480I"))
+   mode->tv_mode = DRM_MODE_TV_NORM_HD480I;
+   else if (TV_OPTION_EQUAL(value, len, "HD480P"))
+   mode->tv_mode = DRM_MODE_TV_NORM_HD480P;
+   else if (TV_OPTION_EQUAL(value, len, "HD576I"))
+   mode->tv_mode = DRM_MODE_TV_NORM_HD576I;
+   else if (TV_OPTION_EQUAL(value, len, "HD576P"))
+   mode->tv_mode = DRM_MODE_TV_NORM_HD576P;
+   else if (TV_OPTION_EQUAL(value, len, "HD720P"))
+   mode->tv_mode = DRM_MODE_TV_NORM_HD720P;
+   else if (TV_OPTION_EQUAL(value, len, "HD1080I"))
+