Commit 6120611a authored by Harry Wentland's avatar Harry Wentland Committed by Alex Deucher

drm/connector: Pull out common create_colorspace_property code

Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Reviewed-by: default avatarSebastian Wick <sebastian.wick@redhat.com>
Reviewed-by: default avatarJoshua Ashton <joshua@froggi.es>
Reviewed-by: default avatarSimon Ser <contact@emersion.fr>

Cc: Pekka Paalanen <ppaalanen@gmail.com>
Cc: Sebastian Wick <sebastian.wick@redhat.com>
Cc: Vitaly.Prosyak@amd.com
Cc: Uma Shankar <uma.shankar@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Joshua Ashton <joshua@froggi.es>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Simon Ser <contact@emersion.fr>
Cc: Melissa Wen <mwen@igalia.com>
Cc: dri-devel@lists.freedesktop.org
Cc: amd-gfx@lists.freedesktop.org
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f96c61fe
...@@ -2135,6 +2135,28 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property); ...@@ -2135,6 +2135,28 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
* drm_mode_create_dp_colorspace_property() is used for DP connector. * drm_mode_create_dp_colorspace_property() is used for DP connector.
*/ */
static int drm_mode_create_colorspace_property(struct drm_connector *connector,
const struct drm_prop_enum_list *colorspaces,
int size)
{
struct drm_device *dev = connector->dev;
if (connector->colorspace_property)
return 0;
if (!colorspaces)
return 0;
connector->colorspace_property =
drm_property_create_enum(dev, DRM_MODE_PROP_ENUM, "Colorspace",
colorspaces,
size);
if (!connector->colorspace_property)
return -ENOMEM;
return 0;
}
/** /**
* drm_mode_create_hdmi_colorspace_property - create hdmi colorspace property * drm_mode_create_hdmi_colorspace_property - create hdmi colorspace property
* @connector: connector to create the Colorspace property on. * @connector: connector to create the Colorspace property on.
...@@ -2147,20 +2169,9 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property); ...@@ -2147,20 +2169,9 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
*/ */
int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector) int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; return drm_mode_create_colorspace_property(connector,
if (connector->colorspace_property)
return 0;
connector->colorspace_property =
drm_property_create_enum(dev, DRM_MODE_PROP_ENUM, "Colorspace",
hdmi_colorspaces, hdmi_colorspaces,
ARRAY_SIZE(hdmi_colorspaces)); ARRAY_SIZE(hdmi_colorspaces));
if (!connector->colorspace_property)
return -ENOMEM;
return 0;
} }
EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property); EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property);
...@@ -2176,20 +2187,9 @@ EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property); ...@@ -2176,20 +2187,9 @@ EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property);
*/ */
int drm_mode_create_dp_colorspace_property(struct drm_connector *connector) int drm_mode_create_dp_colorspace_property(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; return drm_mode_create_colorspace_property(connector,
if (connector->colorspace_property)
return 0;
connector->colorspace_property =
drm_property_create_enum(dev, DRM_MODE_PROP_ENUM, "Colorspace",
dp_colorspaces, dp_colorspaces,
ARRAY_SIZE(dp_colorspaces)); ARRAY_SIZE(dp_colorspaces));
if (!connector->colorspace_property)
return -ENOMEM;
return 0;
} }
EXPORT_SYMBOL(drm_mode_create_dp_colorspace_property); EXPORT_SYMBOL(drm_mode_create_dp_colorspace_property);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment