From: Wu Fengguang <fengguang.wu@intel.com>
To: Keith Packard <keithp@keithp.com>
Cc: Takashi Iwai <tiwai@suse.de>,
"Wang, Zhenyu Z" <zhenyu.z.wang@intel.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/3 v2] drm/i915: hot removal notification to HDMI audio driver
Date: Wed, 16 Nov 2011 21:37:24 +0800 [thread overview]
Message-ID: <20111116133724.GB23804@localhost> (raw)
In-Reply-To: <20111116132221.374839261@intel.com>
On monitor hot removal:
1) clear SDVO_AUDIO_ENABLE or DP_AUDIO_OUTPUT_ENABLE
2) clear ELD Valid bit
So that the audio driver will receive hot plug events and take action to
refresh its device state and ELD contents.
cc: Wang Zhenyu <zhenyu.z.wang@intel.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
drivers/gpu/drm/drm_crtc_helper.c | 4 ++++
drivers/gpu/drm/i915/intel_dp.c | 17 +++++++++++++++++
drivers/gpu/drm/i915/intel_hdmi.c | 17 +++++++++++++++++
include/drm/drm_crtc.h | 1 +
4 files changed, 39 insertions(+)
--- linux.orig/drivers/gpu/drm/i915/intel_dp.c 2011-11-16 21:36:58.000000000 +0800
+++ linux/drivers/gpu/drm/i915/intel_dp.c 2011-11-16 21:37:00.000000000 +0800
@@ -1984,6 +1984,22 @@ intel_dp_detect(struct drm_connector *co
return connector_status_connected;
}
+static void intel_dp_hot_remove(struct drm_connector *connector)
+{
+ struct intel_dp *intel_dp = intel_attached_dp(connector);
+ struct drm_device *dev = intel_dp->base.base.dev;
+ struct drm_i915_private *dev_priv = dev->dev_private;
+ struct drm_crtc *crtc = intel_dp->base.base.crtc;
+
+ intel_dp->DP &= ~DP_AUDIO_OUTPUT_ENABLE;
+ I915_WRITE(intel_dp->output_reg, intel_dp->DP);
+ POSTING_READ(intel_dp->output_reg);
+
+ connector->eld[0] = 0;
+ if (dev_priv->display.write_eld)
+ dev_priv->display.write_eld(connector, crtc);
+}
+
static int intel_dp_get_modes(struct drm_connector *connector)
{
struct intel_dp *intel_dp = intel_attached_dp(connector);
@@ -2143,6 +2159,7 @@ static const struct drm_connector_funcs
.detect = intel_dp_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = intel_dp_set_property,
+ .hot_remove = intel_dp_hot_remove,
.destroy = intel_dp_destroy,
};
--- linux.orig/drivers/gpu/drm/i915/intel_hdmi.c 2011-11-16 21:36:58.000000000 +0800
+++ linux/drivers/gpu/drm/i915/intel_hdmi.c 2011-11-16 21:37:00.000000000 +0800
@@ -350,6 +350,22 @@ intel_hdmi_detect(struct drm_connector *
return status;
}
+static void intel_hdmi_hot_remove(struct drm_connector *connector)
+{
+ struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+ struct drm_i915_private *dev_priv = connector->dev->dev_private;
+ u32 temp;
+
+ temp = I915_READ(intel_hdmi->sdvox_reg);
+ I915_WRITE(intel_hdmi->sdvox_reg, temp & ~SDVO_AUDIO_ENABLE);
+ POSTING_READ(intel_hdmi->sdvox_reg);
+
+ connector->eld[0] = 0;
+ if (dev_priv->display.write_eld)
+ dev_priv->display.write_eld(connector,
+ intel_hdmi->base.base.crtc);
+}
+
static int intel_hdmi_get_modes(struct drm_connector *connector)
{
struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
@@ -459,6 +475,7 @@ static const struct drm_connector_funcs
.detect = intel_hdmi_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = intel_hdmi_set_property,
+ .hot_remove = intel_hdmi_hot_remove,
.destroy = intel_hdmi_destroy,
};
--- linux.orig/drivers/gpu/drm/drm_crtc_helper.c 2011-11-16 21:36:58.000000000 +0800
+++ linux/drivers/gpu/drm/drm_crtc_helper.c 2011-11-16 21:37:00.000000000 +0800
@@ -905,6 +905,10 @@ static void output_poll_execute(struct w
old_status, connector->status);
if (old_status != connector->status)
changed = true;
+ if (old_status == connector_status_connected &&
+ connector->status == connector_status_disconnected)
+ connector->funcs->hot_remove(connector);
+
}
mutex_unlock(&dev->mode_config.mutex);
--- linux.orig/include/drm/drm_crtc.h 2011-11-16 21:36:58.000000000 +0800
+++ linux/include/drm/drm_crtc.h 2011-11-16 21:37:00.000000000 +0800
@@ -419,6 +419,7 @@ struct drm_connector_funcs {
int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
int (*set_property)(struct drm_connector *connector, struct drm_property *property,
uint64_t val);
+ void (*hot_remove)(struct drm_connector *connector);
void (*destroy)(struct drm_connector *connector);
void (*force)(struct drm_connector *connector);
};
prev parent reply other threads:[~2011-11-16 13:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-16 13:20 [PATCH 0/3] HDMI ELD fixes for 3.2 Wu Fengguang
2011-11-16 13:20 ` Wu Fengguang
2011-11-16 13:20 ` [PATCH 1/3] drm/i915: fix ELD writing for SandyBridge Wu Fengguang
2011-11-16 13:20 ` Wu Fengguang
2011-11-16 13:20 ` [PATCH 2/3] drm/i915: dont trigger hotplug events on unchanged ELD Wu Fengguang
2011-11-16 13:20 ` Wu Fengguang
2011-11-16 13:20 ` [PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver Wu Fengguang
2011-11-16 13:20 ` Wu Fengguang
2011-11-16 13:35 ` Wu Fengguang
2011-11-18 9:37 ` Wu Fengguang
2011-11-18 17:46 ` Keith Packard
2011-11-18 17:46 ` Keith Packard
2011-11-19 2:10 ` Wu Fengguang
2011-11-21 1:58 ` Wu Fengguang
2011-11-21 8:47 ` Takashi Iwai
2011-11-21 11:05 ` Wu Fengguang
2011-11-21 16:56 ` Keith Packard
2011-11-21 16:56 ` Keith Packard
2011-11-16 13:37 ` Wu Fengguang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111116133724.GB23804@localhost \
--to=fengguang.wu@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=keithp@keithp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tiwai@suse.de \
--cc=zhenyu.z.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.