mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
drm/connector: hdmi: Add support for output format
Just like BPC, we'll add support for automatic selection of the output format for HDMI connectors. Let's add the needed defaults and fields for now. Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20240527-kms-hdmi-connector-state-v15-7-c5af16c3aae2@kernel.org Signed-off-by: Maxime Ripard <mripard@kernel.org>
This commit is contained in:
@@ -459,6 +459,7 @@ EXPORT_SYMBOL(drmm_connector_init);
|
||||
* @funcs: callbacks for this connector
|
||||
* @connector_type: user visible type of the connector
|
||||
* @ddc: optional pointer to the associated ddc adapter
|
||||
* @supported_formats: Bitmask of @hdmi_colorspace listing supported output formats
|
||||
* @max_bpc: Maximum bits per char the HDMI connector supports
|
||||
*
|
||||
* Initialises a preallocated HDMI connector. Connectors can be
|
||||
@@ -477,6 +478,7 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
|
||||
const struct drm_connector_funcs *funcs,
|
||||
int connector_type,
|
||||
struct i2c_adapter *ddc,
|
||||
unsigned long supported_formats,
|
||||
unsigned int max_bpc)
|
||||
{
|
||||
int ret;
|
||||
@@ -485,6 +487,9 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
|
||||
connector_type == DRM_MODE_CONNECTOR_HDMIB))
|
||||
return -EINVAL;
|
||||
|
||||
if (!supported_formats || !(supported_formats & BIT(HDMI_COLORSPACE_RGB)))
|
||||
return -EINVAL;
|
||||
|
||||
if (!(max_bpc == 8 || max_bpc == 10 || max_bpc == 12))
|
||||
return -EINVAL;
|
||||
|
||||
@@ -492,6 +497,8 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
connector->hdmi.supported_formats = supported_formats;
|
||||
|
||||
/*
|
||||
* drm_connector_attach_max_bpc_property() requires the
|
||||
* connector to have a state.
|
||||
@@ -1201,6 +1208,30 @@ static const u32 dp_colorspaces =
|
||||
BIT(DRM_MODE_COLORIMETRY_BT2020_CYCC) |
|
||||
BIT(DRM_MODE_COLORIMETRY_BT2020_YCC);
|
||||
|
||||
static const char * const output_format_str[] = {
|
||||
[HDMI_COLORSPACE_RGB] = "RGB",
|
||||
[HDMI_COLORSPACE_YUV420] = "YUV 4:2:0",
|
||||
[HDMI_COLORSPACE_YUV422] = "YUV 4:2:2",
|
||||
[HDMI_COLORSPACE_YUV444] = "YUV 4:4:4",
|
||||
};
|
||||
|
||||
/*
|
||||
* drm_hdmi_connector_get_output_format_name() - Return a string for HDMI connector output format
|
||||
* @fmt: Output format to compute name of
|
||||
*
|
||||
* Returns: the name of the output format, or NULL if the type is not
|
||||
* valid.
|
||||
*/
|
||||
const char *
|
||||
drm_hdmi_connector_get_output_format_name(enum hdmi_colorspace fmt)
|
||||
{
|
||||
if (fmt >= ARRAY_SIZE(output_format_str))
|
||||
return NULL;
|
||||
|
||||
return output_format_str[fmt];
|
||||
}
|
||||
EXPORT_SYMBOL(drm_hdmi_connector_get_output_format_name);
|
||||
|
||||
/**
|
||||
* DOC: standard connector properties
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user