Commit a1e6ad66 authored by Imre Deak's avatar Imre Deak Committed by Jani Nikula

drm/i915: factor out ddi_get_encoder_port

In the next patch we'll need to get at both the encoder's intel_digital_port
object - which maybe NULL for a CRT - and it's port, so factor out this
functionality.

No functional change.
Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Reviewed-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 052f62f7
...@@ -210,29 +210,39 @@ static const struct bxt_ddi_buf_trans bxt_ddi_translations_hdmi[] = { ...@@ -210,29 +210,39 @@ static const struct bxt_ddi_buf_trans bxt_ddi_translations_hdmi[] = {
{ 154, 0x9A, 1, 128, true }, /* 9: 1200 0 */ { 154, 0x9A, 1, 128, true }, /* 9: 1200 0 */
}; };
enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder) static void ddi_get_encoder_port(struct intel_encoder *intel_encoder,
struct intel_digital_port **dig_port,
enum port *port)
{ {
struct drm_encoder *encoder = &intel_encoder->base; struct drm_encoder *encoder = &intel_encoder->base;
int type = intel_encoder->type; int type = intel_encoder->type;
if (type == INTEL_OUTPUT_DP_MST) { if (type == INTEL_OUTPUT_DP_MST) {
struct intel_digital_port *intel_dig_port = enc_to_mst(encoder)->primary; *dig_port = enc_to_mst(encoder)->primary;
return intel_dig_port->port; *port = (*dig_port)->port;
} else if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP || } else if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP ||
type == INTEL_OUTPUT_HDMI || type == INTEL_OUTPUT_UNKNOWN) { type == INTEL_OUTPUT_HDMI || type == INTEL_OUTPUT_UNKNOWN) {
struct intel_digital_port *intel_dig_port = *dig_port = enc_to_dig_port(encoder);
enc_to_dig_port(encoder); *port = (*dig_port)->port;
return intel_dig_port->port;
} else if (type == INTEL_OUTPUT_ANALOG) { } else if (type == INTEL_OUTPUT_ANALOG) {
return PORT_E; *dig_port = NULL;
*port = PORT_E;
} else { } else {
DRM_ERROR("Invalid DDI encoder type %d\n", type); DRM_ERROR("Invalid DDI encoder type %d\n", type);
BUG(); BUG();
} }
} }
enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
{
struct intel_digital_port *dig_port;
enum port port;
ddi_get_encoder_port(intel_encoder, &dig_port, &port);
return port;
}
static bool static bool
intel_dig_port_supports_hdmi(const struct intel_digital_port *intel_dig_port) intel_dig_port_supports_hdmi(const struct intel_digital_port *intel_dig_port)
{ {
......
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