summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-01-18 01:13:03 +0400
committerAlejandro Mery <amery@geeks.cl>2013-01-24 20:28:56 +0400
commitcb0432d2bb6518f6565ff48fad1a65e52999b89d (patch)
tree55791983db37da87b800bbea221e55c3461c60d1
parente1b6a28ece14be0ec1cc4f00a306e11308e03cb3 (diff)
downloadlinux-sunxi-cb0432d2bb6518f6565ff48fad1a65e52999b89d.tar.xz
sunxi-disp: Use mode names like pal and ntsc for specifying tv-out modes
Some of the tv modes have the exact same dimensions but are different in things like how the color is encoded, so specifying <width>x<height> is not enough to uniquely identify them. Therefore this patch changes the screen0_output_mode value to be a mode-name like pal, ntsc or pal-nc when the screen0_output_type is set to tv. As an added bonus this patch also limits which modes from the tv_mode table can be selected, so that the user can no longer select hdmi only modes when using tv-out. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--drivers/video/sunxi/disp/dev_fb.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/drivers/video/sunxi/disp/dev_fb.c b/drivers/video/sunxi/disp/dev_fb.c
index 7dcafd8ff25b..96857e468065 100644
--- a/drivers/video/sunxi/disp/dev_fb.c
+++ b/drivers/video/sunxi/disp/dev_fb.c
@@ -43,7 +43,9 @@ MODULE_PARM_DESC(screen0_output_type, "0:none; 1:lcd; 2:tv; 3:hdmi; 4:vga");
static char *screen0_output_mode;
module_param(screen0_output_mode, charp, 0444);
MODULE_PARM_DESC(screen0_output_mode,
- "tv/hdmi: <width>x<height><i|p><24|50|60> vga: <width>x<height> "
+ "tv: pal, pal-svideo, ntsc, ntsc-svideo, pal-m, pal-m-svideo, pal-nc "
+ "or pal-nc-svideo "
+ "hdmi: <width>x<height><i|p><24|50|60> vga: <width>x<height> "
"hdmi modes can be prefixed with \"EDID:\". Then EDID will be used, "
"with the specified mode as a fallback, ie \"EDID:1280x720p60\".");
@@ -55,6 +57,17 @@ static char *screen1_output_mode;
module_param(screen1_output_mode, charp, 0444);
MODULE_PARM_DESC(screen1_output_mode, "See screen0_output_mode");
+static const char * const tv_mode_names[] = {
+ [DISP_TV_MOD_PAL] = "pal",
+ [DISP_TV_MOD_PAL_SVIDEO] = "pal-svideo",
+ [DISP_TV_MOD_NTSC] = "ntsc",
+ [DISP_TV_MOD_NTSC_SVIDEO] = "ntsc-svideo",
+ [DISP_TV_MOD_PAL_M] = "pal-m",
+ [DISP_TV_MOD_PAL_M_SVIDEO] = "pal-m-svideo",
+ [DISP_TV_MOD_PAL_NC] = "pal-nc",
+ [DISP_TV_MOD_PAL_NC_SVIDEO] = "pal-nc-svideo",
+};
+
static u32 tv_mode_to_frame_rate(u32 mode)
{
switch (mode) {
@@ -79,9 +92,19 @@ static u32 tv_mode_to_frame_rate(u32 mode)
static int parse_output_mode(char *mode, int type, int fallback, __bool *edid)
{
- u32 i, max, width, height, interlace, frame_rate;
+ u32 i, width, height, interlace, frame_rate;
char *ep;
+ if (type == DISP_OUTPUT_TYPE_TV) {
+ for (i = 0; i < ARRAY_SIZE(tv_mode_names); i++) {
+ if (tv_mode_names[i] &&
+ strcmp(mode, tv_mode_names[i]) == 0)
+ return i;
+ }
+ __wrn("Unsupported mode: %s, ignoring\n", mode);
+ return fallback;
+ }
+
if (type == DISP_OUTPUT_TYPE_HDMI && strncmp(mode, "EDID:", 5) == 0) {
*edid = true;
mode += 5;
@@ -94,7 +117,7 @@ static int parse_output_mode(char *mode, int type, int fallback, __bool *edid)
}
height = simple_strtol(ep + 1, &ep, 10);
- if (type == DISP_OUTPUT_TYPE_TV || type == DISP_OUTPUT_TYPE_HDMI) {
+ if (type == DISP_OUTPUT_TYPE_HDMI) {
if (*ep == 'i') {
interlace = 1;
} else if (*ep == 'p') {
@@ -105,9 +128,7 @@ static int parse_output_mode(char *mode, int type, int fallback, __bool *edid)
}
frame_rate = simple_strtol(ep + 1, &ep, 10);
- max = (type == DISP_OUTPUT_TYPE_TV) ?
- DISP_TV_MOD_1080P_24HZ_3D_FP : DISP_TV_MODE_NUM;
- for (i = 0; i < max; i++) {
+ for (i = 0; i < DISP_TV_MODE_NUM; i++) {
if (tv_mode_to_width(i) == width &&
tv_mode_to_height(i) == height &&
Disp_get_screen_scan_mode(i) == interlace &&