diff options
author | Thierry Reding <thierry.reding@avionic-design.de> | 2012-11-21 09:31:35 -0500 |
---|---|---|
committer | Thierry Reding <thierry.reding@avionic-design.de> | 2013-02-22 02:20:10 -0500 |
commit | 10a8512008655d5ce62f8c56323a6b5bd221c920 (patch) | |
tree | a61d19544363a8acbc0792e96e1fa5adac6dff7a | |
parent | f142d3bd556c5e82e9bb3d33d07d6708702ea4ce (diff) |
drm: Add HDMI infoframe helpers
Add a generic helper to fill in an HDMI AVI infoframe with data
extracted from a DRM display mode.
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/Kconfig | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_edid.c | 33 | ||||
-rw-r--r-- | include/drm/drm_edid.h | 6 |
3 files changed, 40 insertions, 0 deletions
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index f8dae851130c..1e82882da9de 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig | |||
@@ -7,6 +7,7 @@ | |||
7 | menuconfig DRM | 7 | menuconfig DRM |
8 | tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)" | 8 | tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)" |
9 | depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && MMU | 9 | depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && MMU |
10 | select HDMI | ||
10 | select I2C | 11 | select I2C |
11 | select I2C_ALGOBIT | 12 | select I2C_ALGOBIT |
12 | select DMA_SHARED_BUFFER | 13 | select DMA_SHARED_BUFFER |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 6995d2fa46cf..c194f4e680ad 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -29,6 +29,7 @@ | |||
29 | */ | 29 | */ |
30 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | #include <linux/hdmi.h> | ||
32 | #include <linux/i2c.h> | 33 | #include <linux/i2c.h> |
33 | #include <linux/module.h> | 34 | #include <linux/module.h> |
34 | #include <drm/drmP.h> | 35 | #include <drm/drmP.h> |
@@ -2856,3 +2857,35 @@ int drm_add_modes_noedid(struct drm_connector *connector, | |||
2856 | return num_modes; | 2857 | return num_modes; |
2857 | } | 2858 | } |
2858 | EXPORT_SYMBOL(drm_add_modes_noedid); | 2859 | EXPORT_SYMBOL(drm_add_modes_noedid); |
2860 | |||
2861 | /** | ||
2862 | * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with | ||
2863 | * data from a DRM display mode | ||
2864 | * @frame: HDMI AVI infoframe | ||
2865 | * @mode: DRM display mode | ||
2866 | * | ||
2867 | * Returns 0 on success or a negative error code on failure. | ||
2868 | */ | ||
2869 | int | ||
2870 | drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, | ||
2871 | const struct drm_display_mode *mode) | ||
2872 | { | ||
2873 | int err; | ||
2874 | |||
2875 | if (!frame || !mode) | ||
2876 | return -EINVAL; | ||
2877 | |||
2878 | err = hdmi_avi_infoframe_init(frame); | ||
2879 | if (err < 0) | ||
2880 | return err; | ||
2881 | |||
2882 | frame->video_code = drm_match_cea_mode(mode); | ||
2883 | if (!frame->video_code) | ||
2884 | return 0; | ||
2885 | |||
2886 | frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE; | ||
2887 | frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE; | ||
2888 | |||
2889 | return 0; | ||
2890 | } | ||
2891 | EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode); | ||
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 0cac551c5347..5da1b4ae7d84 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h | |||
@@ -247,6 +247,8 @@ struct edid { | |||
247 | struct drm_encoder; | 247 | struct drm_encoder; |
248 | struct drm_connector; | 248 | struct drm_connector; |
249 | struct drm_display_mode; | 249 | struct drm_display_mode; |
250 | struct hdmi_avi_infoframe; | ||
251 | |||
250 | void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid); | 252 | void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid); |
251 | int drm_av_sync_delay(struct drm_connector *connector, | 253 | int drm_av_sync_delay(struct drm_connector *connector, |
252 | struct drm_display_mode *mode); | 254 | struct drm_display_mode *mode); |
@@ -254,4 +256,8 @@ struct drm_connector *drm_select_eld(struct drm_encoder *encoder, | |||
254 | struct drm_display_mode *mode); | 256 | struct drm_display_mode *mode); |
255 | int drm_load_edid_firmware(struct drm_connector *connector); | 257 | int drm_load_edid_firmware(struct drm_connector *connector); |
256 | 258 | ||
259 | int | ||
260 | drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, | ||
261 | const struct drm_display_mode *mode); | ||
262 | |||
257 | #endif /* __DRM_EDID_H__ */ | 263 | #endif /* __DRM_EDID_H__ */ |