[PATCH 24/58] drm/i915/hdmi: implement get_hw_state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 19 Aug 2012 21:12:41 +0200
Daniel Vetter <daniel.vetter at ffwll.ch> wrote:

> Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
>  drivers/gpu/drm/i915/intel_ddi.c  | 29 +++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/intel_drv.h  |  2 ++
>  drivers/gpu/drm/i915/intel_hdmi.c | 24 ++++++++++++++++++++++++
>  3 files changed, 55 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 38a7006..bfe3754 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -757,6 +757,35 @@ void intel_ddi_mode_set(struct drm_encoder *encoder,
>  	intel_hdmi->set_infoframes(encoder, adjusted_mode);
>  }
>  
> +bool intel_ddi_get_hw_state(struct intel_encoder *encoder,
> +			    enum pipe *pipe)
> +{
> +	struct drm_device *dev = encoder->base.dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
> +	u32 tmp;
> +	int i;
> +
> +	tmp = I915_READ(DDI_BUF_CTL(intel_hdmi->ddi_port));
> +
> +	if (!(tmp & DDI_BUF_CTL_ENABLE))
> +		return false;
> +
> +	for_each_pipe(i) {
> +		tmp = I915_READ(DDI_FUNC_CTL(i));
> +
> +		if ((tmp & PIPE_DDI_PORT_MASK)
> +		    == PIPE_DDI_SELECT_PORT(intel_hdmi->ddi_port)) {
> +			*pipe = i;
> +			return true;
> +		}
> +	}
> +
> +	DRM_DEBUG_KMS("No pipe for ddi port %i found\n", intel_hdmi->ddi_port);
> +
> +	return true;
> +}
> +
>  void intel_enable_ddi(struct intel_encoder *encoder)
>  {
>  	struct drm_device *dev = encoder->base.dev;
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index c39c705..4daa7e6 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -542,6 +542,8 @@ extern void ironlake_teardown_rc6(struct drm_device *dev);
>  
>  extern void intel_enable_ddi(struct intel_encoder *encoder);
>  extern void intel_disable_ddi(struct intel_encoder *encoder);
> +extern bool intel_ddi_get_hw_state(struct intel_encoder *encoder,
> +				   enum pipe *pipe);
>  extern void intel_ddi_mode_set(struct drm_encoder *encoder,
>  				struct drm_display_mode *mode,
>  				struct drm_display_mode *adjusted_mode);
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index c9535ce..e7d5078 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -601,6 +601,27 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,
>  	intel_hdmi->set_infoframes(encoder, adjusted_mode);
>  }
>  
> +static bool intel_hdmi_get_hw_state(struct intel_encoder *encoder,
> +				    enum pipe *pipe)
> +{
> +	struct drm_device *dev = encoder->base.dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
> +	u32 tmp;
> +
> +	tmp = I915_READ(intel_hdmi->sdvox_reg);
> +
> +	if (!(tmp & SDVO_ENABLE))
> +		return false;
> +
> +	if (HAS_PCH_CPT(dev))
> +		*pipe = PORT_TO_PIPE_CPT(tmp);
> +	else
> +		*pipe = PORT_TO_PIPE(tmp);
> +
> +	return true;
> +}
> +
>  static void intel_enable_hdmi(struct intel_encoder *encoder)
>  {
>  	struct drm_device *dev = encoder->base.dev;
> @@ -998,14 +1019,17 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg, enum port port)
>  	if (IS_HASWELL(dev)) {
>  		intel_encoder->enable = intel_enable_ddi;
>  		intel_encoder->disable = intel_disable_ddi;
> +		intel_encoder->get_hw_state = intel_ddi_get_hw_state;
>  		drm_encoder_helper_add(&intel_encoder->base,
>  				       &intel_hdmi_helper_funcs_hsw);
>  	} else {
>  		intel_encoder->enable = intel_enable_hdmi;
>  		intel_encoder->disable = intel_disable_hdmi;
> +		intel_encoder->get_hw_state = intel_hdmi_get_hw_state;
>  		drm_encoder_helper_add(&intel_encoder->base,
>  				       &intel_hdmi_helper_funcs);
>  	}
> +	intel_connector->get_hw_state = intel_connector_get_hw_state;
>  
>  
>  	intel_hdmi_add_properties(intel_hdmi, connector);

Should DDI be split out and come first?

Reviewed-by: Jesse Barnes <jbarnes at virtuousgeek.org>

-- 
Jesse Barnes, Intel Open Source Technology Center


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux