* Re: HDMI monitor hot remove handling
[not found] ` <20111111071549.GL22336@zhen-devel.sh.intel.com>
@ 2011-11-11 8:50 ` Wu Fengguang
2011-11-14 2:05 ` Zhenyu Wang
0 siblings, 1 reply; 3+ messages in thread
From: Wu Fengguang @ 2011-11-11 8:50 UTC (permalink / raw)
To: Zhenyu Wang; +Cc: intel-gfx@lists.freedesktop...
> > > I still think you should do those in hot_plug(), to call detect() for current
> > > status, write eld and set specific audio enable/disable bit for all audio stuff.
> > > Just my sense, you may send RFC patch for other's comment.
> yeah, mode_set() will only be in normal mode setting path and taking current
> monitor's audio capability, but not on hot removal path. And if connector's DPMS off,
> does audio need to care? I think no, as user might still like to hear sound, right? ;)
>
> So looks currently nobody cares for hot removal, you need to set that by
> yourself somewhere.
Zhenyu, according to your comments, here is the patch, tested OK on
HDMI :) DP not tested yet.
This notifies the audio driver of the HDMI/DP monitor hot removal
event.
- clear SDVO_AUDIO_ENABLE/DP_AUDIO_OUTPUT_ENABLE
- clear ELD Valid bit
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
drivers/gpu/drm/drm_crtc_helper.c | 4 ++++
drivers/gpu/drm/i915/intel_dp.c | 19 +++++++++++++++++++
drivers/gpu/drm/i915/intel_drv.h | 4 ++++
drivers/gpu/drm/i915/intel_hdmi.c | 17 +++++++++++++++++
include/drm/drm_crtc.h | 1 +
5 files changed, 45 insertions(+)
--- linux.orig/drivers/gpu/drm/i915/intel_dp.c 2011-11-11 16:42:58.000000000 +0800
+++ linux/drivers/gpu/drm/i915/intel_dp.c 2011-11-11 16:42:59.000000000 +0800
@@ -1984,6 +1984,24 @@ 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;
+ struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+ intel_dp->DP &= ~DP_AUDIO_OUTPUT_ENABLE;
+ I915_WRITE(intel_dp->output_reg, intel_dp->DP);
+ POSTING_READ(intel_dp->output_reg);
+ intel_wait_for_vblank(dev, intel_crtc->pipe);
+
+ 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 +2161,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_drv.h 2011-11-11 16:42:58.000000000 +0800
+++ linux/drivers/gpu/drm/i915/intel_drv.h 2011-11-11 16:42:59.000000000 +0800
@@ -382,6 +382,10 @@ extern void intel_fb_restore_mode(struct
extern void intel_init_clock_gating(struct drm_device *dev);
extern void intel_write_eld(struct drm_encoder *encoder,
struct drm_display_mode *mode);
+extern void intel_hotplug_status(struct drm_device *dev,
+ struct drm_connector *connector,
+ struct drm_crtc *crtc,
+ enum drm_connector_status status);
extern void intel_cpt_verify_modeset(struct drm_device *dev, int pipe);
#endif /* __INTEL_DRV_H__ */
--- linux.orig/drivers/gpu/drm/i915/intel_hdmi.c 2011-11-11 16:42:58.000000000 +0800
+++ linux/drivers/gpu/drm/i915/intel_hdmi.c 2011-11-11 16:42:59.000000000 +0800
@@ -352,6 +352,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);
@@ -461,6 +477,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-11 16:42:58.000000000 +0800
+++ linux/drivers/gpu/drm/drm_crtc_helper.c 2011-11-11 16:42:59.000000000 +0800
@@ -907,6 +907,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-11 16:42:58.000000000 +0800
+++ linux/include/drm/drm_crtc.h 2011-11-11 16:42:59.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);
};
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: HDMI monitor hot remove handling
2011-11-11 8:50 ` HDMI monitor hot remove handling Wu Fengguang
@ 2011-11-14 2:05 ` Zhenyu Wang
2011-11-14 2:54 ` Wu Fengguang
0 siblings, 1 reply; 3+ messages in thread
From: Zhenyu Wang @ 2011-11-14 2:05 UTC (permalink / raw)
To: Wu Fengguang; +Cc: intel-gfx@lists.freedesktop...
[-- Attachment #1.1: Type: text/plain, Size: 6146 bytes --]
On 2011.11.11 16:50:41 +0800, Wu Fengguang wrote:
> > > > I still think you should do those in hot_plug(), to call detect() for current
> > > > status, write eld and set specific audio enable/disable bit for all audio stuff.
> > > > Just my sense, you may send RFC patch for other's comment.
>
> > yeah, mode_set() will only be in normal mode setting path and taking current
> > monitor's audio capability, but not on hot removal path. And if connector's DPMS off,
> > does audio need to care? I think no, as user might still like to hear sound, right? ;)
> >
> > So looks currently nobody cares for hot removal, you need to set that by
> > yourself somewhere.
>
> Zhenyu, according to your comments, here is the patch, tested OK on
> HDMI :) DP not tested yet.
Well, I don't think I suggested a new hook for hot removal. ;)
You know that hot_plug() hook is intel encoder thing, which is the place
I think you can do audio config stuff.
>
> This notifies the audio driver of the HDMI/DP monitor hot removal
> event.
>
> - clear SDVO_AUDIO_ENABLE/DP_AUDIO_OUTPUT_ENABLE
> - clear ELD Valid bit
>
> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
> ---
> drivers/gpu/drm/drm_crtc_helper.c | 4 ++++
> drivers/gpu/drm/i915/intel_dp.c | 19 +++++++++++++++++++
> drivers/gpu/drm/i915/intel_drv.h | 4 ++++
> drivers/gpu/drm/i915/intel_hdmi.c | 17 +++++++++++++++++
> include/drm/drm_crtc.h | 1 +
> 5 files changed, 45 insertions(+)
>
> --- linux.orig/drivers/gpu/drm/i915/intel_dp.c 2011-11-11 16:42:58.000000000 +0800
> +++ linux/drivers/gpu/drm/i915/intel_dp.c 2011-11-11 16:42:59.000000000 +0800
> @@ -1984,6 +1984,24 @@ 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;
> + struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> +
> + intel_dp->DP &= ~DP_AUDIO_OUTPUT_ENABLE;
> + I915_WRITE(intel_dp->output_reg, intel_dp->DP);
> + POSTING_READ(intel_dp->output_reg);
> + intel_wait_for_vblank(dev, intel_crtc->pipe);
> +
> + 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 +2161,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_drv.h 2011-11-11 16:42:58.000000000 +0800
> +++ linux/drivers/gpu/drm/i915/intel_drv.h 2011-11-11 16:42:59.000000000 +0800
> @@ -382,6 +382,10 @@ extern void intel_fb_restore_mode(struct
> extern void intel_init_clock_gating(struct drm_device *dev);
> extern void intel_write_eld(struct drm_encoder *encoder,
> struct drm_display_mode *mode);
> +extern void intel_hotplug_status(struct drm_device *dev,
> + struct drm_connector *connector,
> + struct drm_crtc *crtc,
> + enum drm_connector_status status);
> extern void intel_cpt_verify_modeset(struct drm_device *dev, int pipe);
>
> #endif /* __INTEL_DRV_H__ */
> --- linux.orig/drivers/gpu/drm/i915/intel_hdmi.c 2011-11-11 16:42:58.000000000 +0800
> +++ linux/drivers/gpu/drm/i915/intel_hdmi.c 2011-11-11 16:42:59.000000000 +0800
> @@ -352,6 +352,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);
> @@ -461,6 +477,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-11 16:42:58.000000000 +0800
> +++ linux/drivers/gpu/drm/drm_crtc_helper.c 2011-11-11 16:42:59.000000000 +0800
> @@ -907,6 +907,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-11 16:42:58.000000000 +0800
> +++ linux/include/drm/drm_crtc.h 2011-11-11 16:42:59.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);
> };
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: HDMI monitor hot remove handling
2011-11-14 2:05 ` Zhenyu Wang
@ 2011-11-14 2:54 ` Wu Fengguang
0 siblings, 0 replies; 3+ messages in thread
From: Wu Fengguang @ 2011-11-14 2:54 UTC (permalink / raw)
To: Wang Zhenyu; +Cc: intel-gfx@lists.freedesktop...
On Mon, Nov 14, 2011 at 10:05:05AM +0800, Zhenyu Wang wrote:
> On 2011.11.11 16:50:41 +0800, Wu Fengguang wrote:
> > > > > I still think you should do those in hot_plug(), to call detect() for current
> > > > > status, write eld and set specific audio enable/disable bit for all audio stuff.
> > > > > Just my sense, you may send RFC patch for other's comment.
> >
> > > yeah, mode_set() will only be in normal mode setting path and taking current
> > > monitor's audio capability, but not on hot removal path. And if connector's DPMS off,
> > > does audio need to care? I think no, as user might still like to hear sound, right? ;)
> > >
> > > So looks currently nobody cares for hot removal, you need to set that by
> > > yourself somewhere.
> >
> > Zhenyu, according to your comments, here is the patch, tested OK on
> > HDMI :) DP not tested yet.
>
> Well, I don't think I suggested a new hook for hot removal. ;)
Yes, sorry.
> You know that hot_plug() hook is intel encoder thing, which is the place
> I think you can do audio config stuff.
The problem is, ->hot_plug() is called at the very beginning, before
->detect() is called. If doing the hot remove notifications in
->hot_plug(), the patch will add an _extra_ loop to call into
->detect().
Why not insert the functionalities somewhere after ->detect() is
called and we already know it's a hot removal event? That avoids
adding duplicate ->detect() calls.
Thanks,
Fengguang
> >
> > This notifies the audio driver of the HDMI/DP monitor hot removal
> > event.
> >
> > - clear SDVO_AUDIO_ENABLE/DP_AUDIO_OUTPUT_ENABLE
> > - clear ELD Valid bit
> >
> > Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
> > ---
> > drivers/gpu/drm/drm_crtc_helper.c | 4 ++++
> > drivers/gpu/drm/i915/intel_dp.c | 19 +++++++++++++++++++
> > drivers/gpu/drm/i915/intel_drv.h | 4 ++++
> > drivers/gpu/drm/i915/intel_hdmi.c | 17 +++++++++++++++++
> > include/drm/drm_crtc.h | 1 +
> > 5 files changed, 45 insertions(+)
> >
> > --- linux.orig/drivers/gpu/drm/i915/intel_dp.c 2011-11-11 16:42:58.000000000 +0800
> > +++ linux/drivers/gpu/drm/i915/intel_dp.c 2011-11-11 16:42:59.000000000 +0800
> > @@ -1984,6 +1984,24 @@ 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;
> > + struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> > +
> > + intel_dp->DP &= ~DP_AUDIO_OUTPUT_ENABLE;
> > + I915_WRITE(intel_dp->output_reg, intel_dp->DP);
> > + POSTING_READ(intel_dp->output_reg);
> > + intel_wait_for_vblank(dev, intel_crtc->pipe);
> > +
> > + 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 +2161,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_drv.h 2011-11-11 16:42:58.000000000 +0800
> > +++ linux/drivers/gpu/drm/i915/intel_drv.h 2011-11-11 16:42:59.000000000 +0800
> > @@ -382,6 +382,10 @@ extern void intel_fb_restore_mode(struct
> > extern void intel_init_clock_gating(struct drm_device *dev);
> > extern void intel_write_eld(struct drm_encoder *encoder,
> > struct drm_display_mode *mode);
> > +extern void intel_hotplug_status(struct drm_device *dev,
> > + struct drm_connector *connector,
> > + struct drm_crtc *crtc,
> > + enum drm_connector_status status);
> > extern void intel_cpt_verify_modeset(struct drm_device *dev, int pipe);
> >
> > #endif /* __INTEL_DRV_H__ */
> > --- linux.orig/drivers/gpu/drm/i915/intel_hdmi.c 2011-11-11 16:42:58.000000000 +0800
> > +++ linux/drivers/gpu/drm/i915/intel_hdmi.c 2011-11-11 16:42:59.000000000 +0800
> > @@ -352,6 +352,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);
> > @@ -461,6 +477,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-11 16:42:58.000000000 +0800
> > +++ linux/drivers/gpu/drm/drm_crtc_helper.c 2011-11-11 16:42:59.000000000 +0800
> > @@ -907,6 +907,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-11 16:42:58.000000000 +0800
> > +++ linux/include/drm/drm_crtc.h 2011-11-11 16:42:59.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);
> > };
>
> --
> Open Source Technology Center, Intel ltd.
>
> $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-14 2:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20111111050131.GA7073@localhost>
[not found] ` <20111111051524.GA8882@localhost>
[not found] ` <20111111052630.GG22336@zhen-devel.sh.intel.com>
[not found] ` <20111111054038.GA11861@localhost>
[not found] ` <20111111055703.GH22336@zhen-devel.sh.intel.com>
[not found] ` <20111111063439.GA19914@localhost>
[not found] ` <20111111064222.GJ22336@zhen-devel.sh.intel.com>
[not found] ` <20111111070554.GA22299@localhost>
[not found] ` <20111111071549.GL22336@zhen-devel.sh.intel.com>
2011-11-11 8:50 ` HDMI monitor hot remove handling Wu Fengguang
2011-11-14 2:05 ` Zhenyu Wang
2011-11-14 2:54 ` Wu Fengguang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox