diff options
| author | Dave Airlie <airlied@redhat.com> | 2013-02-07 21:34:44 -0500 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2013-02-07 21:34:44 -0500 |
| commit | ed914f69f8f979ea2b664abc4f1437235cf3db35 (patch) | |
| tree | 43d839d79d02f4a9415199a2db7a4b6cfeb281eb | |
| parent | bb0f78dd7ded88082b2430c43c65bc821c4ea360 (diff) | |
| parent | edb37a95c58147f89713e6c5cd220fa8fdfb4833 (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
| -rw-r--r-- | Documentation/devicetree/bindings/video/display-timing.txt | 109 | ||||
| -rw-r--r-- | drivers/gpu/drm/drm_modes.c | 70 | ||||
| -rw-r--r-- | drivers/video/Kconfig | 21 | ||||
| -rw-r--r-- | drivers/video/Makefile | 4 | ||||
| -rw-r--r-- | drivers/video/display_timing.c | 24 | ||||
| -rw-r--r-- | drivers/video/fbmon.c | 94 | ||||
| -rw-r--r-- | drivers/video/of_display_timing.c | 239 | ||||
| -rw-r--r-- | drivers/video/of_videomode.c | 54 | ||||
| -rw-r--r-- | drivers/video/via/hw.c | 6 | ||||
| -rw-r--r-- | drivers/video/via/hw.h | 2 | ||||
| -rw-r--r-- | drivers/video/via/lcd.c | 2 | ||||
| -rw-r--r-- | drivers/video/via/share.h | 2 | ||||
| -rw-r--r-- | drivers/video/via/via_modesetting.c | 8 | ||||
| -rw-r--r-- | drivers/video/via/via_modesetting.h | 6 | ||||
| -rw-r--r-- | drivers/video/videomode.c | 39 | ||||
| -rw-r--r-- | include/drm/drmP.h | 9 | ||||
| -rw-r--r-- | include/linux/fb.h | 8 | ||||
| -rw-r--r-- | include/video/display_timing.h | 124 | ||||
| -rw-r--r-- | include/video/of_display_timing.h | 20 | ||||
| -rw-r--r-- | include/video/of_videomode.h | 18 | ||||
| -rw-r--r-- | include/video/videomode.h | 48 |
21 files changed, 894 insertions, 13 deletions
diff --git a/Documentation/devicetree/bindings/video/display-timing.txt b/Documentation/devicetree/bindings/video/display-timing.txt new file mode 100644 index 000000000000..150038552bc3 --- /dev/null +++ b/Documentation/devicetree/bindings/video/display-timing.txt | |||
| @@ -0,0 +1,109 @@ | |||
| 1 | display-timing bindings | ||
| 2 | ======================= | ||
| 3 | |||
| 4 | display-timings node | ||
| 5 | -------------------- | ||
| 6 | |||
| 7 | required properties: | ||
| 8 | - none | ||
| 9 | |||
| 10 | optional properties: | ||
| 11 | - native-mode: The native mode for the display, in case multiple modes are | ||
| 12 | provided. When omitted, assume the first node is the native. | ||
| 13 | |||
| 14 | timing subnode | ||
| 15 | -------------- | ||
| 16 | |||
| 17 | required properties: | ||
| 18 | - hactive, vactive: display resolution | ||
| 19 | - hfront-porch, hback-porch, hsync-len: horizontal display timing parameters | ||
| 20 | in pixels | ||
| 21 | vfront-porch, vback-porch, vsync-len: vertical display timing parameters in | ||
| 22 | lines | ||
| 23 | - clock-frequency: display clock in Hz | ||
| 24 | |||
| 25 | optional properties: | ||
| 26 | - hsync-active: hsync pulse is active low/high/ignored | ||
| 27 | - vsync-active: vsync pulse is active low/high/ignored | ||
| 28 | - de-active: data-enable pulse is active low/high/ignored | ||
| 29 | - pixelclk-active: with | ||
| 30 | - active high = drive pixel data on rising edge/ | ||
| 31 | sample data on falling edge | ||
| 32 | - active low = drive pixel data on falling edge/ | ||
| 33 | sample data on rising edge | ||
| 34 | - ignored = ignored | ||
| 35 | - interlaced (bool): boolean to enable interlaced mode | ||
| 36 | - doublescan (bool): boolean to enable doublescan mode | ||
| 37 | |||
| 38 | All the optional properties that are not bool follow the following logic: | ||
| 39 | <1>: high active | ||
| 40 | <0>: low active | ||
| 41 | omitted: not used on hardware | ||
| 42 | |||
| 43 | There are different ways of describing the capabilities of a display. The | ||
| 44 | devicetree representation corresponds to the one commonly found in datasheets | ||
| 45 | for displays. If a display supports multiple signal timings, the native-mode | ||
| 46 | can be specified. | ||
| 47 | |||
| 48 | The parameters are defined as: | ||
| 49 | |||
| 50 | +----------+-------------------------------------+----------+-------+ | ||
| 51 | | | ↑ | | | | ||
| 52 | | | |vback_porch | | | | ||
| 53 | | | ↓ | | | | ||
| 54 | +----------#######################################----------+-------+ | ||
| 55 | | # ↑ # | | | ||
| 56 | | # | # | | | ||
| 57 | | hback # | # hfront | hsync | | ||
| 58 | | porch # | hactive # porch | len | | ||
| 59 | |<-------->#<-------+--------------------------->#<-------->|<----->| | ||
| 60 | | # | # | | | ||
| 61 | | # |vactive # | | | ||
| 62 | | # | # | | | ||
| 63 | | # ↓ # | | | ||
| 64 | +----------#######################################----------+-------+ | ||
| 65 | | | ↑ | | | | ||
| 66 | | | |vfront_porch | | | | ||
| 67 | | | ↓ | | | | ||
| 68 | +----------+-------------------------------------+----------+-------+ | ||
| 69 | | | ↑ | | | | ||
| 70 | | | |vsync_len | | | | ||
| 71 | | | ↓ | | | | ||
| 72 | +----------+-------------------------------------+----------+-------+ | ||
| 73 | |||
| 74 | Example: | ||
| 75 | |||
| 76 | display-timings { | ||
| 77 | native-mode = <&timing0>; | ||
| 78 | timing0: 1080p24 { | ||
| 79 | /* 1920x1080p24 */ | ||
| 80 | clock-frequency = <52000000>; | ||
| 81 | hactive = <1920>; | ||
| 82 | vactive = <1080>; | ||
| 83 | hfront-porch = <25>; | ||
| 84 | hback-porch = <25>; | ||
| 85 | hsync-len = <25>; | ||
| 86 | vback-porch = <2>; | ||
| 87 | vfront-porch = <2>; | ||
| 88 | vsync-len = <2>; | ||
| 89 | hsync-active = <1>; | ||
| 90 | }; | ||
| 91 | }; | ||
| 92 | |||
| 93 | Every required property also supports the use of ranges, so the commonly used | ||
| 94 | datasheet description with minimum, typical and maximum values can be used. | ||
| 95 | |||
| 96 | Example: | ||
| 97 | |||
| 98 | timing1: timing { | ||
| 99 | /* 1920x1080p24 */ | ||
| 100 | clock-frequency = <148500000>; | ||
| 101 | hactive = <1920>; | ||
| 102 | vactive = <1080>; | ||
| 103 | hsync-len = <0 44 60>; | ||
| 104 | hfront-porch = <80 88 95>; | ||
| 105 | hback-porch = <100 148 160>; | ||
| 106 | vfront-porch = <0 4 6>; | ||
| 107 | vback-porch = <0 36 50>; | ||
| 108 | vsync-len = <0 5 6>; | ||
| 109 | }; | ||
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index d8da30e90db5..04fa6f1808d1 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c | |||
| @@ -35,6 +35,8 @@ | |||
| 35 | #include <linux/export.h> | 35 | #include <linux/export.h> |
| 36 | #include <drm/drmP.h> | 36 | #include <drm/drmP.h> |
| 37 | #include <drm/drm_crtc.h> | 37 | #include <drm/drm_crtc.h> |
| 38 | #include <video/of_videomode.h> | ||
| 39 | #include <video/videomode.h> | ||
| 38 | 40 | ||
| 39 | /** | 41 | /** |
| 40 | * drm_mode_debug_printmodeline - debug print a mode | 42 | * drm_mode_debug_printmodeline - debug print a mode |
| @@ -504,6 +506,74 @@ drm_gtf_mode(struct drm_device *dev, int hdisplay, int vdisplay, int vrefresh, | |||
| 504 | } | 506 | } |
| 505 | EXPORT_SYMBOL(drm_gtf_mode); | 507 | EXPORT_SYMBOL(drm_gtf_mode); |
| 506 | 508 | ||
| 509 | #if IS_ENABLED(CONFIG_VIDEOMODE) | ||
| 510 | int drm_display_mode_from_videomode(const struct videomode *vm, | ||
| 511 | struct drm_display_mode *dmode) | ||
| 512 | { | ||
| 513 | dmode->hdisplay = vm->hactive; | ||
| 514 | dmode->hsync_start = dmode->hdisplay + vm->hfront_porch; | ||
| 515 | dmode->hsync_end = dmode->hsync_start + vm->hsync_len; | ||
| 516 | dmode->htotal = dmode->hsync_end + vm->hback_porch; | ||
| 517 | |||
| 518 | dmode->vdisplay = vm->vactive; | ||
| 519 | dmode->vsync_start = dmode->vdisplay + vm->vfront_porch; | ||
| 520 | dmode->vsync_end = dmode->vsync_start + vm->vsync_len; | ||
| 521 | dmode->vtotal = dmode->vsync_end + vm->vback_porch; | ||
| 522 | |||
| 523 | dmode->clock = vm->pixelclock / 1000; | ||
| 524 | |||
| 525 | dmode->flags = 0; | ||
| 526 | if (vm->dmt_flags & | ||
