aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2013-02-07 21:34:44 -0500
committerDave Airlie <airlied@redhat.com>2013-02-07 21:34:44 -0500
commited914f69f8f979ea2b664abc4f1437235cf3db35 (patch)
tree43d839d79d02f4a9415199a2db7a4b6cfeb281eb /include
parentbb0f78dd7ded88082b2430c43c65bc821c4ea360 (diff)
parentedb37a95c58147f89713e6c5cd220fa8fdfb4833 (diff)
Merge tag 'of_videomode_helper' of git://git.pengutronix.de/git/str/linux into drm-next
videomode helpers for of + devicetree stuff, required for new kms drivers (not the fbdev maintainer). * tag 'of_videomode_helper' of git://git.pengutronix.de/git/str/linux: drm_modes: add of_videomode helpers drm_modes: add videomode helpers fbmon: add of_videomode helpers fbmon: add videomode helpers video: add of helper for display timings/videomode video: add display_timing and videomode viafb: rename display_timing to via_display_timing
Diffstat (limited to 'include')
-rw-r--r--include/drm/drmP.h9
-rw-r--r--include/linux/fb.h8
-rw-r--r--include/video/display_timing.h124
-rw-r--r--include/video/of_display_timing.h20
-rw-r--r--include/video/of_videomode.h18
-rw-r--r--include/video/videomode.h48
6 files changed, 227 insertions, 0 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e74731c1a912..3aaa50d64451 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -85,6 +85,9 @@ struct module;
85struct drm_file; 85struct drm_file;
86struct drm_device; 86struct drm_device;
87 87
88struct device_node;
89struct videomode;
90
88#include <drm/drm_os_linux.h> 91#include <drm/drm_os_linux.h>
89#include <drm/drm_hashtab.h> 92#include <drm/drm_hashtab.h>
90#include <drm/drm_mm.h> 93#include <drm/drm_mm.h>
@@ -1469,6 +1472,12 @@ extern struct drm_display_mode *
1469drm_mode_create_from_cmdline_mode(struct drm_device *dev, 1472drm_mode_create_from_cmdline_mode(struct drm_device *dev,
1470 struct drm_cmdline_mode *cmd); 1473 struct drm_cmdline_mode *cmd);
1471 1474
1475extern int drm_display_mode_from_videomode(const struct videomode *vm,
1476 struct drm_display_mode *dmode);
1477extern int of_get_drm_display_mode(struct device_node *np,
1478 struct drm_display_mode *dmode,
1479 int index);
1480
1472/* Modesetting support */ 1481/* Modesetting support */
1473extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); 1482extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
1474extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); 1483extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index c7a95714b1fe..58b98606ac26 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -19,6 +19,8 @@ struct vm_area_struct;
19struct fb_info; 19struct fb_info;
20struct device; 20struct device;
21struct file; 21struct file;
22struct videomode;
23struct device_node;
22 24
23/* Definitions below are used in the parsed monitor specs */ 25/* Definitions below are used in the parsed monitor specs */
24#define FB_DPMS_ACTIVE_OFF 1 26#define FB_DPMS_ACTIVE_OFF 1
@@ -714,6 +716,12 @@ extern void fb_destroy_modedb(struct fb_videomode *modedb);
714extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb); 716extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb);
715extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter); 717extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);
716 718
719extern int of_get_fb_videomode(struct device_node *np,
720 struct fb_videomode *fb,
721 int index);
722extern int fb_videomode_from_videomode(const struct videomode *vm,
723 struct fb_videomode *fbmode);
724
717/* drivers/video/modedb.c */ 725/* drivers/video/modedb.c */
718#define VESA_MODEDB_SIZE 34 726#define VESA_MODEDB_SIZE 34
719extern void fb_var_to_videomode(struct fb_videomode *mode, 727extern void fb_var_to_videomode(struct fb_videomode *mode,
diff --git a/include/video/display_timing.h b/include/video/display_timing.h
new file mode 100644
index 000000000000..71e9a383a981
--- /dev/null
+++ b/include/video/display_timing.h
@@ -0,0 +1,124 @@
1/*
2 * Copyright 2012 Steffen Trumtrar <s.trumtrar@pengutronix.de>
3 *
4 * description of display timings
5 *
6 * This file is released under the GPLv2
7 */
8
9#ifndef __LINUX_DISPLAY_TIMING_H
10#define __LINUX_DISPLAY_TIMING_H
11
12#include <linux/bitops.h>
13#include <linux/types.h>
14
15/* VESA display monitor timing parameters */
16#define VESA_DMT_HSYNC_LOW BIT(0)
17#define VESA_DMT_HSYNC_HIGH BIT(1)
18#define VESA_DMT_VSYNC_LOW BIT(2)
19#define VESA_DMT_VSYNC_HIGH BIT(3)
20
21/* display specific flags */
22#define DISPLAY_FLAGS_DE_LOW BIT(0) /* data enable flag */
23#define DISPLAY_FLAGS_DE_HIGH BIT(1)
24#define DISPLAY_FLAGS_PIXDATA_POSEDGE BIT(2) /* drive data on pos. edge */
25#define DISPLAY_FLAGS_PIXDATA_NEGEDGE BIT(3) /* drive data on neg. edge */
26#define DISPLAY_FLAGS_INTERLACED BIT(4)
27#define DISPLAY_FLAGS_DOUBLESCAN BIT(5)
28
29/*
30 * A single signal can be specified via a range of minimal and maximal values
31 * with a typical value, that lies somewhere inbetween.
32 */
33struct timing_entry {
34 u32 min;
35 u32 typ;
36 u32 max;
37};
38
39enum timing_entry_index {
40 TE_MIN = 0,
41 TE_TYP = 1,
42 TE_MAX = 2,
43};
44
45/*
46 * Single "mode" entry. This describes one set of signal timings a display can
47 * have in one setting. This struct can later be converted to struct videomode
48 * (see include/video/videomode.h). As each timing_entry can be defined as a
49 * range, one struct display_timing may become multiple struct videomodes.
50 *
51 * Example: hsync active high, vsync active low
52 *
53 * Active Video
54 * Video ______________________XXXXXXXXXXXXXXXXXXXXXX_____________________
55 * |<- sync ->|<- back ->|<----- active ----->|<- front ->|<- sync..
56 * | | porch | | porch |
57 *
58 * HSync _|¯¯¯¯¯¯¯¯¯¯|___________________________________________|¯¯¯¯¯¯¯¯¯
59 *
60 * VSync ¯|__________|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|_________
61 */
62struct display_timing {
63 struct timing_entry pixelclock;
64
65 struct timing_entry hactive; /* hor. active video */
66 struct timing_entry hfront_porch; /* hor. front porch */
67 struct timing_entry hback_porch; /* hor. back porch */
68 struct timing_entry hsync_len; /* hor. sync len */
69
70 struct timing_entry vactive; /* ver. active video */
71 struct timing_entry vfront_porch; /* ver. front porch */
72 struct timing_entry vback_porch; /* ver. back porch */
73 struct timing_entry vsync_len; /* ver. sync len */
74
75 unsigned int dmt_flags; /* VESA DMT flags */
76 unsigned int data_flags; /* video data flags */
77};
78
79/*
80 * This describes all timing settings a display provides.
81 * The native_mode is the default setting for this display.
82 * Drivers that can handle multiple videomodes should work with this struct and
83 * convert each entry to the desired end result.
84 */
85struct display_timings {
86 unsigned int num_timings;
87 unsigned int native_mode;
88
89 struct display_timing **timings;
90};
91
92/* get value specified by index from struct timing_entry */
93static inline u32 display_timing_get_value(const struct timing_entry *te,
94 enum timing_entry_index index)
95{
96 switch (index) {
97 case TE_MIN:
98 return te->min;
99 break;
100 case TE_TYP:
101 return te->typ;
102 break;
103 case TE_MAX:
104 return te->max;
105 break;
106 default:
107 return te->typ;
108 }
109}
110
111/* get one entry from struct display_timings */
112static inline struct display_timing *display_timings_get(const struct
113 display_timings *disp,
114 unsigned int index)
115{
116 if (disp->num_timings > index)
117 return disp->timings[index];
118 else
119 return NULL;
120}
121
122void display_timings_release(struct display_timings *disp);
123
124#endif
diff --git a/include/video/of_display_timing.h b/include/video/of_display_timing.h
new file mode 100644
index 000000000000..8016eb727cf3
--- /dev/null
+++ b/