aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-07-02 07:27:29 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-09-06 01:58:22 -0400
commit85234cdc28f622dc94d8bb0089635113e2aa5609 (patch)
tree63540fb49e240f9219e5ded9e4d032910c235792 /drivers/gpu/drm
parent19d8fe154497bc48e25cbed61066731daca3df43 (diff)
drm/i915/hdmi: implement get_hw_state
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/i915/intel_ddi.c29
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h2
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c24
3 files changed, 55 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 38a7006a84f4..bfe375466a0e 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,
757 intel_hdmi->set_infoframes(encoder, adjusted_mode); 757 intel_hdmi->set_infoframes(encoder, adjusted_mode);
758} 758}
759 759
760bool intel_ddi_get_hw_state(struct intel_encoder *encoder,
761 enum pipe *pipe)
762{
763 struct drm_device *dev = encoder->base.dev;
764 struct drm_i915_private *dev_priv = dev->dev_private;
765 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
766 u32 tmp;
767 int i;
768
769 tmp = I915_READ(DDI_BUF_CTL(intel_hdmi->ddi_port));
770
771 if (!(tmp & DDI_BUF_CTL_ENABLE))
772 return false;
773
774 for_each_pipe(i) {
775 tmp = I915_READ(DDI_FUNC_CTL(i));
776
777 if ((tmp & PIPE_DDI_PORT_MASK)
778 == PIPE_DDI_SELECT_PORT(intel_hdmi->ddi_port)) {
779 *pipe = i;
780 return true;
781 }
782 }
783
784 DRM_DEBUG_KMS("No pipe for ddi port %i found\n", intel_hdmi->ddi_port);
785
786 return true;
787}
788
760void intel_enable_ddi(struct intel_encoder *encoder) 789void intel_enable_ddi(struct intel_encoder *encoder)
761{ 790{
762 struct drm_device *dev = encoder->base.dev; 791 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 c39c70554891..4daa7e65b04a 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);
542 542
543extern void intel_enable_ddi(struct intel_encoder *encoder); 543extern void intel_enable_ddi(struct intel_encoder *encoder);
544extern void intel_disable_ddi(struct intel_encoder *encoder); 544extern void intel_disable_ddi(struct intel_encoder *encoder);
545extern bool intel_ddi_get_hw_state(struct intel_encoder *encoder,
546 enum pipe *pipe);
545extern void intel_ddi_mode_set(struct drm_encoder *encoder, 547extern void intel_ddi_mode_set(struct drm_encoder *encoder,
546 struct drm_display_mode *mode, 548 struct drm_display_mode *mode,
547 struct drm_display_mode *adjusted_mode); 549 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 c9535cee1a73..e7d5078e6da7 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,
601 intel_hdmi->set_infoframes(encoder, adjusted_mode); 601 intel_hdmi->set_infoframes(encoder, adjusted_mode);
602} 602}
603 603
604static bool intel_hdmi_get_hw_state(struct intel_encoder *encoder,
605 enum pipe *pipe)
606{
607 struct drm_device *dev = encoder->base.dev;
608 struct drm_i915_private *dev_priv = dev->dev_private;
609 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
610 u32 tmp;
611
612 tmp = I915_READ(intel_hdmi->sdvox_reg);
613
614 if (!(tmp & SDVO_ENABLE))
615 return false;
616
617 if (HAS_PCH_CPT(dev))
618 *pipe = PORT_TO_PIPE_CPT(tmp);
619 else
620 *pipe = PORT_TO_PIPE(tmp);
621
622 return true;
623}
624
604static void intel_enable_hdmi(struct intel_encoder *encoder) 625static void intel_enable_hdmi(struct intel_encoder *encoder)
605{ 626{
606 struct drm_device *dev = encoder->base.dev; 627 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)
998 if (IS_HASWELL(dev)) { 1019 if (IS_HASWELL(dev)) {
999 intel_encoder->enable = intel_enable_ddi; 1020 intel_encoder->enable = intel_enable_ddi;
1000 intel_encoder->disable = intel_disable_ddi; 1021 intel_encoder->disable = intel_disable_ddi;
1022 intel_encoder->get_hw_state = intel_ddi_get_hw_state;
1001 drm_encoder_helper_add(&intel_encoder->base, 1023 drm_encoder_helper_add(&intel_encoder->base,
1002 &intel_hdmi_helper_funcs_hsw); 1024 &intel_hdmi_helper_funcs_hsw);
1003 } else { 1025 } else {
1004 intel_encoder->enable = intel_enable_hdmi; 1026 intel_encoder->enable = intel_enable_hdmi;
1005 intel_encoder->disable = intel_disable_hdmi; 1027 intel_encoder->disable = intel_disable_hdmi;
1028 intel_encoder->get_hw_state = intel_hdmi_get_hw_state;
1006 drm_encoder_helper_add(&intel_encoder->base, 1029 drm_encoder_helper_add(&intel_encoder->base,
1007 &intel_hdmi_helper_funcs); 1030 &intel_hdmi_helper_funcs);
1008 } 1031 }
1032 intel_connector->get_hw_state = intel_connector_get_hw_state;
1009 1033
1010 1034
1011 intel_hdmi_add_properties(intel_hdmi, connector); 1035 intel_hdmi_add_properties(intel_hdmi, connector);