Commit 325d0ab3 authored by Maxime Ripard's avatar Maxime Ripard Committed by Maxime Ripard

drm/modes: Add a switch to differentiate free standing options

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: e08ab74b ("drm/modes: Rewrite the command line parser")
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Tested-by: default avatarThomas Graichen <thomas.graichen@gmail.com>
Reviewed-by: default avatarJernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: default avatarMaxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190827115850.25731-1-mripard@kernel.org
parent 807f6c84
...@@ -1454,6 +1454,7 @@ static int drm_mode_parse_cmdline_refresh(const char *str, char **end_ptr, ...@@ -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, static int drm_mode_parse_cmdline_extra(const char *str, int length,
bool freestanding,
const struct drm_connector *connector, const struct drm_connector *connector,
struct drm_cmdline_mode *mode) struct drm_cmdline_mode *mode)
{ {
...@@ -1462,9 +1463,15 @@ static int drm_mode_parse_cmdline_extra(const char *str, int length, ...@@ -1462,9 +1463,15 @@ static int drm_mode_parse_cmdline_extra(const char *str, int length,
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
switch (str[i]) { switch (str[i]) {
case 'i': case 'i':
if (freestanding)
return -EINVAL;
mode->interlace = true; mode->interlace = true;
break; break;
case 'm': case 'm':
if (freestanding)
return -EINVAL;
mode->margins = true; mode->margins = true;
break; break;
case 'D': case 'D':
...@@ -1542,6 +1549,7 @@ static int drm_mode_parse_cmdline_res_mode(const char *str, unsigned int length, ...@@ -1542,6 +1549,7 @@ static int drm_mode_parse_cmdline_res_mode(const char *str, unsigned int length,
if (extras) { if (extras) {
int ret = drm_mode_parse_cmdline_extra(end_ptr + i, int ret = drm_mode_parse_cmdline_extra(end_ptr + i,
1, 1,
false,
connector, connector,
mode); mode);
if (ret) if (ret)
...@@ -1811,7 +1819,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, ...@@ -1811,7 +1819,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
extra_ptr != options_ptr) { extra_ptr != options_ptr) {
int len = strlen(name) - (extra_ptr - name); 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); connector, mode);
if (ret) if (ret)
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment