[Intel-gfx] [RFC 02/12] drm/i915/config: Introduce intel_output_name
Jani Nikula
jani.nikula at linux.intel.com
Fri Feb 13 00:12:07 PST 2015
On Fri, 13 Feb 2015, Bob Paauwe <bob.j.paauwe at intel.com> wrote:
> Human readable name for each output type to correspond with names
> used in the ACPI property tables.
Could you not use drm_connector and drm_encoder type and name fields?
BR,
Jani.
>
> Signed-off-by: Bob Paauwe <bob.j.paauwe at intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 57 ++++++++++++++++++++++++++++++++++++
> drivers/gpu/drm/i915/intel_drv.h | 1 +
> 2 files changed, 58 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 3b0fe9f..de6de83 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -12440,6 +12440,63 @@ static bool intel_crt_present(struct drm_device *dev)
> return true;
> }
>
> +/*
> + * Provide a name for the various outputs.
> + */
> +const char *intel_output_name(struct intel_connector *connector)
> +{
> + int output;
> + static const char *names[] = {
> + [INTEL_OUTPUT_UNUSED] = "Unused",
> + [INTEL_OUTPUT_ANALOG] = "Analog",
> + [INTEL_OUTPUT_DVO] = "DVO",
> + [INTEL_OUTPUT_SDVO] = "SDVO",
> + [INTEL_OUTPUT_LVDS] = "LVDS",
> + [INTEL_OUTPUT_TVOUT] = "TV",
> + [INTEL_OUTPUT_HDMI] = "HDMI",
> + [INTEL_OUTPUT_DISPLAYPORT] = "DisplayPort",
> + [INTEL_OUTPUT_EDP] = "eDP",
> + [INTEL_OUTPUT_DSI] = "DSI",
> + [INTEL_OUTPUT_UNKNOWN] = "Unknown",
> + };
> + static const char *name_ex[] = {
> + [0] = "HDMI_A",
> + [1] = "HDMI_B",
> + [2] = "HDMI_C",
> + [3] = "HDMI_D",
> + [4] = "DisplayPort_A",
> + [5] = "DisplayPort_B",
> + [6] = "DisplayPort_C",
> + [7] = "DisplayPort_D",
> + [8] = "eDP_A",
> + [9] = "eDP_B",
> + [10] = "eDP_C",
> + [11] = "eDP_D",
> + };
> +
> + if (!connector || !connector->encoder)
> + return "Unknown";
> +
> + switch (connector->encoder->type) {
> + case INTEL_OUTPUT_HDMI:
> + case INTEL_OUTPUT_DISPLAYPORT:
> + case INTEL_OUTPUT_EDP:
> + output = ((connector->encoder->type - INTEL_OUTPUT_HDMI) * 4) +
> + enc_to_dig_port(&connector->encoder->base)->port;
> +
> + if (output < 0 || output >= ARRAY_SIZE(name_ex))
> + return "Invalid";
> +
> + return name_ex[output];
> + default:
> + if (output < 0 || output >= ARRAY_SIZE(names) || !names[output])
> + return "Invalid";
> +
> + return names[output];
> + }
> +}
> +
> +
> static void intel_setup_outputs(struct drm_device *dev)
> {
> struct drm_i915_private *dev_priv = dev->dev_private;
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index aefd95e..4c81ee9 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -893,6 +893,7 @@ void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);
>
> /* intel_display.c */
> extern const struct drm_plane_funcs intel_plane_funcs;
> +const char *intel_output_name(struct intel_connector *intel_connector);
> bool intel_has_pending_fb_unpin(struct drm_device *dev);
> int intel_pch_rawclk(struct drm_device *dev);
> void intel_mark_busy(struct drm_device *dev);
> --
> 2.1.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Jani Nikula, Intel Open Source Technology Center
More information about the Intel-gfx
mailing list