Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Add a helper to forge HDMI vendor infoframes

This can then be used by DRM drivers to setup their vendor infoframes.

v2: Fix hmdi typo (Simon Farnsworth)
v3: Adapt to the hdmi_vendor_infoframe rename

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@gmail.com>

authored by

Lespiau, Damien and committed by
Dave Airlie
83dd0008 ae84b900

+40
+36
drivers/gpu/drm/drm_edid.c
··· 3263 3263 return 0; 3264 3264 } 3265 3265 EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode); 3266 + 3267 + /** 3268 + * drm_hdmi_vendor_infoframe_from_display_mode() - fill an HDMI infoframe with 3269 + * data from a DRM display mode 3270 + * @frame: HDMI vendor infoframe 3271 + * @mode: DRM display mode 3272 + * 3273 + * Note that there's is a need to send HDMI vendor infoframes only when using a 3274 + * 4k or stereoscopic 3D mode. So when giving any other mode as input this 3275 + * function will return -EINVAL, error that can be safely ignored. 3276 + * 3277 + * Returns 0 on success or a negative error code on failure. 3278 + */ 3279 + int 3280 + drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, 3281 + const struct drm_display_mode *mode) 3282 + { 3283 + int err; 3284 + u8 vic; 3285 + 3286 + if (!frame || !mode) 3287 + return -EINVAL; 3288 + 3289 + vic = drm_match_hdmi_mode(mode); 3290 + if (!vic) 3291 + return -EINVAL; 3292 + 3293 + err = hdmi_vendor_infoframe_init(frame); 3294 + if (err < 0) 3295 + return err; 3296 + 3297 + frame->vic = vic; 3298 + 3299 + return 0; 3300 + } 3301 + EXPORT_SYMBOL(drm_hdmi_vendor_infoframe_from_display_mode);
+4
include/drm/drm_edid.h
··· 256 256 struct drm_connector; 257 257 struct drm_display_mode; 258 258 struct hdmi_avi_infoframe; 259 + struct hdmi_vendor_infoframe; 259 260 260 261 void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid); 261 262 int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads); ··· 269 268 int 270 269 drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, 271 270 const struct drm_display_mode *mode); 271 + int 272 + drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, 273 + const struct drm_display_mode *mode); 272 274 273 275 #endif /* __DRM_EDID_H__ */