diff mbox series

[1/4] drm/modes: Add a switch to differentiate free standing options

Message ID 20190827115850.25731-1-mripard@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/4] drm/modes: Add a switch to differentiate free standing options | expand

Commit Message

Maxime Ripard Aug. 27, 2019, 11:58 a.m. UTC
From: Maxime Ripard <maxime.ripard@bootlin.com>

Some extra command line options can be either specified without anything
else on the command line (basically all the force connection options), but
some other are only relevant when matched with a resolution (margin and
interlace).

Let's add a switch to restrict if needed the available option set.

Fixes: e08ab74bd4c7 ("drm/modes: Rewrite the command line parser")
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
 drivers/gpu/drm/drm_modes.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Thomas Graichen Aug. 27, 2019, 7:33 p.m. UTC | #1
hi maxime,

On Tue, Aug 27, 2019 at 1:58 PM Maxime Ripard <mripard@kernel.org> wrote:
>
> From: Maxime Ripard <maxime.ripard@bootlin.com>
>
> Some extra command line options can be either specified without anything
> else on the command line (basically all the force connection options), but
> some other are only relevant when matched with a resolution (margin and
> interlace).
>
> Let's add a switch to restrict if needed the available option set.
>
> Fixes: e08ab74bd4c7 ("drm/modes: Rewrite the command line parser")
> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>

Tested-by: thomas graichen <thomas.graichen@gmail.com>

BEFORE (only "[PATCH v5 05/12] drm/modes: Rewrite the command line
parser " applied):
my eachlink h6 mini tv box (which requires the video=HDMI-A-1:e
cmdline option to give any output on hdmi) did not show any hdmi
output any more (in 5.2 it still worked)

AFTER (the above patch plus this patch set here applied):
my eachlink h6 mini tv box gives output on hdmi again. i also did
check it the other way around: if i remove the video=HDMI-A-1:e option
i no longer get any hdmi output as expected. as a result this patch
series fixes the problem/regression for me.

best wishes - thomas

> ---
>  drivers/gpu/drm/drm_modes.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index 11acc9581977..e5997f35b779 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -1454,6 +1454,7 @@ static int drm_mode_parse_cmdline_refresh(const char *str, char **end_ptr,
>  }
>
>  static int drm_mode_parse_cmdline_extra(const char *str, int length,
> +                                       bool freestanding,
>                                         const struct drm_connector *connector,
>                                         struct drm_cmdline_mode *mode)
>  {
> @@ -1462,9 +1463,15 @@ static int drm_mode_parse_cmdline_extra(const char *str, int length,
>         for (i = 0; i < length; i++) {
>                 switch (str[i]) {
>                 case 'i':
> +                       if (freestanding)
> +                               return -EINVAL;
> +
>                         mode->interlace = true;
>                         break;
>                 case 'm':
> +                       if (freestanding)
> +                               return -EINVAL;
> +
>                         mode->margins = true;
>                         break;
>                 case 'D':
> @@ -1542,6 +1549,7 @@ static int drm_mode_parse_cmdline_res_mode(const char *str, unsigned int length,
>                         if (extras) {
>                                 int ret = drm_mode_parse_cmdline_extra(end_ptr + i,
>                                                                        1,
> +                                                                      false,
>                                                                        connector,
>                                                                        mode);
>                                 if (ret)
> @@ -1811,7 +1819,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
>             extra_ptr != options_ptr) {
>                 int len = strlen(name) - (extra_ptr - name);
>
> -               ret = drm_mode_parse_cmdline_extra(extra_ptr, len,
> +               ret = drm_mode_parse_cmdline_extra(extra_ptr, len, false,
>                                                    connector, mode);
>                 if (ret)
>                         return false;
> --
> 2.21.0
>
Jernej Škrabec Aug. 29, 2019, 6:13 p.m. UTC | #2
Hi!

Dne torek, 27. avgust 2019 ob 13:58:47 CEST je Maxime Ripard napisal(a):
> From: Maxime Ripard <maxime.ripard@bootlin.com>
> 
> Some extra command line options can be either specified without anything
> else on the command line (basically all the force connection options), but
> some other are only relevant when matched with a resolution (margin and
> interlace).
> 
> Let's add a switch to restrict if needed the available option set.
> 
> Fixes: e08ab74bd4c7 ("drm/modes: Rewrite the command line parser")
> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>

Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>

Best regards,
Jernej
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 11acc9581977..e5997f35b779 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1454,6 +1454,7 @@  static int drm_mode_parse_cmdline_refresh(const char *str, char **end_ptr,
 }
 
 static int drm_mode_parse_cmdline_extra(const char *str, int length,
+					bool freestanding,
 					const struct drm_connector *connector,
 					struct drm_cmdline_mode *mode)
 {
@@ -1462,9 +1463,15 @@  static int drm_mode_parse_cmdline_extra(const char *str, int length,
 	for (i = 0; i < length; i++) {
 		switch (str[i]) {
 		case 'i':
+			if (freestanding)
+				return -EINVAL;
+
 			mode->interlace = true;
 			break;
 		case 'm':
+			if (freestanding)
+				return -EINVAL;
+
 			mode->margins = true;
 			break;
 		case 'D':
@@ -1542,6 +1549,7 @@  static int drm_mode_parse_cmdline_res_mode(const char *str, unsigned int length,
 			if (extras) {
 				int ret = drm_mode_parse_cmdline_extra(end_ptr + i,
 								       1,
+								       false,
 								       connector,
 								       mode);
 				if (ret)
@@ -1811,7 +1819,7 @@  bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 	    extra_ptr != options_ptr) {
 		int len = strlen(name) - (extra_ptr - name);
 
-		ret = drm_mode_parse_cmdline_extra(extra_ptr, len,
+		ret = drm_mode_parse_cmdline_extra(extra_ptr, len, false,
 						   connector, mode);
 		if (ret)
 			return false;