summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_modes.c
diff options
context:
space:
mode:
authorMaxime Ripard <maxime@cerno.tech>2022-11-14 16:00:30 +0300
committerMaxime Ripard <maxime@cerno.tech>2022-11-15 12:10:14 +0300
commit00dcc4a2d560c57543ee36b94a864256f99cac32 (patch)
treebf10c1dfb2ba386cf91b4954293e82594256c847 /drivers/gpu/drm/drm_modes.c
parenta7ab155397dd959785b9fdd175b41c3e58114255 (diff)
downloadlinux-00dcc4a2d560c57543ee36b94a864256f99cac32.tar.xz
drm/modes: Fill drm_cmdline mode from named modes
The current code to deal with named modes will only set the mode name, and then it's up to drivers to try to match that name to whatever mode or configuration they see fit. The plan is to remove that need and move the named mode handling out of drivers and into the core, and only rely on modes and properties. Let's start by properly filling drm_cmdline_mode from a named mode. Reviewed-by: Noralf Trønnes <noralf@tronnes.org> Tested-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com> Link: https://lore.kernel.org/r/20220728-rpi-analog-tv-properties-v9-11-24b168e5bcd5@cerno.tech Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Diffstat (limited to 'drivers/gpu/drm/drm_modes.c')
-rw-r--r--drivers/gpu/drm/drm_modes.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index f404f3c782da..17b7829ca385 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1752,11 +1752,22 @@ static int drm_mode_parse_cmdline_options(const char *str,
struct drm_named_mode {
const char *name;
+ unsigned int xres;
+ unsigned int yres;
+ unsigned int flags;
};
+#define NAMED_MODE(_name, _x, _y, _flags) \
+ { \
+ .name = _name, \
+ .xres = _x, \
+ .yres = _y, \
+ .flags = _flags, \
+ }
+
static const struct drm_named_mode drm_named_modes[] = {
- { "NTSC", },
- { "PAL", },
+ NAMED_MODE("NTSC", 720, 480, DRM_MODE_FLAG_INTERLACE),
+ NAMED_MODE("PAL", 720, 576, DRM_MODE_FLAG_INTERLACE),
};
static int drm_mode_parse_cmdline_named_mode(const char *name,
@@ -1797,6 +1808,9 @@ static int drm_mode_parse_cmdline_named_mode(const char *name,
continue;
strcpy(cmdline_mode->name, mode->name);
+ cmdline_mode->xres = mode->xres;
+ cmdline_mode->yres = mode->yres;
+ cmdline_mode->interlace = !!(mode->flags & DRM_MODE_FLAG_INTERLACE);
cmdline_mode->specified = true;
return 1;