diff mbox

[25/58] drm/i915/tv: implement get_hw_state

Message ID 1345403595-9678-26-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State Accepted
Headers show

Commit Message

Daniel Vetter Aug. 19, 2012, 7:12 p.m. UTC
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_tv.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Jesse Barnes Sept. 4, 2012, 8:28 p.m. UTC | #1
On Sun, 19 Aug 2012 21:12:42 +0200
Daniel Vetter <daniel.vetter@ffwll.ch> wrote:

> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/intel_tv.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index 5dc08b9..98ad7fd 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -836,6 +836,21 @@ static struct intel_tv *intel_attached_tv(struct drm_connector *connector)
>  			    base);
>  }
>  
> +static bool
> +intel_tv_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;
> +	u32 tmp = I915_READ(TV_CTL);
> +
> +	if (!(tmp & TV_ENC_ENABLE))
> +		return false;
> +
> +	*pipe = PORT_TO_PIPE(tmp);
> +
> +	return true;
> +}
> +
>  static void
>  intel_enable_tv(struct intel_encoder *encoder)
>  {
> @@ -1616,6 +1631,8 @@ intel_tv_init(struct drm_device *dev)
>  
>  	intel_encoder->enable = intel_enable_tv;
>  	intel_encoder->disable = intel_disable_tv;
> +	intel_encoder->get_hw_state = intel_tv_get_hw_state;
> +	intel_connector->get_hw_state = intel_connector_get_hw_state;
>  
>  	intel_connector_attach_encoder(intel_connector, intel_encoder);
>  	intel_encoder->type = INTEL_OUTPUT_TVOUT;

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 5dc08b9..98ad7fd 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -836,6 +836,21 @@  static struct intel_tv *intel_attached_tv(struct drm_connector *connector)
 			    base);
 }
 
+static bool
+intel_tv_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;
+	u32 tmp = I915_READ(TV_CTL);
+
+	if (!(tmp & TV_ENC_ENABLE))
+		return false;
+
+	*pipe = PORT_TO_PIPE(tmp);
+
+	return true;
+}
+
 static void
 intel_enable_tv(struct intel_encoder *encoder)
 {
@@ -1616,6 +1631,8 @@  intel_tv_init(struct drm_device *dev)
 
 	intel_encoder->enable = intel_enable_tv;
 	intel_encoder->disable = intel_disable_tv;
+	intel_encoder->get_hw_state = intel_tv_get_hw_state;
+	intel_connector->get_hw_state = intel_connector_get_hw_state;
 
 	intel_connector_attach_encoder(intel_connector, intel_encoder);
 	intel_encoder->type = INTEL_OUTPUT_TVOUT;