[Intel-gfx] [PATCH 2/2] drm/i915: Introduce intel_hpd_pin function.
Rodrigo Vivi
rodrigo.vivi at gmail.com
Fri Aug 11 18:55:22 UTC 2017
merged to dinq. thanks for the reviews and ideas
On Fri, Aug 11, 2017 at 11:26 AM, Rodrigo Vivi <rodrigo.vivi at intel.com> wrote:
> The idea is to have an unique place to decide the pin-port
> per platform.
>
> So let's create this function now without any functional
> change. Just adding together code from hdmi and dp together.
>
> v2: Add missing pin for port A.
> v3: Fix typo on subject.
> Avoid behaviour change so add WARN_ON and return
> if port A on HDMI. (by DK).
>
> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
> Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 1 +
> drivers/gpu/drm/i915/intel_dp.c | 8 ++------
> drivers/gpu/drm/i915/intel_hdmi.c | 18 ++----------------
> drivers/gpu/drm/i915/intel_hotplug.c | 26 ++++++++++++++++++++++++++
> 4 files changed, 31 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 68ec47b378ac..ba59e64eb378 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -3195,6 +3195,7 @@ void intel_hpd_init(struct drm_i915_private *dev_priv);
> void intel_hpd_init_work(struct drm_i915_private *dev_priv);
> void intel_hpd_cancel_work(struct drm_i915_private *dev_priv);
> enum port intel_hpd_pin_to_port(enum hpd_pin pin);
> +enum hpd_pin intel_hpd_pin(enum port port);
> bool intel_hpd_disable(struct drm_i915_private *dev_priv, enum hpd_pin pin);
> void intel_hpd_enable(struct drm_i915_private *dev_priv, enum hpd_pin pin);
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index eeede2037931..0e4b40663067 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -5904,26 +5904,22 @@ intel_dp_init_connector_port_info(struct intel_digital_port *intel_dig_port)
> struct intel_encoder *encoder = &intel_dig_port->base;
> struct intel_dp *intel_dp = &intel_dig_port->dp;
>
> + encoder->hpd_pin = intel_hpd_pin(intel_dig_port->port);
> +
> switch (intel_dig_port->port) {
> case PORT_A:
> - encoder->hpd_pin = HPD_PORT_A;
> intel_dp->aux_power_domain = POWER_DOMAIN_AUX_A;
> break;
> case PORT_B:
> - encoder->hpd_pin = HPD_PORT_B;
> intel_dp->aux_power_domain = POWER_DOMAIN_AUX_B;
> break;
> case PORT_C:
> - encoder->hpd_pin = HPD_PORT_C;
> intel_dp->aux_power_domain = POWER_DOMAIN_AUX_C;
> break;
> case PORT_D:
> - encoder->hpd_pin = HPD_PORT_D;
> intel_dp->aux_power_domain = POWER_DOMAIN_AUX_D;
> break;
> case PORT_E:
> - encoder->hpd_pin = HPD_PORT_E;
> -
> /* FIXME: Check VBT for actual wiring of PORT E */
> intel_dp->aux_power_domain = POWER_DOMAIN_AUX_D;
> break;
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 2ef1ee85129d..e30c27acb94f 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1920,23 +1920,9 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
>
> intel_hdmi->ddc_bus = intel_hdmi_ddc_pin(dev_priv, port);
>
> - switch (port) {
> - case PORT_B:
> - intel_encoder->hpd_pin = HPD_PORT_B;
> - break;
> - case PORT_C:
> - intel_encoder->hpd_pin = HPD_PORT_C;
> - break;
> - case PORT_D:
> - intel_encoder->hpd_pin = HPD_PORT_D;
> - break;
> - case PORT_E:
> - intel_encoder->hpd_pin = HPD_PORT_E;
> - break;
> - default:
> - MISSING_CASE(port);
> + if (WARN_ON(port == PORT_A))
> return;
> - }
> + intel_encoder->hpd_pin = intel_hpd_pin(port);
>
> if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
> intel_hdmi->write_infoframe = vlv_write_infoframe;
> diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c
> index d442d9f012d6..875d5d218d5c 100644
> --- a/drivers/gpu/drm/i915/intel_hotplug.c
> +++ b/drivers/gpu/drm/i915/intel_hotplug.c
> @@ -101,6 +101,32 @@ enum port intel_hpd_pin_to_port(enum hpd_pin pin)
> }
> }
>
> +/**
> + * intel_hpd_pin - return pin hard associated with certain port.
> + * @port: the hpd port to get associated pin
> + *
> + * Return pin that is associatade with @port and HDP_NONE if no pin is
> + * hard associated with that @port.
> + */
> +enum hpd_pin intel_hpd_pin(enum port port)
> +{
> + switch (port) {
> + case PORT_A:
> + return HPD_PORT_A;
> + case PORT_B:
> + return HPD_PORT_B;
> + case PORT_C:
> + return HPD_PORT_C;
> + case PORT_D:
> + return HPD_PORT_D;
> + case PORT_E:
> + return HPD_PORT_E;
> + default:
> + MISSING_CASE(port);
> + return HPD_NONE;
> + }
> +}
> +
> #define HPD_STORM_DETECT_PERIOD 1000
> #define HPD_STORM_REENABLE_DELAY (2 * 60 * 1000)
>
> --
> 2.13.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
More information about the Intel-gfx
mailing list