summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@bootlin.com>2019-08-27 07:58:47 -0400
committerMaxime Ripard <mripard@kernel.org>2019-08-30 04:18:15 -0400
commit325d0ab3a1d1ad8b8c4f9f03fd866e55b0e24254 (patch)
tree13dcc7268b51c68ab00b294d261848f466cac21f
parent807f6c8472da716e29744e1fa35480b08af3e4bc (diff)
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: 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> Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net> Signed-off-by: Maxime Ripard <mripard@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20190827115850.25731-1-mripard@kernel.org
-rw-r--r--drivers/gpu/drm/drm_modes.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index b0369e690f36..3d10425f6b18 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,
1454} 1454}
1455 1455
1456static int drm_mode_parse_cmdline_extra(const char *str, int length, 1456static int drm_mode_parse_cmdline_extra(const char *str, int length,
1457 bool freestanding,
1457 const struct drm_connector *connector, 1458 const struct drm_connector *connector,
1458 struct drm_cmdline_mode *mode) 1459 struct drm_cmdline_mode *mode)
1459{ 1460{
@@ -1462,9 +1463,15 @@ static int drm_mode_parse_cmdline_extra(const char *str, int length,
1462 for (i = 0; i < length; i++) { 1463 for (i = 0; i < length; i++) {
1463 switch (str[i]) { 1464 switch (str[i]) {
1464 case 'i': 1465 case 'i':
1466 if (freestanding)
1467 return -EINVAL;
1468
1465 mode->interlace = true; 1469 mode->interlace = true;
1466 break; 1470 break;
1467 case 'm': 1471 case 'm':
1472 if (freestanding)
1473 return -EINVAL;
1474
1468 mode->margins = true; 1475 mode->margins = true;
1469 break; 1476 break;
1470 case 'D': 1477 case 'D':
@@ -1542,6 +1549,7 @@ static int drm_mode_parse_cmdline_res_mode(const char *str, unsigned int length,
1542 if (extras) { 1549 if (extras) {
1543 int ret = drm_mode_parse_cmdline_extra(end_ptr + i, 1550 int ret = drm_mode_parse_cmdline_extra(end_ptr + i,
1544 1, 1551 1,
1552 false,
1545 connector, 1553 connector,
1546 mode); 1554 mode);
1547 if (ret) 1555 if (ret)
@@ -1811,7 +1819,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
1811 extra_ptr != options_ptr) { 1819 extra_ptr != options_ptr) {
1812 int len = strlen(name) - (extra_ptr - name); 1820 int len = strlen(name) - (extra_ptr - name);
1813 1821
1814 ret = drm_mode_parse_cmdline_extra(extra_ptr, len, 1822 ret = drm_mode_parse_cmdline_extra(extra_ptr, len, false,
1815 connector, mode); 1823 connector, mode);
1816 if (ret) 1824 if (ret)
1817 return false; 1825 return false;