i915 to call hda driver on HDMI plug/unplug
Subsystems (3)
v2 cover i915 to call hda driver on HDMI plug/unplug
Changes since previous version:
* Renames and refactorings according to Daniel's and Takashi's suggestions.
* Debug message slightly improved.
* Braswell now has all three pins too, Baytrail still has only one pin. It would still be good with some confirmation from Intel that this is correct.
David Henningsson (4):
drm/i915: Add audio hotplug info struct drm/i915: Call audio hotplug notify function
ALSA: hda - Dispatch incoming HDMI hotplug i915 callback
ALSA: hda - Wake the codec up on hotplug notify events
drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_audio.c | 41 ++++++++++++++++++++++++++++++++++++ include/drm/i915_component.h | 18 ++++++++++++++++ include/sound/hdaudio.h | 4 ++++ sound/hda/hdac_i915.c | 26 +++++++++++++++++++++++ sound/pci/hda/patch_hdmi.c | 13 +++++++++++- 6 files changed, 102 insertions(+), 1 deletion(-)
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/4 drm/i915: Add audio hotplug info struct
This struct will be used to transfer information from the i915 driver to the hda driver on HDMI hotplug events.
--- include/drm/i915_component.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
include/drm/i915_component.h +18 -0
@@ -24,8 +24,22 @@ #ifndef _I915_COMPONENT_H_ #define _I915_COMPONENT_H_ +struct hdac_bus; + +struct i915_audio_hotplug_info { + int connector_type; /* DRM_MODE_CONNECTOR_*, meant for userspace */ + int connector_type_id; /* Index within a DRM_MODE_CONNECTOR_* type, meant for userspace */ + int port; /* Used for mapping to affected nid */ + int port_multi_stream_device; /* For DP multi-streaming */ + + bool plugged_in; + const unsigned char *eld; + int eld_size; +}; + struct i915_audio_component { struct device *dev; + struct hdac_bus *hdac_bus; const struct i915_audio_component_ops { struct module *owner;
@@ -34,6 +48,10 @@ struct i915_audio_component {void (*codec_wake_override)(struct device *,bool enable); int (*get_cdclk_freq)(struct device *); } *ops; + +const struct i915_audio_component_audio_ops { +void (*hotplug_notify)(struct hdac_bus *,const struct i915_audio_hotplug_info *); + } *audio_ops; };#endif /* _I915_COMPONENT_H_ */
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/4 drm/i915: Call audio hotplug notify function
In reply to David HenningssonOn HDMI hotplug events, notify the audio driver. This will enable the audio driver to get the information at all times (even when audio is in different powersave states), and also without reading it from the hardware.
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_audio.c | 41 ++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -1808,6 +1808,7 @@ struct drm_i915_private {struct drm_property *force_audio_property;/* hda/i915 audio component */ +struct i915_audio_component *audio_component;bool audio_component_registered;uint32_t hw_context_size;
drivers/gpu/drm/i915/intel_audio.c +41 -0
80 lines not on this page · raw message
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/4 ALSA: hda - Dispatch incoming HDMI hotplug i915 callback
In reply to David HenningssonThis lets interested codec(s) be notified of HDMI hotplug events sent from the i915 driver.
--- include/sound/hdaudio.h | 4 ++++ sound/hda/hdac_i915.c | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+)
include/sound/hdaudio.h +4 -0
@@ -79,6 +79,10 @@ struct hdac_device {int (*exec_verb)(struct hdac_device *dev,unsigned int cmd,unsigned int flags,unsigned int *res); +/* Used for hotplug notification from i915 driver */ +void (*i915_hotplug_notify)(struct hdac_device *, +const struct i915_audio_hotplug_info *); +/* widgets */ unsigned int num_nodes;hda_nid_t start_nid, end_nid;
sound/hda/hdac_i915.c +26 -0
@@ -118,6 +118,8 @@ static void hdac_component_master_unbind(struct device *dev) {struct i915_audio_component *acomp = hdac_acomp; + acomp->audio_ops =NULL ; + acomp->hdac_bus =NULL ;module_put (acomp->ops->owner);component_unbind_all (dev, acomp);WARN_ON (acomp->ops || acomp->dev);
@@ -128,6 +130,27 @@ static const struct component_master_ops hdac_component_master_ops = { .unbind = hdac_component_master_unbind, }; +static void i915_audio_component_hotplug_notify (struct hdac_bus *bus, +const struct i915_audio_hotplug_info *info) +{ +struct hdac_device *d; + +if (info->plugged_in) +dev_dbg (bus->dev,"i915 plugged in event (port = %d, connector = %d,%d)" , + info->port, info->connector_type, info->connector_type_id); +else +dev_dbg (bus->dev,"i915 unplug event (port = %d)" , info->port); + +list_for_each_entry (d, &bus->codec_list, list) { +if (d->i915_hotplug_notify) + d->i915_hotplug_notify (d, info); + } +} + +static const struct i915_audio_component_audio_ops i915_audio_component_audio_ops = { + .hotplug_notify = i915_audio_component_hotplug_notify, +}; +static int hdac_component_master_match (struct device *dev,void *data) {/* i915 is the only supported component */
@@ -163,6 +186,9 @@ int snd_hdac_i915_init(struct hdac_bus *bus) ret = -ENODEV ; goto out_master_del; } + acomp->audio_ops = &i915_audio_component_audio_ops; + acomp->hdac_bus = bus; +dev_dbg (dev,"bound to i915 component master\n" );return 0 ;
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 4/4 ALSA: hda - Wake the codec up on hotplug notify events
In reply to David HenningssonAs a first cautious step, we're not going to trust the information coming directly from the i915 driver, we're just going to use the fact that there was an event to wakeup the codec and ask for its status.
This fixes the issue with lost unsol events in power save mode, the codec and controller can now sleep in D3 and still know when the HDMI monitor has been connected.
--- sound/pci/hda/patch_hdmi.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
sound/pci/hda/patch_hdmi.c +12 -1
@@ -2316,6 +2316,15 @@ static void haswell_set_power_state(struct hda_codec *codec, hda_nid_t fg,snd_hda_codec_set_power_to_all (codec, fg, power_state); } +static void intel_hotplug_notify (struct hdac_device *dev, +const struct i915_audio_hotplug_info *info) +{ + struct hda_codec *codec = container_of(dev, struct hda_codec, core); +int pin_nid =is_valleyview (codec) ?0x03 : info->port +0x04 ; + +check_presence_and_report (codec, pin_nid); +} +static int patch_generic_hdmi (struct hda_codec *codec) {struct hdmi_spec *spec;
@@ -2342,8 +2351,10 @@ static int patch_generic_hdmi(struct hda_codec *codec)if (is_valleyview_plus (codec) ||is_skylake (codec)) codec->core.link_power_control =1 ; -if (is_haswell_plus (codec) ||is_valleyview_plus (codec)) +if (is_haswell_plus (codec) ||is_valleyview_plus (codec)) { codec->depop_delay =0 ; + codec->core.i915_hotplug_notify = intel_hotplug_notify; + }if (hdmi_parse_codec (codec) <0 ) { codec->spec =NULL ;
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx