DP audio API changes for identifying displays connected to a port
Subsystems (3)
An additional parameter has been added to the API's between i915 and audio drivers to identify display devices that can be connected to the same port. Currently only the port identity is being shared, but this is not sufficient as multiple displays can be driven from the same port (E.g. DP MST). This patch makes the API changes with dummy changes in the audio driver (Thanks Libin). Implementation to fully enable DP MST audio will follow later.
Dhinakaran Pandiyan(1):
drm/i915/dp: DP audio API changes for MST
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 drm/i915/dp: DP audio API changes for MST
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int dev_id'. The existing parameter 'port' does not change it's meaning.
dev_id =
MST : pipe that the stream originates from Non-MST : -1
Affected APIs:
struct i915_audio_component_ops
- int (*sync_audio_rate)(struct device *, int port, int rate);
+ int (*sync_audio_rate)(struct device *, int port, int dev_id,
+ int rate);
- int (*get_eld)(struct device *, int port, bool *enabled,
- unsigned char *buf, int max_bytes);
+ int (*get_eld)(struct device *, int port, int dev_id,
+ bool *enabled, unsigned char *buf, int max_bytes);
struct i915_audio_component_audio_ops
- void (*pin_eld_notify)(void *audio_ptr, int port);
+ void (*pin_eld_notify)(void *audio_ptr, int port, int dev_id);
This patch makes dummy changes in the audio drivers for build to succeed.
--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++--------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ]; -struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];/* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
drivers/gpu/drm/i915/intel_audio.c +63 -19
152 lines not on this page · raw message
include/drm/i915_component.h +3 -3
@@ -64,7 +64,7 @@ struct i915_audio_component_ops {* Called from audio driver. After audio driver sets the * sample rate, it will call this function to set n/cts */ -int (*sync_audio_rate)(struct device *,int port,int rate); +int (*sync_audio_rate)(struct device *,int port,int dev_id,int rate);/** * @get_eld: fill the audio state and ELD bytes for the given port *
@@ -77,7 +77,7 @@ struct i915_audio_component_ops {* Note that the returned size may be over @max_bytes. Then it * implies that only a part of ELD has been copied to the buffer. */ -int (*get_eld)(struct device *,int port,bool *enabled, +int (*get_eld)(struct device *,int port,int dev_id,bool *enabled,unsigned char *buf,int max_bytes); };
@@ -97,7 +97,7 @@ struct i915_audio_component_audio_ops {* status accordingly (even when the HDA controller is in power save * mode). */ -void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id); };/**
include/sound/hda_i915.h +6 -5
@@ -10,8 +10,9 @@int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable);int snd_hdac_display_power (struct hdac_bus *bus,bool enable);void snd_hdac_i915_set_bclk (struct hdac_bus *bus); -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate); -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate); +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes);int snd_hdac_i915_init (struct hdac_bus *bus);int snd_hdac_i915_exit (struct hdac_bus *bus);
@@ -29,13 +30,13 @@ static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus) { }static inline int snd_hdac_sync_audio_rate (struct hdac_device *codec, -hda_nid_t nid,int rate) +hda_nid_t nid,int dev_id,int rate) {return 0 ; }static inline int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, -bool *audio_enabled,char *buffer, -int max_bytes) +int dev_id,bool *audio_enabled, +char *buffer,int max_bytes) {return -ENODEV ; }
sound/hda/hdac_i915.c +5 -4
@@ -201,7 +201,8 @@ static int pin2port(struct hdac_device *codec, hda_nid_t pin_nid)* This function sets N/CTS value based on the given sample rate. * Returns zero for success, or a negative error code. */ -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate) +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate) {struct hdac_bus *bus = codec->bus;struct i915_audio_component *acomp = bus->audio_component;
@@ -212,7 +213,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate) port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->sync_audio_rate (acomp->dev, port, rate); +return acomp->ops->sync_audio_rate (acomp->dev, port, dev_id, rate); }EXPORT_SYMBOL_GPL (snd_hdac_sync_audio_rate);
@@ -236,7 +237,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);* thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched. */ -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes) {struct hdac_bus *bus = codec->bus;
@@ -249,7 +250,7 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->get_eld (acomp->dev, port, audio_enabled, +return acomp->ops->get_eld (acomp->dev, port, dev_id, audio_enabled, buffer, max_bytes); }EXPORT_SYMBOL_GPL (snd_hdac_acomp_get_eld);
sound/pci/hda/patch_hdmi.c +4 -3
@@ -1485,7 +1485,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec,mutex_lock (&per_pin->lock); eld->monitor_present = false; - size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid, + size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid,-1 , &eld->monitor_present, eld->eld_buffer,ELD_MAX_SIZE );if (size >0 ) {
@@ -1739,7 +1739,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,/* Call sync_audio_rate to set the N/CTS/M manually if necessary */ /* Todo: add DP1.2 MST audio support later */ if (codec_has_acomp (codec)) -snd_hdac_sync_audio_rate (&codec->core, pin_nid, runtime->rate); +snd_hdac_sync_audio_rate (&codec->core, pin_nid,-1 , + runtime->rate); non_pcm =check_non_pcm_per_cvt (codec, cvt_nid);mutex_lock (&per_pin->lock);
@@ -2285,7 +2286,7 @@ 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_pin_eld_notify (void *audio_ptr,int port) +static void intel_pin_eld_notify (void *audio_ptr,int port,int dev_id) {struct hda_codec *codec = audio_ptr;int pin_nid;
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 26 lines · Dhinakaran Pandiyan
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it's meaning.
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_ops(quoted diff) +4
-3- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id, + int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int dev_id, + bool *enabled, unsigned char *buf, int max_bytes);struct
i915_audio_component_audio_opsinclude/drm/i915_component.h +1
-1-void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id);
Quoted 1 line
This patch makes dummy changes in the audio drivers for build to succeed.
OK, so the explicit dev_id will be passed in future change in the audio side, right? It'd be good to write up the grand plan.
Quoted 15 lines
Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++--------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)drivers/gpu/drm/i915/i915_drv.h +0
-0
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 2057
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +1
-1@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ]; -struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];
Better to have a comment for this field.
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private {
Quoted 11 lines
drivers/gpu/drm/i915/i915_drv.h +9
-2-static int i915_audio_component_sync_audio_rate (struct device *dev, -int port,int rate) +static struct intel_encoder *get_saved_encoder (struct intel_encoder *av_enc_map[], +int port,int dev_id) +{ + +enum pipe pipe; +struct drm_encoder *encoder; + +if (dev_id >=0 && dev_id <I915_MAX_PIPES ) +return av_enc_map[dev_id];
Actually dev_id >= I915_MAX_PIPES is an invalid call, and worth to catch with WARN_ON() and bail out.
thanks,
Takashi
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 24 lines · Takashi Iwai
Quoted 22 lines · Dhinakaran Pandiyan
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it's meaning.
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_ops(quoted diff) +4
-3- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id, + int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int dev_id, + bool *enabled, unsigned char *buf, int max_bytes);
Quoted 9 lines
Quoted 5 lines
struct
i915_audio_component_audio_opsinclude/drm/i915_component.h +1
-1-void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id);This patch makes dummy changes in the audio drivers for build to succeed.
OK, so the explicit
dev_idwill be passed in future change in the audio side, right? It'd be good to write up the grand plan.
Yes, that's right. I will explain that and copy the cover-letter text here.
Quoted 19 lines
Quoted 19 lines
Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++--------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)drivers/gpu/drm/i915/i915_drv.h +0
-0@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ];
Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 2057
Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.h +1
-1-struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];Better to have a comment for this field.
Will add one.
Quoted 16 lines
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private {
Quoted 13 lines
drivers/gpu/drm/i915/i915_drv.h +9
-2-static int i915_audio_component_sync_audio_rate (struct device *dev, -int port,int rate) +static struct intel_encoder *get_saved_encoder (struct intel_encoder *av_enc_map[], +int port,int dev_id) +{ + +enum pipe pipe; +struct drm_encoder *encoder; + +if (dev_id >=0 && dev_id <I915_MAX_PIPES ) +return av_enc_map[dev_id];Actually
dev_id>=I915_MAX_PIPESis an invalid call, and worth to catch withWARN_ON()and bail out.
Sure, thanks for the review.
Quoted 8 lines
thanks,
Takashi
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
In reply to Dhinakaran PandiyanQuoted 12 lines · Dhinakaran Pandiyan
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it's meaning.
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_ops
Review
Quoted 2 lines
(quoted diff) +1
-1- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id,
Does the term 'dev_id' have some special meaning on the audio side? On the i915 side things would be less confusing if we just called it 'pipe'.
Quoted 338 lines
(quoted diff) +3
-2+ int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int dev_id, + bool *enabled, unsigned char *buf, int max_bytes);struct
i915_audio_component_audio_opsinclude/drm/i915_component.h +1
-1-void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id);This patch makes dummy changes in the audio drivers for build to succeed.
Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++--------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)drivers/gpu/drm/i915/i915_drv.h +1
-1@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ]; -struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];/* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch drivers/gpu/drm/i915/intel_audio.c +63
-19@@ -500,6 +500,9 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + connector =drm_select_eld (encoder);if (!connector)@@ -522,14 +525,19 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) dev_priv->display.audio_codec_enable (connector, intel_encoder, adjusted_mode); +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe; +mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector = connector; +/* referred in audio callbacks */ - dev_priv->dig_port_map[port] = intel_encoder; + dev_priv->av_enc_map[pipe] = intel_encoder;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -542,22 +550,29 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)void intel_audio_codec_disable (struct intel_encoder *intel_encoder) {struct drm_encoder *encoder = &intel_encoder->base; +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc);struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv =to_i915 (dev);struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe;if (dev_priv->display.audio_codec_disable) dev_priv->display.audio_codec_disable (intel_encoder);mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector =NULL ; - dev_priv->dig_port_map[port] =NULL ; + dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -628,8 +643,32 @@ static int i915_audio_component_get_cdclk_freq(struct device *dev)return dev_priv->cdclk_freq; } -static int i915_audio_component_sync_audio_rate (struct device *dev, -int port,int rate) +static struct intel_encoder *get_saved_encoder (struct intel_encoder *av_enc_map[], +int port,int dev_id) +{ + +enum pipe pipe; +struct drm_encoder *encoder; + +if (dev_id >=0 && dev_id <I915_MAX_PIPES ) +return av_enc_map[dev_id]; + +for (pipe =PIPE_A ; pipe <I915_MAX_PIPES ; pipe++) { + +if (!av_enc_map[pipe]) +continue ; + + encoder = &av_enc_map[pipe]->base; +if (port ==enc_to_dig_port (encoder)->port) +return av_enc_map[pipe]; + } + +return NULL ; + +} + +static int i915_audio_component_sync_audio_rate (struct device *dev,int port, +int dev_id,int rate) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);struct intel_encoder *intel_encoder;@@ -649,15 +688,16 @@ static int i915_audio_component_sync_audio_rate(struct device *dev,return 0 ;mutex_lock (&dev_priv->av_mutex); +/* 1. get the pipe */ - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id);if (!intel_encoder || !intel_encoder->base.crtc || intel_encoder->type !=INTEL_OUTPUT_HDMI ) {DRM_DEBUG_KMS ("no valid port %c\n" ,port_name (port)); err = -ENODEV ; goto unlock; } + crtc =to_intel_crtc (intel_encoder->base.crtc); pipe = crtc->pipe;if (pipe ==INVALID_PIPE ) {@@ -702,7 +742,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, }static int i915_audio_component_get_eld (struct device *dev,int port, -bool *enabled, +int dev_id,bool *enabled,unsigned char *buf,int max_bytes) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);@@ -710,17 +750,21 @@ static int i915_audio_component_get_eld(struct device *dev, int port,const u8 *eld;int ret = -EINVAL ; +mutex_lock (&dev_priv->av_mutex); - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ -if (intel_encoder) { - ret =0 ; - *enabled = intel_encoder->audio_connector !=NULL ; -if (*enabled) { - eld = intel_encoder->audio_connector->eld; - ret =drm_eld_size (eld); -memcpy (buf, eld,min (max_bytes, ret)); - } + + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id); +if (!intel_encoder) { +mutex_unlock (&dev_priv->av_mutex); +return ret; + } + + ret =0 ; + *enabled = intel_encoder->audio_connector !=NULL ; +if (*enabled) { + eld = intel_encoder->audio_connector->eld; + ret =drm_eld_size (eld); +memcpy (buf, eld,min (max_bytes, ret)); }mutex_unlock (&dev_priv->av_mutex);include/drm/i915_component.h +3
-3@@ -64,7 +64,7 @@ struct i915_audio_component_ops {* Called from audio driver. After audio driver sets the * sample rate, it will call this function to set n/cts */ -int (*sync_audio_rate)(struct device *,int port,int rate); +int (*sync_audio_rate)(struct device *,int port,int dev_id,int rate);/** * @get_eld: fill the audio state and ELD bytes for the given port * @@ -77,7 +77,7 @@ struct i915_audio_component_ops {* Note that the returned size may be over @max_bytes. Then it * implies that only a part of ELD has been copied to the buffer. */ -int (*get_eld)(struct device *,int port,bool *enabled, +int (*get_eld)(struct device *,int port,int dev_id,bool *enabled,unsigned char *buf,int max_bytes); };@@ -97,7 +97,7 @@ struct i915_audio_component_audio_ops {* status accordingly (even when the HDA controller is in power save * mode). */ -void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id); };/** include/sound/hda_i915.h +6
-5@@ -10,8 +10,9 @@int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable);int snd_hdac_display_power (struct hdac_bus *bus,bool enable);void snd_hdac_i915_set_bclk (struct hdac_bus *bus); -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate); -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate); +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes);int snd_hdac_i915_init (struct hdac_bus *bus);int snd_hdac_i915_exit (struct hdac_bus *bus);@@ -29,13 +30,13 @@ static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus) { }static inline int snd_hdac_sync_audio_rate (struct hdac_device *codec, -hda_nid_t nid,int rate) +hda_nid_t nid,int dev_id,int rate) {return 0 ; }static inline int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, -bool *audio_enabled,char *buffer, -int max_bytes) +int dev_id,bool *audio_enabled, +char *buffer,int max_bytes) {return -ENODEV ; }sound/hda/hdac_i915.c +5
-4@@ -201,7 +201,8 @@ static int pin2port(struct hdac_device *codec, hda_nid_t pin_nid)* This function sets N/CTS value based on the given sample rate. * Returns zero for success, or a negative error code. */ -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate) +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate) {struct hdac_bus *bus = codec->bus;struct i915_audio_component *acomp = bus->audio_component;@@ -212,7 +213,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate) port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->sync_audio_rate (acomp->dev, port, rate); +return acomp->ops->sync_audio_rate (acomp->dev, port, dev_id, rate); }EXPORT_SYMBOL_GPL (snd_hdac_sync_audio_rate);@@ -236,7 +237,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);* thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched. */ -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes) {struct hdac_bus *bus = codec->bus;@@ -249,7 +250,7 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->get_eld (acomp->dev, port, audio_enabled, +return acomp->ops->get_eld (acomp->dev, port, dev_id, audio_enabled, buffer, max_bytes); }EXPORT_SYMBOL_GPL (snd_hdac_acomp_get_eld);sound/pci/hda/patch_hdmi.c +4
-3@@ -1485,7 +1485,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec,mutex_lock (&per_pin->lock); eld->monitor_present = false; - size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid, + size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid,-1 , &eld->monitor_present, eld->eld_buffer,ELD_MAX_SIZE );if (size >0 ) {@@ -1739,7 +1739,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,/* Call sync_audio_rate to set the N/CTS/M manually if necessary */ /* Todo: add DP1.2 MST audio support later */ if (codec_has_acomp (codec)) -snd_hdac_sync_audio_rate (&codec->core, pin_nid, runtime->rate); +snd_hdac_sync_audio_rate (&codec->core, pin_nid,-1 , + runtime->rate); non_pcm =check_non_pcm_per_cvt (codec, cvt_nid);mutex_lock (&per_pin->lock);@@ -2285,7 +2286,7 @@ 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_pin_eld_notify (void *audio_ptr,int port) +static void intel_pin_eld_notify (void *audio_ptr,int port,int dev_id) {struct hda_codec *codec = audio_ptr;int pin_nid;Signature · 1 line
2.5.0
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 11 lines · Ville Syrjälä
Quoted 10 lines · Dhinakaran Pandiyan
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it's meaning.
dev_id=MST : pipe that the stream originates from Non-MST : -1
Quoted 9 lines
Review
Quoted 4 lines
Affected APIs:
structi915_audio_component_ops(quoted diff) +1
-1- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id,Does the term '
dev_id' have some special meaning on the audio side? On the i915 side things would be less confusing if we just called it 'pipe'.
There was quite a bit of back and forth on this. "pipe" seemed to tie us to the gfx hardware architecture. In case, there is no 1:1 mapping from pipes to encoders, this will get confusing as i915 audio registers (E.g.HSW_AUD_PIN_ELD_CP_VLD) are encoder based. Whereas, dev_id is generic - HDA spec calls them "devices" or "device entry"
Quoted 331 lines
Quoted 331 lines
(quoted diff) +3
-2+ int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int dev_id, + bool *enabled, unsigned char *buf, int max_bytes);struct
i915_audio_component_audio_opsinclude/drm/i915_component.h +1
-1-void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id);This patch makes dummy changes in the audio drivers for build to succeed.
Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++--------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)drivers/gpu/drm/i915/i915_drv.h +1
-1@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ]; -struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];/* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch drivers/gpu/drm/i915/intel_audio.c +63
-19@@ -500,6 +500,9 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + connector =drm_select_eld (encoder);if (!connector)@@ -522,14 +525,19 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) dev_priv->display.audio_codec_enable (connector, intel_encoder, adjusted_mode); +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe; +mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector = connector; +/* referred in audio callbacks */ - dev_priv->dig_port_map[port] = intel_encoder; + dev_priv->av_enc_map[pipe] = intel_encoder;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -542,22 +550,29 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)void intel_audio_codec_disable (struct intel_encoder *intel_encoder) {struct drm_encoder *encoder = &intel_encoder->base; +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc);struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv =to_i915 (dev);struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe;if (dev_priv->display.audio_codec_disable) dev_priv->display.audio_codec_disable (intel_encoder);mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector =NULL ; - dev_priv->dig_port_map[port] =NULL ; + dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -628,8 +643,32 @@ static int i915_audio_component_get_cdclk_freq(struct device *dev)return dev_priv->cdclk_freq; } -static int i915_audio_component_sync_audio_rate (struct device *dev, -int port,int rate) +static struct intel_encoder *get_saved_encoder (struct intel_encoder *av_enc_map[], +int port,int dev_id) +{ + +enum pipe pipe; +struct drm_encoder *encoder; + +if (dev_id >=0 && dev_id <I915_MAX_PIPES ) +return av_enc_map[dev_id]; + +for (pipe =PIPE_A ; pipe <I915_MAX_PIPES ; pipe++) { + +if (!av_enc_map[pipe]) +continue ; + + encoder = &av_enc_map[pipe]->base; +if (port ==enc_to_dig_port (encoder)->port) +return av_enc_map[pipe]; + } + +return NULL ; + +} + +static int i915_audio_component_sync_audio_rate (struct device *dev,int port, +int dev_id,int rate) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);struct intel_encoder *intel_encoder;@@ -649,15 +688,16 @@ static int i915_audio_component_sync_audio_rate(struct device *dev,return 0 ;mutex_lock (&dev_priv->av_mutex); +/* 1. get the pipe */ - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id);if (!intel_encoder || !intel_encoder->base.crtc || intel_encoder->type !=INTEL_OUTPUT_HDMI ) {DRM_DEBUG_KMS ("no valid port %c\n" ,port_name (port)); err = -ENODEV ; goto unlock; } + crtc =to_intel_crtc (intel_encoder->base.crtc); pipe = crtc->pipe;if (pipe ==INVALID_PIPE ) {@@ -702,7 +742,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, }static int i915_audio_component_get_eld (struct device *dev,int port, -bool *enabled, +int dev_id,bool *enabled,unsigned char *buf,int max_bytes) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);@@ -710,17 +750,21 @@ static int i915_audio_component_get_eld(struct device *dev, int port,const u8 *eld;int ret = -EINVAL ; +mutex_lock (&dev_priv->av_mutex); - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ -if (intel_encoder) { - ret =0 ; - *enabled = intel_encoder->audio_connector !=NULL ; -if (*enabled) { - eld = intel_encoder->audio_connector->eld; - ret =drm_eld_size (eld); -memcpy (buf, eld,min (max_bytes, ret)); - } + + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id); +if (!intel_encoder) { +mutex_unlock (&dev_priv->av_mutex); +return ret; + } + + ret =0 ; + *enabled = intel_encoder->audio_connector !=NULL ; +if (*enabled) { + eld = intel_encoder->audio_connector->eld; + ret =drm_eld_size (eld); +memcpy (buf, eld,min (max_bytes, ret)); }mutex_unlock (&dev_priv->av_mutex);include/drm/i915_component.h +3
-3@@ -64,7 +64,7 @@ struct i915_audio_component_ops {* Called from audio driver. After audio driver sets the * sample rate, it will call this function to set n/cts */ -int (*sync_audio_rate)(struct device *,int port,int rate); +int (*sync_audio_rate)(struct device *,int port,int dev_id,int rate);/** * @get_eld: fill the audio state and ELD bytes for the given port * @@ -77,7 +77,7 @@ struct i915_audio_component_ops {* Note that the returned size may be over @max_bytes. Then it * implies that only a part of ELD has been copied to the buffer. */ -int (*get_eld)(struct device *,int port,bool *enabled, +int (*get_eld)(struct device *,int port,int dev_id,bool *enabled,unsigned char *buf,int max_bytes); };@@ -97,7 +97,7 @@ struct i915_audio_component_audio_ops {* status accordingly (even when the HDA controller is in power save * mode). */ -void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id); };/** include/sound/hda_i915.h +6
-5@@ -10,8 +10,9 @@int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable);int snd_hdac_display_power (struct hdac_bus *bus,bool enable);void snd_hdac_i915_set_bclk (struct hdac_bus *bus); -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate); -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate); +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes);int snd_hdac_i915_init (struct hdac_bus *bus);int snd_hdac_i915_exit (struct hdac_bus *bus);@@ -29,13 +30,13 @@ static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus) { }static inline int snd_hdac_sync_audio_rate (struct hdac_device *codec, -hda_nid_t nid,int rate) +hda_nid_t nid,int dev_id,int rate) {return 0 ; }static inline int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, -bool *audio_enabled,char *buffer, -int max_bytes) +int dev_id,bool *audio_enabled, +char *buffer,int max_bytes) {return -ENODEV ; }sound/hda/hdac_i915.c +5
-4@@ -201,7 +201,8 @@ static int pin2port(struct hdac_device *codec, hda_nid_t pin_nid)* This function sets N/CTS value based on the given sample rate. * Returns zero for success, or a negative error code. */ -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate) +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate) {struct hdac_bus *bus = codec->bus;struct i915_audio_component *acomp = bus->audio_component;@@ -212,7 +213,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate) port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->sync_audio_rate (acomp->dev, port, rate); +return acomp->ops->sync_audio_rate (acomp->dev, port, dev_id, rate); }EXPORT_SYMBOL_GPL (snd_hdac_sync_audio_rate);@@ -236,7 +237,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);* thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched. */ -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes) {struct hdac_bus *bus = codec->bus;@@ -249,7 +250,7 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->get_eld (acomp->dev, port, audio_enabled, +return acomp->ops->get_eld (acomp->dev, port, dev_id, audio_enabled, buffer, max_bytes); }EXPORT_SYMBOL_GPL (snd_hdac_acomp_get_eld);sound/pci/hda/patch_hdmi.c +3
-2@@ -1485,7 +1485,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec,mutex_lock (&per_pin->lock); eld->monitor_present = false; - size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid, + size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid,-1 , &eld->monitor_present, eld->eld_buffer,ELD_MAX_SIZE );if (size >0 ) {@@ -1739,7 +1739,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,/* Call sync_audio_rate to set the N/CTS/M manually if necessary */ /* Todo: add DP1.2 MST audio support later */ if (codec_has_acomp (codec)) -snd_hdac_sync_audio_rate (&codec->core, pin_nid, runtime->rate); +snd_hdac_sync_audio_rate (&codec->core, pin_nid,-1 , + runtime->rate); non_pcm =check_non_pcm_per_cvt (codec, cvt_nid);mutex_lock (&per_pin->lock);@@ -2285,7 +2286,7 @@ 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); }
Quoted 8 lines
Quoted 7 lines
sound/pci/hda/patch_hdmi.c +1
-1-static void intel_pin_eld_notify (void *audio_ptr,int port) +static void intel_pin_eld_notify (void *audio_ptr,int port,int dev_id) {struct hda_codec *codec = audio_ptr;int pin_nid;Signature · 1 line
2.5.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 22 lines · Dhinakaran
Quoted 11 lines · Ville Syrjälä
Quoted 10 lines · Dhinakaran Pandiyan
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it's meaning.
dev_id=MST : pipe that the stream originates from Non-MST : -1Quoted 9 lines
Review
Quoted 4 lines
Affected APIs:
structi915_audio_component_ops(quoted diff) +1
-1- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id,Does the term '
dev_id' have some special meaning on the audio side? On the i915 side things would be less confusing if we just called it 'pipe'.
Quoted 4 lines
There was quite a bit of back and forth on this. "pipe" seemed to tie us to the gfx hardware architecture. In case, there is no 1:1 mapping from pipes to encoders, this will get confusing as i915 audio registers (E.g.HSW_AUD_PIN_ELD_CP_VLD) are encoder based.
I'm not following. Looking at the current i915 audio code, on HSW+ everything is pipe based.
Quoted 2 lines
Whereas,
dev_idis
generic - HDA spec calls them "devices" or "device entry"
Generic and totally unclear what it means from graphics side.
pipe and port are the only things we really have in i915. If those aren't good enough for the audio side, then I think we should have some decent code to remap between the pipe+port vs. whatever audio side id is needed. I don't really care on which side of the border such code would live, as long as it's clear what it's doing.
Quoted 341 lines
Quoted 340 lines
Quoted 339 lines
(quoted diff) +3
-2+ int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int dev_id, + bool *enabled, unsigned char *buf, int max_bytes);struct
i915_audio_component_audio_opsinclude/drm/i915_component.h +1
-1-void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id);This patch makes dummy changes in the audio drivers for build to succeed.
Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++--------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)drivers/gpu/drm/i915/i915_drv.h +1
-1@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ]; -struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];/* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch drivers/gpu/drm/i915/intel_audio.c +63
-19@@ -500,6 +500,9 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + connector =drm_select_eld (encoder);if (!connector)@@ -522,14 +525,19 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) dev_priv->display.audio_codec_enable (connector, intel_encoder, adjusted_mode); +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe; +mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector = connector; +/* referred in audio callbacks */ - dev_priv->dig_port_map[port] = intel_encoder; + dev_priv->av_enc_map[pipe] = intel_encoder;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -542,22 +550,29 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)void intel_audio_codec_disable (struct intel_encoder *intel_encoder) {struct drm_encoder *encoder = &intel_encoder->base; +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc);struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv =to_i915 (dev);struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe;if (dev_priv->display.audio_codec_disable) dev_priv->display.audio_codec_disable (intel_encoder);mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector =NULL ; - dev_priv->dig_port_map[port] =NULL ; + dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -628,8 +643,32 @@ static int i915_audio_component_get_cdclk_freq(struct device *dev)return dev_priv->cdclk_freq; } -static int i915_audio_component_sync_audio_rate (struct device *dev, -int port,int rate) +static struct intel_encoder *get_saved_encoder (struct intel_encoder *av_enc_map[], +int port,int dev_id) +{ + +enum pipe pipe; +struct drm_encoder *encoder; + +if (dev_id >=0 && dev_id <I915_MAX_PIPES ) +return av_enc_map[dev_id]; + +for (pipe =PIPE_A ; pipe <I915_MAX_PIPES ; pipe++) { + +if (!av_enc_map[pipe]) +continue ; + + encoder = &av_enc_map[pipe]->base; +if (port ==enc_to_dig_port (encoder)->port) +return av_enc_map[pipe]; + } + +return NULL ; + +} + +static int i915_audio_component_sync_audio_rate (struct device *dev,int port, +int dev_id,int rate) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);struct intel_encoder *intel_encoder;@@ -649,15 +688,16 @@ static int i915_audio_component_sync_audio_rate(struct device *dev,return 0 ;mutex_lock (&dev_priv->av_mutex); +/* 1. get the pipe */ - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id);if (!intel_encoder || !intel_encoder->base.crtc || intel_encoder->type !=INTEL_OUTPUT_HDMI ) {DRM_DEBUG_KMS ("no valid port %c\n" ,port_name (port)); err = -ENODEV ; goto unlock; } + crtc =to_intel_crtc (intel_encoder->base.crtc); pipe = crtc->pipe;if (pipe ==INVALID_PIPE ) {@@ -702,7 +742,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, }static int i915_audio_component_get_eld (struct device *dev,int port, -bool *enabled, +int dev_id,bool *enabled,unsigned char *buf,int max_bytes) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);@@ -710,17 +750,21 @@ static int i915_audio_component_get_eld(struct device *dev, int port,const u8 *eld;int ret = -EINVAL ; +mutex_lock (&dev_priv->av_mutex); - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ -if (intel_encoder) { - ret =0 ; - *enabled = intel_encoder->audio_connector !=NULL ; -if (*enabled) { - eld = intel_encoder->audio_connector->eld; - ret =drm_eld_size (eld); -memcpy (buf, eld,min (max_bytes, ret)); - } + + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id); +if (!intel_encoder) { +mutex_unlock (&dev_priv->av_mutex); +return ret; + } + + ret =0 ; + *enabled = intel_encoder->audio_connector !=NULL ; +if (*enabled) { + eld = intel_encoder->audio_connector->eld; + ret =drm_eld_size (eld); +memcpy (buf, eld,min (max_bytes, ret)); }mutex_unlock (&dev_priv->av_mutex);include/drm/i915_component.h +3
-3@@ -64,7 +64,7 @@ struct i915_audio_component_ops {* Called from audio driver. After audio driver sets the * sample rate, it will call this function to set n/cts */ -int (*sync_audio_rate)(struct device *,int port,int rate); +int (*sync_audio_rate)(struct device *,int port,int dev_id,int rate);/** * @get_eld: fill the audio state and ELD bytes for the given port * @@ -77,7 +77,7 @@ struct i915_audio_component_ops {* Note that the returned size may be over @max_bytes. Then it * implies that only a part of ELD has been copied to the buffer. */ -int (*get_eld)(struct device *,int port,bool *enabled, +int (*get_eld)(struct device *,int port,int dev_id,bool *enabled,unsigned char *buf,int max_bytes); };@@ -97,7 +97,7 @@ struct i915_audio_component_audio_ops {* status accordingly (even when the HDA controller is in power save * mode). */ -void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id); };/** include/sound/hda_i915.h +6
-5@@ -10,8 +10,9 @@int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable);int snd_hdac_display_power (struct hdac_bus *bus,bool enable);void snd_hdac_i915_set_bclk (struct hdac_bus *bus); -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate); -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate); +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes);int snd_hdac_i915_init (struct hdac_bus *bus);int snd_hdac_i915_exit (struct hdac_bus *bus);@@ -29,13 +30,13 @@ static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus) { }static inline int snd_hdac_sync_audio_rate (struct hdac_device *codec, -hda_nid_t nid,int rate) +hda_nid_t nid,int dev_id,int rate) {return 0 ; }static inline int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, -bool *audio_enabled,char *buffer, -int max_bytes) +int dev_id,bool *audio_enabled, +char *buffer,int max_bytes) {return -ENODEV ; }sound/hda/hdac_i915.c +5
-4@@ -201,7 +201,8 @@ static int pin2port(struct hdac_device *codec, hda_nid_t pin_nid)* This function sets N/CTS value based on the given sample rate. * Returns zero for success, or a negative error code. */ -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate) +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate) {struct hdac_bus *bus = codec->bus;struct i915_audio_component *acomp = bus->audio_component;@@ -212,7 +213,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate) port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->sync_audio_rate (acomp->dev, port, rate); +return acomp->ops->sync_audio_rate (acomp->dev, port, dev_id, rate); }EXPORT_SYMBOL_GPL (snd_hdac_sync_audio_rate);@@ -236,7 +237,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);* thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched. */ -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes) {struct hdac_bus *bus = codec->bus;@@ -249,7 +250,7 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->get_eld (acomp->dev, port, audio_enabled, +return acomp->ops->get_eld (acomp->dev, port, dev_id, audio_enabled, buffer, max_bytes); }EXPORT_SYMBOL_GPL (snd_hdac_acomp_get_eld);sound/pci/hda/patch_hdmi.c +4
-3@@ -1485,7 +1485,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec,mutex_lock (&per_pin->lock); eld->monitor_present = false; - size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid, + size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid,-1 , &eld->monitor_present, eld->eld_buffer,ELD_MAX_SIZE );if (size >0 ) {@@ -1739,7 +1739,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,/* Call sync_audio_rate to set the N/CTS/M manually if necessary */ /* Todo: add DP1.2 MST audio support later */ if (codec_has_acomp (codec)) -snd_hdac_sync_audio_rate (&codec->core, pin_nid, runtime->rate); +snd_hdac_sync_audio_rate (&codec->core, pin_nid,-1 , + runtime->rate); non_pcm =check_non_pcm_per_cvt (codec, cvt_nid);mutex_lock (&per_pin->lock);@@ -2285,7 +2286,7 @@ 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_pin_eld_notify (void *audio_ptr,int port) +static void intel_pin_eld_notify (void *audio_ptr,int port,int dev_id) {struct hda_codec *codec = audio_ptr;int pin_nid;Signature · 1 line
2.5.0
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 23 lines · Ville Syrjälä
Quoted 22 lines · Dhinakaran
Quoted 20 lines · Ville Syrjälä
Quoted 12 lines · Dhinakaran Pandiyan
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it's meaning.
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_opsReview
Quoted 2 lines
(quoted diff) +1
-1- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id,Does the term '
dev_id' have some special meaning on the audio side? On the i915 side things would be less confusing if we just called it 'pipe'.
Quoted 8 lines
Quoted 4 lines
There was quite a bit of back and forth on this. "pipe" seemed to tie us to the gfx hardware architecture. In case, there is no 1:1 mapping from pipes to encoders, this will get confusing as i915 audio registers (E.g.HSW_AUD_PIN_ELD_CP_VLD) are encoder based.
I'm not following. Looking at the current i915 audio code, on HSW+ everything is pipe based.
Although we pass "pipe" to these macros, the definition here and in the BSpec seem to indicate they are based on the encoder.
Eg: #define HSW_AUD_PIN_ELD_CP_VLD _MMIO(0x650c0)
#define AUDIO_INACTIVE(trans) ((1 << 3) << ((trans) * 4)) #define AUDIO_OUTPUT_ENABLE(trans) ((1 << 2) << ((trans) * 4)) #define AUDIO_CP_READY(trans) ((1 << 1) << ((trans) * 4)) #define AUDIO_ELD_VALID(trans) ((1 << 0) << ((trans) * 4))
Quoted 11 lines
Quoted 2 lines
Whereas,
dev_idis
generic - HDA spec calls them "devices" or "device entry"Generic and totally unclear what it means from graphics side.
pipe and port are the only things we really have in i915. If those aren't good enough for the audio side, then I think we should have some decent code to remap between the pipe+port vs. whatever audio side id is needed. I don't really care on which side of the border such code would live, as long as it's clear what it's doing.
I agree, dev_id can be misleading within i915.
Quoted 332 lines
Quoted 332 lines
Quoted 332 lines
Quoted 332 lines
(quoted diff) +3
-2+ int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int dev_id, + bool *enabled, unsigned char *buf, int max_bytes);struct
i915_audio_component_audio_opsinclude/drm/i915_component.h +1
-1-void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id);This patch makes dummy changes in the audio drivers for build to succeed.
Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++--------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)drivers/gpu/drm/i915/i915_drv.h +1
-1@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ]; -struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];/* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch drivers/gpu/drm/i915/intel_audio.c +63
-19@@ -500,6 +500,9 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + connector =drm_select_eld (encoder);if (!connector)@@ -522,14 +525,19 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) dev_priv->display.audio_codec_enable (connector, intel_encoder, adjusted_mode); +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe; +mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector = connector; +/* referred in audio callbacks */ - dev_priv->dig_port_map[port] = intel_encoder; + dev_priv->av_enc_map[pipe] = intel_encoder;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -542,22 +550,29 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)void intel_audio_codec_disable (struct intel_encoder *intel_encoder) {struct drm_encoder *encoder = &intel_encoder->base; +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc);struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv =to_i915 (dev);struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe;if (dev_priv->display.audio_codec_disable) dev_priv->display.audio_codec_disable (intel_encoder);mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector =NULL ; - dev_priv->dig_port_map[port] =NULL ; + dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -628,8 +643,32 @@ static int i915_audio_component_get_cdclk_freq(struct device *dev)return dev_priv->cdclk_freq; } -static int i915_audio_component_sync_audio_rate (struct device *dev, -int port,int rate) +static struct intel_encoder *get_saved_encoder (struct intel_encoder *av_enc_map[], +int port,int dev_id) +{ + +enum pipe pipe; +struct drm_encoder *encoder; + +if (dev_id >=0 && dev_id <I915_MAX_PIPES ) +return av_enc_map[dev_id]; + +for (pipe =PIPE_A ; pipe <I915_MAX_PIPES ; pipe++) { + +if (!av_enc_map[pipe]) +continue ; + + encoder = &av_enc_map[pipe]->base; +if (port ==enc_to_dig_port (encoder)->port) +return av_enc_map[pipe]; + } + +return NULL ; + +} + +static int i915_audio_component_sync_audio_rate (struct device *dev,int port, +int dev_id,int rate) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);struct intel_encoder *intel_encoder;@@ -649,15 +688,16 @@ static int i915_audio_component_sync_audio_rate(struct device *dev,return 0 ;mutex_lock (&dev_priv->av_mutex); +/* 1. get the pipe */ - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id);if (!intel_encoder || !intel_encoder->base.crtc || intel_encoder->type !=INTEL_OUTPUT_HDMI ) {DRM_DEBUG_KMS ("no valid port %c\n" ,port_name (port)); err = -ENODEV ; goto unlock; } + crtc =to_intel_crtc (intel_encoder->base.crtc); pipe = crtc->pipe;if (pipe ==INVALID_PIPE ) {@@ -702,7 +742,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, }static int i915_audio_component_get_eld (struct device *dev,int port, -bool *enabled, +int dev_id,bool *enabled,unsigned char *buf,int max_bytes) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);@@ -710,17 +750,21 @@ static int i915_audio_component_get_eld(struct device *dev, int port,const u8 *eld;int ret = -EINVAL ; +mutex_lock (&dev_priv->av_mutex); - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ -if (intel_encoder) { - ret =0 ; - *enabled = intel_encoder->audio_connector !=NULL ; -if (*enabled) { - eld = intel_encoder->audio_connector->eld; - ret =drm_eld_size (eld); -memcpy (buf, eld,min (max_bytes, ret)); - } + + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id); +if (!intel_encoder) { +mutex_unlock (&dev_priv->av_mutex); +return ret; + } + + ret =0 ; + *enabled = intel_encoder->audio_connector !=NULL ; +if (*enabled) { + eld = intel_encoder->audio_connector->eld; + ret =drm_eld_size (eld); +memcpy (buf, eld,min (max_bytes, ret)); }mutex_unlock (&dev_priv->av_mutex);include/drm/i915_component.h +3
-3@@ -64,7 +64,7 @@ struct i915_audio_component_ops {* Called from audio driver. After audio driver sets the * sample rate, it will call this function to set n/cts */ -int (*sync_audio_rate)(struct device *,int port,int rate); +int (*sync_audio_rate)(struct device *,int port,int dev_id,int rate);/** * @get_eld: fill the audio state and ELD bytes for the given port * @@ -77,7 +77,7 @@ struct i915_audio_component_ops {* Note that the returned size may be over @max_bytes. Then it * implies that only a part of ELD has been copied to the buffer. */ -int (*get_eld)(struct device *,int port,bool *enabled, +int (*get_eld)(struct device *,int port,int dev_id,bool *enabled,unsigned char *buf,int max_bytes); };@@ -97,7 +97,7 @@ struct i915_audio_component_audio_ops {* status accordingly (even when the HDA controller is in power save * mode). */ -void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id); };/** include/sound/hda_i915.h +6
-5@@ -10,8 +10,9 @@int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable);int snd_hdac_display_power (struct hdac_bus *bus,bool enable);void snd_hdac_i915_set_bclk (struct hdac_bus *bus); -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate); -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate); +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes);int snd_hdac_i915_init (struct hdac_bus *bus);int snd_hdac_i915_exit (struct hdac_bus *bus);@@ -29,13 +30,13 @@ static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus) { }static inline int snd_hdac_sync_audio_rate (struct hdac_device *codec, -hda_nid_t nid,int rate) +hda_nid_t nid,int dev_id,int rate) {return 0 ; }static inline int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, -bool *audio_enabled,char *buffer, -int max_bytes) +int dev_id,bool *audio_enabled, +char *buffer,int max_bytes) {return -ENODEV ; }sound/hda/hdac_i915.c +5
-4@@ -201,7 +201,8 @@ static int pin2port(struct hdac_device *codec, hda_nid_t pin_nid)* This function sets N/CTS value based on the given sample rate. * Returns zero for success, or a negative error code. */ -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate) +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate) {struct hdac_bus *bus = codec->bus;struct i915_audio_component *acomp = bus->audio_component;@@ -212,7 +213,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate) port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->sync_audio_rate (acomp->dev, port, rate); +return acomp->ops->sync_audio_rate (acomp->dev, port, dev_id, rate); }EXPORT_SYMBOL_GPL (snd_hdac_sync_audio_rate);@@ -236,7 +237,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);* thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched. */ -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes) {struct hdac_bus *bus = codec->bus;@@ -249,7 +250,7 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->get_eld (acomp->dev, port, audio_enabled, +return acomp->ops->get_eld (acomp->dev, port, dev_id, audio_enabled, buffer, max_bytes); }EXPORT_SYMBOL_GPL (snd_hdac_acomp_get_eld);sound/pci/hda/patch_hdmi.c +3
-2@@ -1485,7 +1485,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec,mutex_lock (&per_pin->lock); eld->monitor_present = false; - size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid, + size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid,-1 , &eld->monitor_present, eld->eld_buffer,ELD_MAX_SIZE );if (size >0 ) {@@ -1739,7 +1739,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,/* Call sync_audio_rate to set the N/CTS/M manually if necessary */ /* Todo: add DP1.2 MST audio support later */ if (codec_has_acomp (codec)) -snd_hdac_sync_audio_rate (&codec->core, pin_nid, runtime->rate); +snd_hdac_sync_audio_rate (&codec->core, pin_nid,-1 , + runtime->rate); non_pcm =check_non_pcm_per_cvt (codec, cvt_nid);mutex_lock (&per_pin->lock);@@ -2285,7 +2286,7 @@ 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); }
Quoted 10 lines
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
sound/pci/hda/patch_hdmi.c +1
-1-static void intel_pin_eld_notify (void *audio_ptr,int port) +static void intel_pin_eld_notify (void *audio_ptr,int port,int dev_id) {struct hda_codec *codec = audio_ptr;int pin_nid;Signature · 1 line
2.5.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 32 lines · Dhinakaran
Quoted 23 lines · Ville Syrjälä
Quoted 22 lines · Dhinakaran
Quoted 20 lines · Ville Syrjälä
Quoted 12 lines · Dhinakaran Pandiyan
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it's meaning.
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_opsReview
Quoted 2 lines
(quoted diff) +1
-1- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id,Does the term '
dev_id' have some special meaning on the audio side? On the i915 side things would be less confusing if we just called it 'pipe'.Quoted 8 lines
Quoted 4 lines
There was quite a bit of back and forth on this. "pipe" seemed to tie us to the gfx hardware architecture. In case, there is no 1:1 mapping from pipes to encoders, this will get confusing as i915 audio registers (E.g.HSW_AUD_PIN_ELD_CP_VLD) are encoder based.
I'm not following. Looking at the current i915 audio code, on HSW+ everything is pipe based.
Quoted 8 lines
Although we pass "pipe" to these macros, the definition here and in the BSpec seem to indicate they are based on the encoder.
Eg: #define
HSW_AUD_PIN_ELD_CP_VLD_MMIO(0x650c0)#define AUDIO_INACTIVE(trans) ((1 << 3) << ((trans) * 4)) #define AUDIO_OUTPUT_ENABLE(trans) ((1 << 2) << ((trans) * 4)) #define AUDIO_CP_READY(trans) ((1 << 1) << ((trans) * 4)) #define AUDIO_ELD_VALID(trans) ((1 << 0) << ((trans) * 4))
That's transcoder, not encoder. transcoder is the tail end of the pipe. For all the external ports transcoder==pipe, and for port A there is the special edp transcoder which can be fed by any pipe. The edp transcoder doesn't support audio though, and I can't see anything in the spec to suggest that it would gain audio capabilities, in the near future at least. So from that point of view passing around the pipe would seem like a safe approach.
We could of course pass around transcoder instead of pipe. Since we don't ever need to enable audio on the edp transcoder, we don't even have to worry about what number we assign to it. And hence it is actually the same as passing the pipe, except in name.
Quoted 358 lines
Quoted 5 lines
Quoted 4 lines
Whereas,
dev_idis
generic - HDA spec calls them "devices" or "device entry"Quoted 8 lines
Generic and totally unclear what it means from graphics side.
pipe and port are the only things we really have in i915. If those aren't good enough for the audio side, then I think we should have some decent code to remap between the pipe+port vs. whatever audio side id is needed. I don't really care on which side of the border such code would live, as long as it's clear what it's doing.
I agree,
dev_idcan be misleading within i915.Quoted 342 lines
Quoted 341 lines
Quoted 340 lines
Quoted 339 lines
(quoted diff) +3
-2+ int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int dev_id, + bool *enabled, unsigned char *buf, int max_bytes);struct
i915_audio_component_audio_opsinclude/drm/i915_component.h +1
-1-void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id);This patch makes dummy changes in the audio drivers for build to succeed.
Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++--------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)drivers/gpu/drm/i915/i915_drv.h +1
-1@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ]; -struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];/* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch drivers/gpu/drm/i915/intel_audio.c +63
-19@@ -500,6 +500,9 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + connector =drm_select_eld (encoder);if (!connector)@@ -522,14 +525,19 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) dev_priv->display.audio_codec_enable (connector, intel_encoder, adjusted_mode); +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe; +mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector = connector; +/* referred in audio callbacks */ - dev_priv->dig_port_map[port] = intel_encoder; + dev_priv->av_enc_map[pipe] = intel_encoder;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -542,22 +550,29 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)void intel_audio_codec_disable (struct intel_encoder *intel_encoder) {struct drm_encoder *encoder = &intel_encoder->base; +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc);struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv =to_i915 (dev);struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe;if (dev_priv->display.audio_codec_disable) dev_priv->display.audio_codec_disable (intel_encoder);mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector =NULL ; - dev_priv->dig_port_map[port] =NULL ; + dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -628,8 +643,32 @@ static int i915_audio_component_get_cdclk_freq(struct device *dev)return dev_priv->cdclk_freq; } -static int i915_audio_component_sync_audio_rate (struct device *dev, -int port,int rate) +static struct intel_encoder *get_saved_encoder (struct intel_encoder *av_enc_map[], +int port,int dev_id) +{ + +enum pipe pipe; +struct drm_encoder *encoder; + +if (dev_id >=0 && dev_id <I915_MAX_PIPES ) +return av_enc_map[dev_id]; + +for (pipe =PIPE_A ; pipe <I915_MAX_PIPES ; pipe++) { + +if (!av_enc_map[pipe]) +continue ; + + encoder = &av_enc_map[pipe]->base; +if (port ==enc_to_dig_port (encoder)->port) +return av_enc_map[pipe]; + } + +return NULL ; + +} + +static int i915_audio_component_sync_audio_rate (struct device *dev,int port, +int dev_id,int rate) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);struct intel_encoder *intel_encoder;@@ -649,15 +688,16 @@ static int i915_audio_component_sync_audio_rate(struct device *dev,return 0 ;mutex_lock (&dev_priv->av_mutex); +/* 1. get the pipe */ - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id);if (!intel_encoder || !intel_encoder->base.crtc || intel_encoder->type !=INTEL_OUTPUT_HDMI ) {DRM_DEBUG_KMS ("no valid port %c\n" ,port_name (port)); err = -ENODEV ; goto unlock; } + crtc =to_intel_crtc (intel_encoder->base.crtc); pipe = crtc->pipe;if (pipe ==INVALID_PIPE ) {@@ -702,7 +742,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, }static int i915_audio_component_get_eld (struct device *dev,int port, -bool *enabled, +int dev_id,bool *enabled,unsigned char *buf,int max_bytes) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);@@ -710,17 +750,21 @@ static int i915_audio_component_get_eld(struct device *dev, int port,const u8 *eld;int ret = -EINVAL ; +mutex_lock (&dev_priv->av_mutex); - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ -if (intel_encoder) { - ret =0 ; - *enabled = intel_encoder->audio_connector !=NULL ; -if (*enabled) { - eld = intel_encoder->audio_connector->eld; - ret =drm_eld_size (eld); -memcpy (buf, eld,min (max_bytes, ret)); - } + + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id); +if (!intel_encoder) { +mutex_unlock (&dev_priv->av_mutex); +return ret; + } + + ret =0 ; + *enabled = intel_encoder->audio_connector !=NULL ; +if (*enabled) { + eld = intel_encoder->audio_connector->eld; + ret =drm_eld_size (eld); +memcpy (buf, eld,min (max_bytes, ret)); }mutex_unlock (&dev_priv->av_mutex);include/drm/i915_component.h +3
-3@@ -64,7 +64,7 @@ struct i915_audio_component_ops {* Called from audio driver. After audio driver sets the * sample rate, it will call this function to set n/cts */ -int (*sync_audio_rate)(struct device *,int port,int rate); +int (*sync_audio_rate)(struct device *,int port,int dev_id,int rate);/** * @get_eld: fill the audio state and ELD bytes for the given port * @@ -77,7 +77,7 @@ struct i915_audio_component_ops {* Note that the returned size may be over @max_bytes. Then it * implies that only a part of ELD has been copied to the buffer. */ -int (*get_eld)(struct device *,int port,bool *enabled, +int (*get_eld)(struct device *,int port,int dev_id,bool *enabled,unsigned char *buf,int max_bytes); };@@ -97,7 +97,7 @@ struct i915_audio_component_audio_ops {* status accordingly (even when the HDA controller is in power save * mode). */ -void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id); };/** include/sound/hda_i915.h +6
-5@@ -10,8 +10,9 @@int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable);int snd_hdac_display_power (struct hdac_bus *bus,bool enable);void snd_hdac_i915_set_bclk (struct hdac_bus *bus); -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate); -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate); +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes);int snd_hdac_i915_init (struct hdac_bus *bus);int snd_hdac_i915_exit (struct hdac_bus *bus);@@ -29,13 +30,13 @@ static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus) { }static inline int snd_hdac_sync_audio_rate (struct hdac_device *codec, -hda_nid_t nid,int rate) +hda_nid_t nid,int dev_id,int rate) {return 0 ; }static inline int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, -bool *audio_enabled,char *buffer, -int max_bytes) +int dev_id,bool *audio_enabled, +char *buffer,int max_bytes) {return -ENODEV ; }sound/hda/hdac_i915.c +5
-4@@ -201,7 +201,8 @@ static int pin2port(struct hdac_device *codec, hda_nid_t pin_nid)* This function sets N/CTS value based on the given sample rate. * Returns zero for success, or a negative error code. */ -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate) +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate) {struct hdac_bus *bus = codec->bus;struct i915_audio_component *acomp = bus->audio_component;@@ -212,7 +213,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate) port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->sync_audio_rate (acomp->dev, port, rate); +return acomp->ops->sync_audio_rate (acomp->dev, port, dev_id, rate); }EXPORT_SYMBOL_GPL (snd_hdac_sync_audio_rate);@@ -236,7 +237,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);* thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched. */ -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes) {struct hdac_bus *bus = codec->bus;@@ -249,7 +250,7 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->get_eld (acomp->dev, port, audio_enabled, +return acomp->ops->get_eld (acomp->dev, port, dev_id, audio_enabled, buffer, max_bytes); }EXPORT_SYMBOL_GPL (snd_hdac_acomp_get_eld);sound/pci/hda/patch_hdmi.c +4
-3@@ -1485,7 +1485,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec,mutex_lock (&per_pin->lock); eld->monitor_present = false; - size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid, + size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid,-1 , &eld->monitor_present, eld->eld_buffer,ELD_MAX_SIZE );if (size >0 ) {@@ -1739,7 +1739,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,/* Call sync_audio_rate to set the N/CTS/M manually if necessary */ /* Todo: add DP1.2 MST audio support later */ if (codec_has_acomp (codec)) -snd_hdac_sync_audio_rate (&codec->core, pin_nid, runtime->rate); +snd_hdac_sync_audio_rate (&codec->core, pin_nid,-1 , + runtime->rate); non_pcm =check_non_pcm_per_cvt (codec, cvt_nid);mutex_lock (&per_pin->lock);@@ -2285,7 +2286,7 @@ 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_pin_eld_notify (void *audio_ptr,int port) +static void intel_pin_eld_notify (void *audio_ptr,int port,int dev_id) {struct hda_codec *codec = audio_ptr;int pin_nid;Signature · 1 line
2.5.0
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 50 lines · Ville Syrjälä
Quoted 32 lines · Dhinakaran
Quoted 23 lines · Ville Syrjälä
Quoted 22 lines · Dhinakaran
Quoted 20 lines · Ville Syrjälä
Quoted 12 lines · Dhinakaran Pandiyan
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it's meaning.
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_opsReview
Quoted 2 lines
(quoted diff) +1
-1- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id,Does the term '
dev_id' have some special meaning on the audio side? On the i915 side things would be less confusing if we just called it 'pipe'.Quoted 8 lines
Quoted 4 lines
There was quite a bit of back and forth on this. "pipe" seemed to tie us to the gfx hardware architecture. In case, there is no 1:1 mapping from pipes to encoders, this will get confusing as i915 audio registers (E.g.HSW_AUD_PIN_ELD_CP_VLD) are encoder based.
I'm not following. Looking at the current i915 audio code, on HSW+ everything is pipe based.
Quoted 8 lines
Although we pass "pipe" to these macros, the definition here and in the BSpec seem to indicate they are based on the encoder.
Eg: #define
HSW_AUD_PIN_ELD_CP_VLD_MMIO(0x650c0)#define AUDIO_INACTIVE(trans) ((1 << 3) << ((trans) * 4)) #define AUDIO_OUTPUT_ENABLE(trans) ((1 << 2) << ((trans) * 4)) #define AUDIO_CP_READY(trans) ((1 << 1) << ((trans) * 4)) #define AUDIO_ELD_VALID(trans) ((1 << 0) << ((trans) * 4))That's transcoder, not encoder. transcoder is the tail end of the pipe. For all the external ports transcoder==pipe, and for port A there is the special edp transcoder which can be fed by any pipe. The edp transcoder doesn't support audio though, and I can't see anything in the spec to suggest that it would gain audio capabilities, in the near future at least. So from that point of view passing around the pipe would seem like a safe approach.
Quoted 5 lines
We could of course pass around transcoder instead of pipe. Since we don't ever need to enable audio on the edp transcoder, we don't even have to worry about what number we assign to it. And hence it is actually the same as passing the pipe, except in name.
Thanks for the detailed explanation, makes sense to change it to "pipe".
I will send out a new version. Do you recommend I send this patch with
"Prep. for DP audio MST support" series
(https://lists.freedesktop.org/archives/intel-gfx/2016-August/102399.html)? This patch depends on the some of the patches in that. I had separated this patch out because of the audio driver changes in this.
Quoted 347 lines
Quoted 347 lines
Quoted 5 lines
Quoted 4 lines
Whereas,
dev_idis
generic - HDA spec calls them "devices" or "device entry"Quoted 8 lines
Generic and totally unclear what it means from graphics side.
pipe and port are the only things we really have in i915. If those aren't good enough for the audio side, then I think we should have some decent code to remap between the pipe+port vs. whatever audio side id is needed. I don't really care on which side of the border such code would live, as long as it's clear what it's doing.
I agree,
dev_idcan be misleading within i915.Quoted 332 lines
Quoted 332 lines
Quoted 332 lines
Quoted 332 lines
(quoted diff) +3
-2+ int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int dev_id, + bool *enabled, unsigned char *buf, int max_bytes);struct
i915_audio_component_audio_opsinclude/drm/i915_component.h +1
-1-void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id);This patch makes dummy changes in the audio drivers for build to succeed.
Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++--------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)drivers/gpu/drm/i915/i915_drv.h +1
-1@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ]; -struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];/* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch drivers/gpu/drm/i915/intel_audio.c +63
-19@@ -500,6 +500,9 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + connector =drm_select_eld (encoder);if (!connector)@@ -522,14 +525,19 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) dev_priv->display.audio_codec_enable (connector, intel_encoder, adjusted_mode); +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe; +mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector = connector; +/* referred in audio callbacks */ - dev_priv->dig_port_map[port] = intel_encoder; + dev_priv->av_enc_map[pipe] = intel_encoder;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -542,22 +550,29 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)void intel_audio_codec_disable (struct intel_encoder *intel_encoder) {struct drm_encoder *encoder = &intel_encoder->base; +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc);struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv =to_i915 (dev);struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe;if (dev_priv->display.audio_codec_disable) dev_priv->display.audio_codec_disable (intel_encoder);mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector =NULL ; - dev_priv->dig_port_map[port] =NULL ; + dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -628,8 +643,32 @@ static int i915_audio_component_get_cdclk_freq(struct device *dev)return dev_priv->cdclk_freq; } -static int i915_audio_component_sync_audio_rate (struct device *dev, -int port,int rate) +static struct intel_encoder *get_saved_encoder (struct intel_encoder *av_enc_map[], +int port,int dev_id) +{ + +enum pipe pipe; +struct drm_encoder *encoder; + +if (dev_id >=0 && dev_id <I915_MAX_PIPES ) +return av_enc_map[dev_id]; + +for (pipe =PIPE_A ; pipe <I915_MAX_PIPES ; pipe++) { + +if (!av_enc_map[pipe]) +continue ; + + encoder = &av_enc_map[pipe]->base; +if (port ==enc_to_dig_port (encoder)->port) +return av_enc_map[pipe]; + } + +return NULL ; + +} + +static int i915_audio_component_sync_audio_rate (struct device *dev,int port, +int dev_id,int rate) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);struct intel_encoder *intel_encoder;@@ -649,15 +688,16 @@ static int i915_audio_component_sync_audio_rate(struct device *dev,return 0 ;mutex_lock (&dev_priv->av_mutex); +/* 1. get the pipe */ - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id);if (!intel_encoder || !intel_encoder->base.crtc || intel_encoder->type !=INTEL_OUTPUT_HDMI ) {DRM_DEBUG_KMS ("no valid port %c\n" ,port_name (port)); err = -ENODEV ; goto unlock; } + crtc =to_intel_crtc (intel_encoder->base.crtc); pipe = crtc->pipe;if (pipe ==INVALID_PIPE ) {@@ -702,7 +742,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, }static int i915_audio_component_get_eld (struct device *dev,int port, -bool *enabled, +int dev_id,bool *enabled,unsigned char *buf,int max_bytes) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);@@ -710,17 +750,21 @@ static int i915_audio_component_get_eld(struct device *dev, int port,const u8 *eld;int ret = -EINVAL ; +mutex_lock (&dev_priv->av_mutex); - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ -if (intel_encoder) { - ret =0 ; - *enabled = intel_encoder->audio_connector !=NULL ; -if (*enabled) { - eld = intel_encoder->audio_connector->eld; - ret =drm_eld_size (eld); -memcpy (buf, eld,min (max_bytes, ret)); - } + + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id); +if (!intel_encoder) { +mutex_unlock (&dev_priv->av_mutex); +return ret; + } + + ret =0 ; + *enabled = intel_encoder->audio_connector !=NULL ; +if (*enabled) { + eld = intel_encoder->audio_connector->eld; + ret =drm_eld_size (eld); +memcpy (buf, eld,min (max_bytes, ret)); }mutex_unlock (&dev_priv->av_mutex);include/drm/i915_component.h +3
-3@@ -64,7 +64,7 @@ struct i915_audio_component_ops {* Called from audio driver. After audio driver sets the * sample rate, it will call this function to set n/cts */ -int (*sync_audio_rate)(struct device *,int port,int rate); +int (*sync_audio_rate)(struct device *,int port,int dev_id,int rate);/** * @get_eld: fill the audio state and ELD bytes for the given port * @@ -77,7 +77,7 @@ struct i915_audio_component_ops {* Note that the returned size may be over @max_bytes. Then it * implies that only a part of ELD has been copied to the buffer. */ -int (*get_eld)(struct device *,int port,bool *enabled, +int (*get_eld)(struct device *,int port,int dev_id,bool *enabled,unsigned char *buf,int max_bytes); };@@ -97,7 +97,7 @@ struct i915_audio_component_audio_ops {* status accordingly (even when the HDA controller is in power save * mode). */ -void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id); };/** include/sound/hda_i915.h +6
-5@@ -10,8 +10,9 @@int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable);int snd_hdac_display_power (struct hdac_bus *bus,bool enable);void snd_hdac_i915_set_bclk (struct hdac_bus *bus); -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate); -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate); +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes);int snd_hdac_i915_init (struct hdac_bus *bus);int snd_hdac_i915_exit (struct hdac_bus *bus);@@ -29,13 +30,13 @@ static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus) { }static inline int snd_hdac_sync_audio_rate (struct hdac_device *codec, -hda_nid_t nid,int rate) +hda_nid_t nid,int dev_id,int rate) {return 0 ; }static inline int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, -bool *audio_enabled,char *buffer, -int max_bytes) +int dev_id,bool *audio_enabled, +char *buffer,int max_bytes) {return -ENODEV ; }sound/hda/hdac_i915.c +5
-4@@ -201,7 +201,8 @@ static int pin2port(struct hdac_device *codec, hda_nid_t pin_nid)* This function sets N/CTS value based on the given sample rate. * Returns zero for success, or a negative error code. */ -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate) +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate) {struct hdac_bus *bus = codec->bus;struct i915_audio_component *acomp = bus->audio_component;@@ -212,7 +213,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate) port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->sync_audio_rate (acomp->dev, port, rate); +return acomp->ops->sync_audio_rate (acomp->dev, port, dev_id, rate); }EXPORT_SYMBOL_GPL (snd_hdac_sync_audio_rate);@@ -236,7 +237,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);* thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched. */ -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes) {struct hdac_bus *bus = codec->bus;@@ -249,7 +250,7 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->get_eld (acomp->dev, port, audio_enabled, +return acomp->ops->get_eld (acomp->dev, port, dev_id, audio_enabled, buffer, max_bytes); }EXPORT_SYMBOL_GPL (snd_hdac_acomp_get_eld);sound/pci/hda/patch_hdmi.c +3
-2@@ -1485,7 +1485,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec,mutex_lock (&per_pin->lock); eld->monitor_present = false; - size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid, + size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid,-1 , &eld->monitor_present, eld->eld_buffer,ELD_MAX_SIZE );if (size >0 ) {@@ -1739,7 +1739,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,/* Call sync_audio_rate to set the N/CTS/M manually if necessary */ /* Todo: add DP1.2 MST audio support later */ if (codec_has_acomp (codec)) -snd_hdac_sync_audio_rate (&codec->core, pin_nid, runtime->rate); +snd_hdac_sync_audio_rate (&codec->core, pin_nid,-1 , + runtime->rate); non_pcm =check_non_pcm_per_cvt (codec, cvt_nid);mutex_lock (&per_pin->lock);@@ -2285,7 +2286,7 @@ 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); }
Quoted 12 lines
Quoted 11 lines
Quoted 10 lines
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
sound/pci/hda/patch_hdmi.c +1
-1-static void intel_pin_eld_notify (void *audio_ptr,int port) +static void intel_pin_eld_notify (void *audio_ptr,int port,int dev_id) {struct hda_codec *codec = audio_ptr;int pin_nid;Signature · 1 line
2.5.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
In reply to Ville SyrjäläQuoted 11 lines · Ville Syrjälä
Quoted 10 lines · Dhinakaran Pandiyan
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it's meaning.
dev_id=MST : pipe that the stream originates from Non-MST : -1
Quoted 8 lines
Review
Quoted 4 lines
Affected APIs:
structi915_audio_component_ops(quoted diff) +1
-1- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id,Does the term '
dev_id' have some special meaning on the audio side? On the i915 side things would be less confusing if we just called it 'pipe'.
Yeah, it does. All of the documentation on the audio side is written in terms of device ID, so they asked for that nomenclature.
Jim
Quoted 331 lines
Quoted 331 lines
(quoted diff) +3
-2+ int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int dev_id, + bool *enabled, unsigned char *buf, int max_bytes);struct
i915_audio_component_audio_opsinclude/drm/i915_component.h +1
-1-void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id);This patch makes dummy changes in the audio drivers for build to succeed.
Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++--------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)drivers/gpu/drm/i915/i915_drv.h +1
-1@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ]; -struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];/* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch drivers/gpu/drm/i915/intel_audio.c +63
-19@@ -500,6 +500,9 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + connector =drm_select_eld (encoder);if (!connector)@@ -522,14 +525,19 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) dev_priv->display.audio_codec_enable (connector, intel_encoder, adjusted_mode); +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe; +mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector = connector; +/* referred in audio callbacks */ - dev_priv->dig_port_map[port] = intel_encoder; + dev_priv->av_enc_map[pipe] = intel_encoder;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -542,22 +550,29 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)void intel_audio_codec_disable (struct intel_encoder *intel_encoder) {struct drm_encoder *encoder = &intel_encoder->base; +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc);struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv =to_i915 (dev);struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe;if (dev_priv->display.audio_codec_disable) dev_priv->display.audio_codec_disable (intel_encoder);mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector =NULL ; - dev_priv->dig_port_map[port] =NULL ; + dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -628,8 +643,32 @@ static int i915_audio_component_get_cdclk_freq(struct device *dev)return dev_priv->cdclk_freq; } -static int i915_audio_component_sync_audio_rate (struct device *dev, -int port,int rate) +static struct intel_encoder *get_saved_encoder (struct intel_encoder *av_enc_map[], +int port,int dev_id) +{ + +enum pipe pipe; +struct drm_encoder *encoder; + +if (dev_id >=0 && dev_id <I915_MAX_PIPES ) +return av_enc_map[dev_id]; + +for (pipe =PIPE_A ; pipe <I915_MAX_PIPES ; pipe++) { + +if (!av_enc_map[pipe]) +continue ; + + encoder = &av_enc_map[pipe]->base; +if (port ==enc_to_dig_port (encoder)->port) +return av_enc_map[pipe]; + } + +return NULL ; + +} + +static int i915_audio_component_sync_audio_rate (struct device *dev,int port, +int dev_id,int rate) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);struct intel_encoder *intel_encoder;@@ -649,15 +688,16 @@ static int i915_audio_component_sync_audio_rate(struct device *dev,return 0 ;mutex_lock (&dev_priv->av_mutex); +/* 1. get the pipe */ - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id);if (!intel_encoder || !intel_encoder->base.crtc || intel_encoder->type !=INTEL_OUTPUT_HDMI ) {DRM_DEBUG_KMS ("no valid port %c\n" ,port_name (port)); err = -ENODEV ; goto unlock; } + crtc =to_intel_crtc (intel_encoder->base.crtc); pipe = crtc->pipe;if (pipe ==INVALID_PIPE ) {@@ -702,7 +742,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, }static int i915_audio_component_get_eld (struct device *dev,int port, -bool *enabled, +int dev_id,bool *enabled,unsigned char *buf,int max_bytes) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);@@ -710,17 +750,21 @@ static int i915_audio_component_get_eld(struct device *dev, int port,const u8 *eld;int ret = -EINVAL ; +mutex_lock (&dev_priv->av_mutex); - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ -if (intel_encoder) { - ret =0 ; - *enabled = intel_encoder->audio_connector !=NULL ; -if (*enabled) { - eld = intel_encoder->audio_connector->eld; - ret =drm_eld_size (eld); -memcpy (buf, eld,min (max_bytes, ret)); - } + + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id); +if (!intel_encoder) { +mutex_unlock (&dev_priv->av_mutex); +return ret; + } + + ret =0 ; + *enabled = intel_encoder->audio_connector !=NULL ; +if (*enabled) { + eld = intel_encoder->audio_connector->eld; + ret =drm_eld_size (eld); +memcpy (buf, eld,min (max_bytes, ret)); }mutex_unlock (&dev_priv->av_mutex);include/drm/i915_component.h +3
-3@@ -64,7 +64,7 @@ struct i915_audio_component_ops {* Called from audio driver. After audio driver sets the * sample rate, it will call this function to set n/cts */ -int (*sync_audio_rate)(struct device *,int port,int rate); +int (*sync_audio_rate)(struct device *,int port,int dev_id,int rate);/** * @get_eld: fill the audio state and ELD bytes for the given port * @@ -77,7 +77,7 @@ struct i915_audio_component_ops {* Note that the returned size may be over @max_bytes. Then it * implies that only a part of ELD has been copied to the buffer. */ -int (*get_eld)(struct device *,int port,bool *enabled, +int (*get_eld)(struct device *,int port,int dev_id,bool *enabled,unsigned char *buf,int max_bytes); };@@ -97,7 +97,7 @@ struct i915_audio_component_audio_ops {* status accordingly (even when the HDA controller is in power save * mode). */ -void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id); };/** include/sound/hda_i915.h +6
-5@@ -10,8 +10,9 @@int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable);int snd_hdac_display_power (struct hdac_bus *bus,bool enable);void snd_hdac_i915_set_bclk (struct hdac_bus *bus); -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate); -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate); +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes);int snd_hdac_i915_init (struct hdac_bus *bus);int snd_hdac_i915_exit (struct hdac_bus *bus);@@ -29,13 +30,13 @@ static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus) { }static inline int snd_hdac_sync_audio_rate (struct hdac_device *codec, -hda_nid_t nid,int rate) +hda_nid_t nid,int dev_id,int rate) {return 0 ; }static inline int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, -bool *audio_enabled,char *buffer, -int max_bytes) +int dev_id,bool *audio_enabled, +char *buffer,int max_bytes) {return -ENODEV ; }sound/hda/hdac_i915.c +5
-4@@ -201,7 +201,8 @@ static int pin2port(struct hdac_device *codec, hda_nid_t pin_nid)* This function sets N/CTS value based on the given sample rate. * Returns zero for success, or a negative error code. */ -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate) +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate) {struct hdac_bus *bus = codec->bus;struct i915_audio_component *acomp = bus->audio_component;@@ -212,7 +213,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate) port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->sync_audio_rate (acomp->dev, port, rate); +return acomp->ops->sync_audio_rate (acomp->dev, port, dev_id, rate); }EXPORT_SYMBOL_GPL (snd_hdac_sync_audio_rate);@@ -236,7 +237,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);* thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched. */ -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes) {struct hdac_bus *bus = codec->bus;@@ -249,7 +250,7 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->get_eld (acomp->dev, port, audio_enabled, +return acomp->ops->get_eld (acomp->dev, port, dev_id, audio_enabled, buffer, max_bytes); }EXPORT_SYMBOL_GPL (snd_hdac_acomp_get_eld);sound/pci/hda/patch_hdmi.c +3
-2@@ -1485,7 +1485,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec,mutex_lock (&per_pin->lock); eld->monitor_present = false; - size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid, + size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid,-1 , &eld->monitor_present, eld->eld_buffer,ELD_MAX_SIZE );if (size >0 ) {@@ -1739,7 +1739,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,/* Call sync_audio_rate to set the N/CTS/M manually if necessary */ /* Todo: add DP1.2 MST audio support later */ if (codec_has_acomp (codec)) -snd_hdac_sync_audio_rate (&codec->core, pin_nid, runtime->rate); +snd_hdac_sync_audio_rate (&codec->core, pin_nid,-1 , + runtime->rate); non_pcm =check_non_pcm_per_cvt (codec, cvt_nid);mutex_lock (&per_pin->lock);@@ -2285,7 +2286,7 @@ 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); }
Quoted 11 lines
Quoted 7 lines
sound/pci/hda/patch_hdmi.c +1
-1-static void intel_pin_eld_notify (void *audio_ptr,int port) +static void intel_pin_eld_notify (void *audio_ptr,int port,int dev_id) {struct hda_codec *codec = audio_ptr;int pin_nid;Signature · 1 line
2.5.0Signature · 2 lines
Ville Syrjälä Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 21 lines · Jim Bride
Quoted 11 lines · Ville Syrjälä
Quoted 10 lines · Dhinakaran Pandiyan
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it's meaning.
dev_id=MST : pipe that the stream originates from Non-MST : -1Quoted 8 lines
Review
Quoted 4 lines
Affected APIs:
structi915_audio_component_ops(quoted diff) +1
-1- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id,Does the term '
dev_id' have some special meaning on the audio side? On the i915 side things would be less confusing if we just called it 'pipe'.
Quoted 2 lines
Yeah, it does. All of the documentation on the audio side is written in terms of device ID, so they asked for that nomenclature.
And is the device ID always the same as the pipe? Until now we've made due with passing the port instead of the pipe, so either the audio side didn't use the device ID, or its meaning changes based on how we drive things, or they dug it out from somewhere else based on the port?
Quoted 346 lines
Jim
Quoted 342 lines
Quoted 338 lines
(quoted diff) +3
-2+ int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int dev_id, + bool *enabled, unsigned char *buf, int max_bytes);struct
i915_audio_component_audio_opsinclude/drm/i915_component.h +1
-1-void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id);This patch makes dummy changes in the audio drivers for build to succeed.
Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++--------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)drivers/gpu/drm/i915/i915_drv.h +1
-1@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ]; -struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];/* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch drivers/gpu/drm/i915/intel_audio.c +63
-19@@ -500,6 +500,9 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + connector =drm_select_eld (encoder);if (!connector)@@ -522,14 +525,19 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) dev_priv->display.audio_codec_enable (connector, intel_encoder, adjusted_mode); +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe; +mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector = connector; +/* referred in audio callbacks */ - dev_priv->dig_port_map[port] = intel_encoder; + dev_priv->av_enc_map[pipe] = intel_encoder;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -542,22 +550,29 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)void intel_audio_codec_disable (struct intel_encoder *intel_encoder) {struct drm_encoder *encoder = &intel_encoder->base; +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc);struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv =to_i915 (dev);struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe;if (dev_priv->display.audio_codec_disable) dev_priv->display.audio_codec_disable (intel_encoder);mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector =NULL ; - dev_priv->dig_port_map[port] =NULL ; + dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + (int ) port, dev_id); }/** @@ -628,8 +643,32 @@ static int i915_audio_component_get_cdclk_freq(struct device *dev)return dev_priv->cdclk_freq; } -static int i915_audio_component_sync_audio_rate (struct device *dev, -int port,int rate) +static struct intel_encoder *get_saved_encoder (struct intel_encoder *av_enc_map[], +int port,int dev_id) +{ + +enum pipe pipe; +struct drm_encoder *encoder; + +if (dev_id >=0 && dev_id <I915_MAX_PIPES ) +return av_enc_map[dev_id]; + +for (pipe =PIPE_A ; pipe <I915_MAX_PIPES ; pipe++) { + +if (!av_enc_map[pipe]) +continue ; + + encoder = &av_enc_map[pipe]->base; +if (port ==enc_to_dig_port (encoder)->port) +return av_enc_map[pipe]; + } + +return NULL ; + +} + +static int i915_audio_component_sync_audio_rate (struct device *dev,int port, +int dev_id,int rate) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);struct intel_encoder *intel_encoder;@@ -649,15 +688,16 @@ static int i915_audio_component_sync_audio_rate(struct device *dev,return 0 ;mutex_lock (&dev_priv->av_mutex); +/* 1. get the pipe */ - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id);if (!intel_encoder || !intel_encoder->base.crtc || intel_encoder->type !=INTEL_OUTPUT_HDMI ) {DRM_DEBUG_KMS ("no valid port %c\n" ,port_name (port)); err = -ENODEV ; goto unlock; } + crtc =to_intel_crtc (intel_encoder->base.crtc); pipe = crtc->pipe;if (pipe ==INVALID_PIPE ) {@@ -702,7 +742,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, }static int i915_audio_component_get_eld (struct device *dev,int port, -bool *enabled, +int dev_id,bool *enabled,unsigned char *buf,int max_bytes) {struct drm_i915_private *dev_priv =dev_to_i915 (dev);@@ -710,17 +750,21 @@ static int i915_audio_component_get_eld(struct device *dev, int port,const u8 *eld;int ret = -EINVAL ; +mutex_lock (&dev_priv->av_mutex); - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ -if (intel_encoder) { - ret =0 ; - *enabled = intel_encoder->audio_connector !=NULL ; -if (*enabled) { - eld = intel_encoder->audio_connector->eld; - ret =drm_eld_size (eld); -memcpy (buf, eld,min (max_bytes, ret)); - } + + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id); +if (!intel_encoder) { +mutex_unlock (&dev_priv->av_mutex); +return ret; + } + + ret =0 ; + *enabled = intel_encoder->audio_connector !=NULL ; +if (*enabled) { + eld = intel_encoder->audio_connector->eld; + ret =drm_eld_size (eld); +memcpy (buf, eld,min (max_bytes, ret)); }mutex_unlock (&dev_priv->av_mutex);include/drm/i915_component.h +3
-3@@ -64,7 +64,7 @@ struct i915_audio_component_ops {* Called from audio driver. After audio driver sets the * sample rate, it will call this function to set n/cts */ -int (*sync_audio_rate)(struct device *,int port,int rate); +int (*sync_audio_rate)(struct device *,int port,int dev_id,int rate);/** * @get_eld: fill the audio state and ELD bytes for the given port * @@ -77,7 +77,7 @@ struct i915_audio_component_ops {* Note that the returned size may be over @max_bytes. Then it * implies that only a part of ELD has been copied to the buffer. */ -int (*get_eld)(struct device *,int port,bool *enabled, +int (*get_eld)(struct device *,int port,int dev_id,bool *enabled,unsigned char *buf,int max_bytes); };@@ -97,7 +97,7 @@ struct i915_audio_component_audio_ops {* status accordingly (even when the HDA controller is in power save * mode). */ -void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id); };/** include/sound/hda_i915.h +6
-5@@ -10,8 +10,9 @@int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable);int snd_hdac_display_power (struct hdac_bus *bus,bool enable);void snd_hdac_i915_set_bclk (struct hdac_bus *bus); -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate); -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate); +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes);int snd_hdac_i915_init (struct hdac_bus *bus);int snd_hdac_i915_exit (struct hdac_bus *bus);@@ -29,13 +30,13 @@ static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus) { }static inline int snd_hdac_sync_audio_rate (struct hdac_device *codec, -hda_nid_t nid,int rate) +hda_nid_t nid,int dev_id,int rate) {return 0 ; }static inline int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, -bool *audio_enabled,char *buffer, -int max_bytes) +int dev_id,bool *audio_enabled, +char *buffer,int max_bytes) {return -ENODEV ; }sound/hda/hdac_i915.c +5
-4@@ -201,7 +201,8 @@ static int pin2port(struct hdac_device *codec, hda_nid_t pin_nid)* This function sets N/CTS value based on the given sample rate. * Returns zero for success, or a negative error code. */ -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate) +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate) {struct hdac_bus *bus = codec->bus;struct i915_audio_component *acomp = bus->audio_component;@@ -212,7 +213,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate) port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->sync_audio_rate (acomp->dev, port, rate); +return acomp->ops->sync_audio_rate (acomp->dev, port, dev_id, rate); }EXPORT_SYMBOL_GPL (snd_hdac_sync_audio_rate);@@ -236,7 +237,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);* thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched. */ -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes) {struct hdac_bus *bus = codec->bus;@@ -249,7 +250,7 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->get_eld (acomp->dev, port, audio_enabled, +return acomp->ops->get_eld (acomp->dev, port, dev_id, audio_enabled, buffer, max_bytes); }EXPORT_SYMBOL_GPL (snd_hdac_acomp_get_eld);sound/pci/hda/patch_hdmi.c +4
-3@@ -1485,7 +1485,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec,mutex_lock (&per_pin->lock); eld->monitor_present = false; - size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid, + size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid,-1 , &eld->monitor_present, eld->eld_buffer,ELD_MAX_SIZE );if (size >0 ) {@@ -1739,7 +1739,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,/* Call sync_audio_rate to set the N/CTS/M manually if necessary */ /* Todo: add DP1.2 MST audio support later */ if (codec_has_acomp (codec)) -snd_hdac_sync_audio_rate (&codec->core, pin_nid, runtime->rate); +snd_hdac_sync_audio_rate (&codec->core, pin_nid,-1 , + runtime->rate); non_pcm =check_non_pcm_per_cvt (codec, cvt_nid);mutex_lock (&per_pin->lock);@@ -2285,7 +2286,7 @@ 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_pin_eld_notify (void *audio_ptr,int port) +static void intel_pin_eld_notify (void *audio_ptr,int port,int dev_id) {struct hda_codec *codec = audio_ptr;int pin_nid;Signature · 1 line
2.5.0Signature · 2 lines
Ville Syrjälä Intel OTC
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 23 lines · Ville Syrjälä
Quoted 21 lines · Jim Bride
Quoted 19 lines · Ville Syrjälä
Quoted 12 lines · Dhinakaran Pandiyan
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it's meaning.
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_opsReview
Quoted 2 lines
(quoted diff) +1
-1- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id,Does the term '
dev_id' have some special meaning on the audio side? On the i915 side things would be less confusing if we just called it 'pipe'.
Quoted 7 lines
Quoted 2 lines
Yeah, it does. All of the documentation on the audio side is written in terms of device ID, so they asked for that nomenclature.
And is the device ID always the same as the pipe? Until now we've made due with passing the port instead of the pipe, so either the audio side didn't use the device ID, or its meaning changes based on how we drive things, or they dug it out from somewhere else based on the port?
This is my concern, too. Currently we have a very wild assumption even for the port mapping. In the audio side, there is neither port nor pipe. There are only the widget node id and the device id. The former is supposedly corresponding to the port, and the latter to the pipe. But the audio side has absolutely no clue about how these are connected.
Takashi
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 33 lines · Takashi Iwai
Quoted 23 lines · Ville Syrjälä
Quoted 21 lines · Jim Bride
Quoted 19 lines · Ville Syrjälä
Quoted 12 lines · Dhinakaran Pandiyan
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it's meaning.
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_opsReview
Quoted 2 lines
(quoted diff) +1
-1- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id,Does the term '
dev_id' have some special meaning on the audio side? On the i915 side things would be less confusing if we just called it 'pipe'.Quoted 7 lines
Quoted 2 lines
Yeah, it does. All of the documentation on the audio side is written in terms of device ID, so they asked for that nomenclature.
And is the device ID always the same as the pipe? Until now we've made due with passing the port instead of the pipe, so either the audio side didn't use the device ID, or its meaning changes based on how we drive things, or they dug it out from somewhere else based on the port?
Quoted 6 lines
This is my concern, too. Currently we have a very wild assumption even for the port mapping. In the audio side, there is neither port nor pipe. There are only the widget node id and the device id. The former is supposedly corresponding to the port, and the latter to the pipe. But the audio side has absolutely no clue about how these are connected.
So I tried to study this a bit, and MST and device<n> are mentioned a few times in the description of some audio registers in the GPU docs. Looks like a bunch of bits overlap somehow with pin vs. device usage. I don't understand how that's supposed to work. Eg:
AUD_PWRSTAUD_PWRST
1:0 PinB Widget PwrSt Set
PinB Widget power state that was setFor DP MST this represents Device1 power state
It's anyone's guees what those bits are suppoosed to reflect when you're doing MST with device1/pipe A, and at the same time you're driving port B in HDMI/SST mode.
Anyways, it doesn't help that this whole device widget aspect of hda seems to be undocumented. No spec I've found seems to know anything about any device widgets, and yet those are how MST rolls apparently.
In conclusion, I'd say that consistency's sake we should use either dev+pin or pipe+port in the interface, not mix both. In case of dev+pin I don't think we should use the NID (I'm assuming device widgets have one too), but rather the index. i915 could then do the mapping somethign like dev=pipe and pin=port-1, and then snd-hda can do the idx<->nid conversion however it sees fit (just use base_nid, or walk some per-type widget lists, or whatever).
That's assuming the widgets really are somehow ordered consistently so we can index them like that. I also might have understtod everyhing I read abou hda.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 55 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Ville Syrjälä
Sent: Friday, August 5, 2016 4:48 AM
To: Takashi Iwai <[email protected]>
Cc: [email protected]; [email protected]; alsa- [email protected]; Pandiyan, Dhinakaran <[email protected]>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MSTQuoted 11 lines · Takashi Iwai
Quoted 9 lines · Ville Syrjälä
Quoted 7 lines · Jim Bride
Quoted 6 lines · Ville Syrjälä
Quoted 5 lines · Dhinakaran Pandiyan
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existingparameter 'port' does not change it's meaning.
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Review
Quoted 10 lines
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_ops(quoted diff) +2
-1- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int +dev_id,Does the term '
dev_id' have some special meaning on the audio side? On the i915 side things would be less confusing if we just called it 'pipe'.Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Yeah, it does. All of the documentation on the audio side is written in terms of device ID, so they asked for that nomenclature.
And is the device ID always the same as the pipe? Until now we've made due with passing the port instead of the pipe, so either the audio side didn't use the device ID, or its meaning changes based on how we drive things, or they dug it out from somewhere else based on the
port?
Quoted 7 lines
This is my concern, too. Currently we have a very wild assumption even for the port mapping. In the audio side, there is neither port nor pipe. There are only the widget node id and the device id. The former is supposedly corresponding to the port, and the latter to the pipe. But the audio side has absolutely no clue about how these are connected.
Quoted 4 lines
So I tried to study this a bit, and MST and device<n> are mentioned a few times in the description of some audio registers in the GPU docs. Looks like a bunch of bits overlap somehow with pin vs. device usage. I don't understand how that's supposed to work. Eg:
For SST & HDMI, port is mapping to pin.
For MST, in audio, each pin has several device entries. Each device entry can transfer audio stream. And we confirmed with silicon team, device entry is related to pipe.
Device entry is always the right concept in audio driver. We are not sure the relationship will be always right between pipe and device entry.
We are worry that the relationship may be changed in the future between pipe and device entry. I mean maybe the pipe is not related to device entry in the new platforms, but some other conception, such as transcoder. If so, if we are using pipe now, maybe we need change the API again. For the stability, we are thinking device entry is suitable.
I think your concern is right. It is not good to use audio conception in gfx driver, which will cause confusion. If we can confirm that pipe will always be the fixed mapping to device entry, it will be better to use pipe.
Quoted 4 lines
AUD_PWRSTAUD_PWRST
1:0 PinB Widget PwrSt Set
PinB Widget power state that was setFor DP MST this represents Device1
power state
For this register, it means different in different scenario:
In DP SST & HDMI, it is for PinB
In DP MST, it is for device entry 1 (on whichever pin).
Quoted 4 lines
It's anyone's guees what those bits are suppoosed to reflect when you're doing MST with device1/pipe A, and at the same time you're driving port B in HDMI/SST mode.
I did the similar test before. I remember (but I didn't remember clearly now) If one pin is used as DP MST, all the pins are used as DP MST. This means if PinB is used as DP MST, 1:0 represents Device 1 and 5:4 represents Device 2. Let's say PinC is connected to HDMI audio, it is now looked as Device 2 (or other device id) not as PinC audio.
Regards,
Libin
Quoted 17 lines
Anyways, it doesn't help that this whole device widget aspect of hda seems to be undocumented. No spec I've found seems to know anything about any device widgets, and yet those are how MST rolls apparently.
In conclusion, I'd say that consistency's sake we should use either dev+pin or pipe+port in the interface, not mix both. In case of pin I dev+don't think we should use the NID (I'm assuming device widgets have one too), but rather the index. i915 could then do the mapping somethign like dev=pipe and pin=port-1, and then snd-hda can do the idx<-
Quoted 1 line
nid conversion however it sees fit (just use
base_nid, or walk some per-typewidget lists, or whatever).
That's assuming the widgets really are somehow ordered consistently so we can index them like that. I also might have understtod everyhing I read abou hda.
Quoted 7 lines
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 92 lines · Libin
Quoted 54 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Ville Syrjälä
Sent: Friday, August 5, 2016 4:48 AM
To: Takashi Iwai <[email protected]>
Cc: [email protected]; [email protected]; alsa- [email protected]; Pandiyan, Dhinakaran <[email protected]>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MSTQuoted 11 lines · Takashi Iwai
Quoted 9 lines · Ville Syrjälä
Quoted 7 lines · Jim Bride
Quoted 6 lines · Ville Syrjälä
Quoted 5 lines · Dhinakaran Pandiyan
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existingparameter 'port' does not change it's meaning.
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Review
Quoted 10 lines
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_ops(quoted diff) +2
-1- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int +dev_id,Does the term '
dev_id' have some special meaning on the audio side? On the i915 side things would be less confusing if we just called it 'pipe'.Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Yeah, it does. All of the documentation on the audio side is written in terms of device ID, so they asked for that nomenclature.
And is the device ID always the same as the pipe? Until now we've made due with passing the port instead of the pipe, so either the audio side didn't use the device ID, or its meaning changes based on how we drive things, or they dug it out from somewhere else based on the
port?
Quoted 7 lines
This is my concern, too. Currently we have a very wild assumption even for the port mapping. In the audio side, there is neither port nor pipe. There are only the widget node id and the device id. The former is supposedly corresponding to the port, and the latter to the pipe. But the audio side has absolutely no clue about how these are connected.
Quoted 4 lines
So I tried to study this a bit, and MST and device<n> are mentioned a few times in the description of some audio registers in the GPU docs. Looks like a bunch of bits overlap somehow with pin vs. device usage. I don't understand how that's supposed to work. Eg:
For SST & HDMI, port is mapping to pin.
For MST, in audio, each pin has several device entries. Each device entry can transfer audio stream. And we confirmed with silicon team, device entry is related to pipe.
Device entry is always the right concept in audio driver. We are not sure the relationship will be always right between pipe and device entry.
We are worry that the relationship may be changed in the future between pipe and device entry. I mean maybe the pipe is not related to device entry in the new platforms, but some other conception, such as transcoder. If so, if we are using pipe now, maybe we need change the API again. For the stability, we are thinking device entry is suitable.
I think your concern is right. It is not good to use audio conception in gfx driver, which will cause confusion. If we can confirm that pipe will always be the fixed mapping to device entry, it will be better to use pipe.
Quoted 4 lines
AUD_PWRSTAUD_PWRST
1:0 PinB Widget PwrSt Set
PinB Widget power state that was setFor DP MST this represents Device1
power stateFor this register, it means different in different scenario:
In DP SST & HDMI, it is for PinB
In DP MST, it is for device entry 1 (on whichever pin).Quoted 4 lines
It's anyone's guees what those bits are suppoosed to reflect when you're doing MST with device1/pipe A, and at the same time you're driving port B in HDMI/SST mode.
Quoted 9 lines
I did the similar test before. I remember (but I didn't remember clearly now) If one pin is used as DP MST, all the pins are used as DP MST. This means if PinB is used as DP MST, 1:0 represents Device 1 and 5:4 represents Device 2. Let's say PinC is connected to HDMI audio, it is now looked as Device 2 (or other device id) not as PinC audio.
Regards,
Libin
Here's what I found after digging through the specs.
1. Firstly, "device 1" is not same as "device entry at index=1".
a) Device
"Get Device Select" (source: Bspec)
------------------------------------------------------------------------
11:06 Sink Device ID: Sink Device ID in the multi stream topology of the DP hierarchy.
Device attached to Pipe A will have ID of "00000", Pipe B will have "00001" and Pipe C will have "00010".
------------------------------------------------------------------------
b) Device entry
Device entry is an audio device attached to a pin(port). Each entry has an index in a per pin list of devices.
2. The "device(pipe)" and the device entry(index in a per pin list) mapping can be figured out with a sequence of "Get Device List Entry" and "Get Device Select" verbs in the audio driver.(source:HDA spec)
i915 is not aware of "device entry" or it's mapping to device(pipe). So, we should be sending the "pin(port)" and "device(pipe)" via pin_eld_notify(). The audio driver can use this information to get the right device entry for "Get Pin Sense" verb.
3. Confirming what Ville already said. All we need to do now is, as Ville pointed out, rename the variables
(port and pipe) or (pin and device_id)
Since dev_id is a horrible name for a new variable in i915, let's use port and pipe.
I will send out a patch renaming dev_id to pipe.
-DK
Quoted 24 lines
Quoted 17 lines
Anyways, it doesn't help that this whole device widget aspect of hda seems to be undocumented. No spec I've found seems to know anything about any device widgets, and yet those are how MST rolls apparently.
In conclusion, I'd say that consistency's sake we should use either dev+pin or pipe+port in the interface, not mix both. In case of pin I dev+don't think we should use the NID (I'm assuming device widgets have one too), but rather the index. i915 could then do the mapping somethign like dev=pipe and pin=port-1, and then snd-hda can do the idx<-
Quoted 1 line
nid conversion however it sees fit (just use
base_nid, or walk some per-typewidget lists, or whatever).
That's assuming the widgets really are somehow ordered consistently so we can index them like that. I also might have understtod everyhing I read abou hda.
Quoted 7 lines
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 119 lines · Dhinakaran
Quoted 92 lines · Libin
Quoted 54 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Ville Syrjälä
Sent: Friday, August 5, 2016 4:48 AM
To: Takashi Iwai <[email protected]>
Cc: [email protected]; [email protected]; alsa- [email protected]; Pandiyan, Dhinakaran <[email protected]>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MSTQuoted 11 lines · Takashi Iwai
Quoted 9 lines · Ville Syrjälä
Quoted 7 lines · Jim Bride
Quoted 6 lines · Ville Syrjälä
Quoted 5 lines · Dhinakaran Pandiyan
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existingparameter 'port' does not change it's meaning.
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Review
Quoted 10 lines
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_ops(quoted diff) +2
-1- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int +dev_id,Does the term '
dev_id' have some special meaning on the audio side? On the i915 side things would be less confusing if we just called it 'pipe'.Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Yeah, it does. All of the documentation on the audio side is written in terms of device ID, so they asked for that nomenclature.
And is the device ID always the same as the pipe? Until now we've made due with passing the port instead of the pipe, so either the audio side didn't use the device ID, or its meaning changes based on how we drive things, or they dug it out from somewhere else based on the
port?
Quoted 7 lines
This is my concern, too. Currently we have a very wild assumption even for the port mapping. In the audio side, there is neither port nor pipe. There are only the widget node id and the device id. The former is supposedly corresponding to the port, and the latter to the pipe. But the audio side has absolutely no clue about how these are connected.
Quoted 4 lines
So I tried to study this a bit, and MST and device<n> are mentioned a few times in the description of some audio registers in the GPU docs. Looks like a bunch of bits overlap somehow with pin vs. device usage. I don't understand how that's supposed to work. Eg:
For SST & HDMI, port is mapping to pin.
For MST, in audio, each pin has several device entries. Each device entry can transfer audio stream. And we confirmed with silicon team, device entry is related to pipe.
Device entry is always the right concept in audio driver. We are not sure the relationship will be always right between pipe and device entry.
We are worry that the relationship may be changed in the future between pipe and device entry. I mean maybe the pipe is not related to device entry in the new platforms, but some other conception, such as transcoder. If so, if we are using pipe now, maybe we need change the API again. For the stability, we are thinking device entry is suitable.
I think your concern is right. It is not good to use audio conception in gfx driver, which will cause confusion. If we can confirm that pipe will always be the fixed mapping to device entry, it will be better to use pipe.
Quoted 4 lines
AUD_PWRSTAUD_PWRST
1:0 PinB Widget PwrSt Set
PinB Widget power state that was setFor DP MST this represents Device1
power stateFor this register, it means different in different scenario:
In DP SST & HDMI, it is for PinB
In DP MST, it is for device entry 1 (on whichever pin).Quoted 4 lines
It's anyone's guees what those bits are suppoosed to reflect when you're doing MST with device1/pipe A, and at the same time you're driving port B in HDMI/SST mode.
Quoted 9 lines
I did the similar test before. I remember (but I didn't remember clearly now) If one pin is used as DP MST, all the pins are used as DP MST. This means if PinB is used as DP MST, 1:0 represents Device 1 and 5:4 represents Device 2. Let's say PinC is connected to HDMI audio, it is now looked as Device 2 (or other device id) not as PinC audio.
Regards,
LibinHere's what I found after digging through the specs.
1. Firstly, "device 1" is not same as "device entry at index=1".
a) Device
"Get Device Select" (source: Bspec)
------------------------------------------------------------------------
11:06 Sink Device ID: Sink Device ID in the multi stream topology of the DP hierarchy.
Device attached to Pipe A will have ID of "00000", Pipe B will have "00001" and Pipe C will have "00010".
------------------------------------------------------------------------b) Device entry
Device entry is an audio device attached to a pin(port). Each entry has an index in a per pin list of devices.
Quoted 8 lines
2. The "device(pipe)" and the device entry(index in a per pin list) mapping can be figured out with a sequence of "Get Device List Entry" and "Get Device Select" verbs in the audio driver.(source:HDA spec)
i915 is not aware of "device entry" or it's mapping to device(pipe). So, we should be sending the "pin(port)" and "device(pipe)" via
pin_eld_notify(). The audio driver can use this information to get the right device entry for "Get Pin Sense" verb.
OK, so sounds like the hda side is the only one that can really figure this stuff out. i915 just doesn't have enough information.
Quoted 10 lines
3. Confirming what Ville already said. All we need to do now is, as Ville pointed out, rename the variables
(port and pipe) or (pin and
device_id)Since
dev_idis a horrible name for a new variable in i915, let's use port and pipe.I will send out a patch renaming
dev_idto pipe.
Sounds good. Thanks.
Quoted 32 lines
-DK
Quoted 28 lines
Quoted 17 lines
Anyways, it doesn't help that this whole device widget aspect of hda seems to be undocumented. No spec I've found seems to know anything about any device widgets, and yet those are how MST rolls apparently.
In conclusion, I'd say that consistency's sake we should use either dev+pin or pipe+port in the interface, not mix both. In case of pin I dev+don't think we should use the NID (I'm assuming device widgets have one too), but rather the index. i915 could then do the mapping somethign like dev=pipe and pin=port-1, and then snd-hda can do the idx<-
Quoted 1 line
nid conversion however it sees fit (just use
base_nid, or walk some per-typewidget lists, or whatever).
That's assuming the widgets really are somehow ordered consistently so we can index them like that. I also might have understtod everyhing I read abou hda.
Quoted 7 lines
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
In reply to Dhinakaran PandiyanQuoted 53 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Dhinakaran Pandiyan
Sent: Wednesday, August 3, 2016 10:15 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Pandiyan, Dhinakaran <[email protected]>
Subject: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MSTDP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it's meaning.
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_ops(quoted diff) +4
-3- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id, + int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int dev_id, + bool *enabled, unsigned char *buf, int max_bytes);struct
i915_audio_component_audio_opsinclude/drm/i915_component.h +1
-1-void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id);This patch makes dummy changes in the audio drivers for build to succeed.
Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++-- ------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/i915_drv.hindex 65ada5d..8e4c8c8 100644
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 2057
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +1
-1@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ]; -struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];
We may still need save the port number info. In non-MST mode, device entry means nothing. This means av_enc_map[pipe] may not get the right intel_encoder
Regards,
Libin
Quoted 330 lines
drivers/gpu/drm/i915/i915_drv.h +0
-0/* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch diff --git
a/drivers/gpu/drm/i915/intel_audio.cb/drivers/gpu/drm/i915/intel_audio.c
index 8c493de..cbe44c8 100644drivers/gpu/drm/i915/intel_audio.c +3
-0@@ -500,6 +500,9 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + connector =drm_select_eld (encoder);drivers/gpu/drm/i915/intel_audio.c +5
-2if (!connector)@@ -522,14 +525,19 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) dev_priv->display.audio_codec_enable (connector, intel_encoder, adjusted_mode); +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe; +mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector = connector; +/* referred in audio callbacks */ - dev_priv->dig_port_map[port] = intel_encoder; + dev_priv->av_enc_map[pipe] = intel_encoder;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops- >pin_eld_notify) - acomp->audio_ops->pin_eld_notify(acomp->audio_ops-Quoted 1 line
audio_ptr, (int) port);drivers/gpu/drm/i915/intel_audio.c +1
-0+ acomp->audio_ops->pin_eld_notify(acomp->audio_ops-Quoted 1 line
audio_ptr,drivers/gpu/drm/i915/intel_audio.c +10
-2+ (int) port, dev_id); }/** @@ -542,22 +550,29 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) void intel_audio_codec_disable(struct intel_encoder *intel_encoder) {struct drm_encoder *encoder = &intel_encoder->base; +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc);struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv =to_i915 (dev);struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe;if (dev_priv->display.audio_codec_disable) dev_priv->display.audio_codec_disable (intel_encoder);mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector =NULL ; - dev_priv->dig_port_map[port] =NULL ; + dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops- >pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops- >audio_ptr, (int) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops- >audio_ptr, + (int ) port, dev_id);}
/**
drivers/gpu/drm/i915/intel_audio.c +26
-2@@ -628,8 +643,32 @@ static int i915_audio_component_get_cdclk_freq(struct device *dev) return dev_priv->cdclk_freq; } -static int i915_audio_component_sync_audio_rate (struct device *dev, -int port,int rate) +static struct intel_encoder *get_saved_encoder (struct intel_encoder *av_enc_map[], +int port,int dev_id) +{ + +enum pipe pipe; +struct drm_encoder *encoder; + +if (dev_id >=0 && dev_id <I915_MAX_PIPES ) +return av_enc_map[dev_id]; + +for (pipe =PIPE_A ; pipe <I915_MAX_PIPES ; pipe++) { + +if (!av_enc_map[pipe]) +continue ; + + encoder = &av_enc_map[pipe]->base; +if (port ==enc_to_dig_port (encoder)->port) +return av_enc_map[pipe]; + } + +return NULL ; + +} + +static int i915_audio_component_sync_audio_rate (struct device *dev,int port, +int dev_id,int rate){
drivers/gpu/drm/i915/intel_audio.c +3
-2struct drm_i915_private *dev_priv =dev_to_i915 (dev);struct intel_encoder *intel_encoder;@@ -649,15 +688,16 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, return 0;mutex_lock (&dev_priv->av_mutex); +/* 1. get the pipe */ - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id);if (!intel_encoder || !intel_encoder->base.crtc || intel_encoder->type !=INTEL_OUTPUT_HDMI ) {DRM_DEBUG_KMS ("no valid port %c\n" ,port_name (port)); err = -ENODEV ; goto unlock; } + crtc =to_intel_crtc (intel_encoder->base.crtc);drivers/gpu/drm/i915/intel_audio.c +2
-1pipe = crtc->pipe;if (pipe ==INVALID_PIPE ) {@@ -702,7 +742,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, }static int i915_audio_component_get_eld (struct device *dev,int port, -bool *enabled, +int dev_id,bool *enabled,unsigned char *buf,int max_bytes) { struct drm_i915_private *dev_priv = dev_to_i915(dev); @@ -710,17 +750,21 @@ static int i915_audio_component_get_eld(struct device *dev, intport,
drivers/gpu/drm/i915/intel_audio.c +3
-10const u8 *eld;int ret = -EINVAL ; +mutex_lock (&dev_priv->av_mutex); - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ -if (intel_encoder) { - ret =0 ; - *enabled = intel_encoder->audio_connector !=NULL ; -if (*enabled) { - eld = intel_encoder->audio_connector->eld; - ret =drm_eld_size (eld); -memcpy (buf, eld,min (max_bytes, ret)); - } + + intel_encoder = get_saved_encoder(dev_priv->av_enc_map, port,
dev_id);drivers/gpu/drm/i915/intel_audio.c +11
-0+if (!intel_encoder) { +mutex_unlock (&dev_priv->av_mutex); +return ret; + } + + ret =0 ; + *enabled = intel_encoder->audio_connector !=NULL ; +if (*enabled) { + eld = intel_encoder->audio_connector->eld; + ret =drm_eld_size (eld); +memcpy (buf, eld,min (max_bytes, ret)); }mutex_unlock (&dev_priv->av_mutex);include/drm/i915_component.h +4
-3@@ -64,7 +64,7 @@ struct i915_audio_component_ops {* Called from audio driver. After audio driver sets the * sample rate, it will call this function to set n/cts */ -int (*sync_audio_rate)(struct device *,int port,int rate); +int (*sync_audio_rate)(struct device *,int port,int dev_id,int +rate);/** * @get_eld: fill the audio state and ELD bytes for the given port * @@ -77,7 +77,7 @@ struct i915_audio_component_ops {* Note that the returned size may be over @max_bytes. Then it * implies that only a part of ELD has been copied to the buffer. */ -int (*get_eld)(struct device *,int port,bool *enabled, +int (*get_eld)(struct device *,int port,int dev_id,bool *enabled,unsigned char *buf,int max_bytes); };@@ -97,7 +97,7 @@ struct i915_audio_component_audio_ops {* status accordingly (even when the HDA controller is in power save * mode). */ -void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id); };/** include/sound/hda_i915.h index renamed from include/sound/hda_i915.h +0
-0796cabf..5ab972e 100644
include/sound/hda_i915.h +0
-0@@ -10,8 +10,9 @@int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable);int
snd_hdac_display_power(struct hdac_bus *bus, bool enable); voidsnd_hdac_i915_set_bclk(struct hdac_bus *bus); -intsnd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate); -int snd_hdac_acomp_get_eld(structhdac_device*codec,hda_nid_tnid,include/sound/hda_i915.h +4
-0+int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate); +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int dev_id,bool *audio_enabled,char *buffer,int max_bytes);int
snd_hdac_i915_init(struct hdac_bus *bus); intsnd_hdac_i915_exit(struct hdac_bus *bus); @@ -29,13 +30,13 @@ static inline voidsnd_hdac_i915_set_bclk(struct hdac_bus *bus){ } static inline int snd_hdac_sync_audio_rate(structhdac_device*codec,include/sound/hda_i915.h +1
-1- hda_nid_t nid, int rate) + hda_nid_t nid, int dev_id, int rate) { return 0; } static inline int snd_hdac_acomp_get_eld(struct hdac_device *codec,
hda_nid_tnid,include/sound/hda_i915.h +2
-2- bool *audio_enabled, char *buffer, - int max_bytes) + int dev_id, bool *audio_enabled, + char *buffer, int max_bytes) { return -ENODEV; }sound/hda/hdac_i915.c index renamed from sound/hda/hdac_i915.c +0
-0c9af022..6ea63ac 100644
sound/hda/hdac_i915.c +2
-1@@ -201,7 +201,8 @@ static int pin2port(struct hdac_device *codec,hda_nid_t pin_nid) * This function sets N/CTS value based on the given sample rate. * Returns zero for success, or a negative error code. */ -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate) +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate) {sound/hda/hdac_i915.c +0
-1struct hdac_bus *bus = codec->bus; struct i915_audio_component *acomp = bus->audio_component; @@ -212,7 +213,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device *codec,
hda_nid_tnid, int rate)sound/hda/hdac_i915.c +4
-3port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->sync_audio_rate (acomp->dev, port, rate); +return acomp->ops->sync_audio_rate (acomp->dev, port, dev_id, rate); }EXPORT_SYMBOL_GPL (snd_hdac_sync_audio_rate);@@ -236,7 +237,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);* thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched. */ -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int dev_id,bool *audio_enabled,char *buffer,int max_bytes) {struct hdac_bus *bus = codec->bus;@@ -249,7 +250,7 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->get_eld (acomp->dev, port, audio_enabled, +return acomp->ops->get_eld (acomp->dev, port, dev_id, audio_enabled, buffer, max_bytes);}
EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld);sound/pci/hda/patch_hdmi.c index renamed from sound/pci/hda/patch_hdmi.c +0
-0d0d5ad8..077d48a 100644
sound/pci/hda/patch_hdmi.c +1
-1@@ -1485,7 +1485,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec,mutex_lock (&per_pin->lock); eld->monitor_present = false; - size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid, + size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid,-1 , &eld->monitor_present, eld->eld_buffer,ELD_MAX_SIZE );sound/pci/hda/patch_hdmi.c +2
-1if (size >0 ) {@@ -1739,7 +1739,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, /* Call sync_audio_rate to set the N/CTS/M manually if necessary */ /* Todo: add DP1.2 MST audio support later */ if (codec_has_acomp(codec)) - snd_hdac_sync_audio_rate(&codec->core, pin_nid, runtime- >rate); +snd_hdac_sync_audio_rate (&codec->core, pin_nid,-1 , + runtime->rate);sound/pci/hda/patch_hdmi.c +1
-2non_pcm =check_non_pcm_per_cvt (codec, cvt_nid);mutex_lock (&per_pin->lock);@@ -2285,7 +2286,7 @@ 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_pin_eld_notify (void *audio_ptr,int port) +static void intel_pin_eld_notify (void *audio_ptr,int port,int dev_id) {struct hda_codec *codec = audio_ptr;int pin_nid; --2.5.0
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 62 lines · Libin
Quoted 52 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Dhinakaran Pandiyan
Sent: Wednesday, August 3, 2016 10:15 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Pandiyan, Dhinakaran <[email protected]>
Subject: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MSTDP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it's meaning.
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_ops(quoted diff) +4
-3- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id, + int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int dev_id, + bool *enabled, unsigned char *buf, int max_bytes);struct
i915_audio_component_audio_opsinclude/drm/i915_component.h +1
-1-void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id);This patch makes dummy changes in the audio drivers for build to succeed.
Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++-- ------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/i915_drv.hindex 65ada5d..8e4c8c8 100644drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 2057
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +1
-1@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ]; -struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];We may still need save the port number info. In non-MST mode, device entry means nothing. This means av_enc_map[pipe] may not get the right
intel_encoder
Quoted 3 lines
Regards,
Libin
We find the encoder using port in get_saved_encoder()
Quoted 330 lines
Quoted 330 lines
drivers/gpu/drm/i915/i915_drv.h +0
-0/* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch diff --git
a/drivers/gpu/drm/i915/intel_audio.cb/drivers/gpu/drm/i915/intel_audio.c
index 8c493de..cbe44c8 100644drivers/gpu/drm/i915/intel_audio.c +3
-0@@ -500,6 +500,9 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + connector =drm_select_eld (encoder);drivers/gpu/drm/i915/intel_audio.c +5
-2if (!connector)@@ -522,14 +525,19 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) dev_priv->display.audio_codec_enable (connector, intel_encoder, adjusted_mode); +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe; +mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector = connector; +/* referred in audio callbacks */ - dev_priv->dig_port_map[port] = intel_encoder; + dev_priv->av_enc_map[pipe] = intel_encoder;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops- >pin_eld_notify) - acomp->audio_ops->pin_eld_notify(acomp->audio_ops-Quoted 1 line
audio_ptr, (int) port);drivers/gpu/drm/i915/intel_audio.c +1
-0+ acomp->audio_ops->pin_eld_notify(acomp->audio_ops-Quoted 1 line
audio_ptr,drivers/gpu/drm/i915/intel_audio.c +10
-2+ (int) port, dev_id); }/** @@ -542,22 +550,29 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) void intel_audio_codec_disable(struct intel_encoder *intel_encoder) {struct drm_encoder *encoder = &intel_encoder->base; +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc);struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv =to_i915 (dev);struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe;if (dev_priv->display.audio_codec_disable) dev_priv->display.audio_codec_disable (intel_encoder);mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector =NULL ; - dev_priv->dig_port_map[port] =NULL ; + dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops- >pin_eld_notify) - acomp->audio_ops->pin_eld_notify (acomp->audio_ops- >audio_ptr, (int) port); + acomp->audio_ops->pin_eld_notify (acomp->audio_ops- >audio_ptr, + (int ) port, dev_id);}
/**
drivers/gpu/drm/i915/intel_audio.c +26
-2@@ -628,8 +643,32 @@ static int i915_audio_component_get_cdclk_freq(struct device *dev) return dev_priv->cdclk_freq; } -static int i915_audio_component_sync_audio_rate (struct device *dev, -int port,int rate) +static struct intel_encoder *get_saved_encoder (struct intel_encoder *av_enc_map[], +int port,int dev_id) +{ + +enum pipe pipe; +struct drm_encoder *encoder; + +if (dev_id >=0 && dev_id <I915_MAX_PIPES ) +return av_enc_map[dev_id]; + +for (pipe =PIPE_A ; pipe <I915_MAX_PIPES ; pipe++) { + +if (!av_enc_map[pipe]) +continue ; + + encoder = &av_enc_map[pipe]->base; +if (port ==enc_to_dig_port (encoder)->port) +return av_enc_map[pipe]; + } + +return NULL ; + +} + +static int i915_audio_component_sync_audio_rate (struct device *dev,int port, +int dev_id,int rate){
drivers/gpu/drm/i915/intel_audio.c +3
-2struct drm_i915_private *dev_priv =dev_to_i915 (dev);struct intel_encoder *intel_encoder;@@ -649,15 +688,16 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, return 0;mutex_lock (&dev_priv->av_mutex); +/* 1. get the pipe */ - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ + intel_encoder =get_saved_encoder (dev_priv->av_enc_map, port, dev_id);if (!intel_encoder || !intel_encoder->base.crtc || intel_encoder->type !=INTEL_OUTPUT_HDMI ) {DRM_DEBUG_KMS ("no valid port %c\n" ,port_name (port)); err = -ENODEV ; goto unlock; } + crtc =to_intel_crtc (intel_encoder->base.crtc);drivers/gpu/drm/i915/intel_audio.c +2
-1pipe = crtc->pipe;if (pipe ==INVALID_PIPE ) {@@ -702,7 +742,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, }static int i915_audio_component_get_eld (struct device *dev,int port, -bool *enabled, +int dev_id,bool *enabled,unsigned char *buf,int max_bytes) { struct drm_i915_private *dev_priv = dev_to_i915(dev); @@ -710,17 +750,21 @@ static int i915_audio_component_get_eld(struct device *dev, intport,
drivers/gpu/drm/i915/intel_audio.c +3
-10const u8 *eld;int ret = -EINVAL ; +mutex_lock (&dev_priv->av_mutex); - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ -if (intel_encoder) { - ret =0 ; - *enabled = intel_encoder->audio_connector !=NULL ; -if (*enabled) { - eld = intel_encoder->audio_connector->eld; - ret =drm_eld_size (eld); -memcpy (buf, eld,min (max_bytes, ret)); - } + + intel_encoder = get_saved_encoder(dev_priv->av_enc_map, port,
dev_id);drivers/gpu/drm/i915/intel_audio.c +11
-0+if (!intel_encoder) { +mutex_unlock (&dev_priv->av_mutex); +return ret; + } + + ret =0 ; + *enabled = intel_encoder->audio_connector !=NULL ; +if (*enabled) { + eld = intel_encoder->audio_connector->eld; + ret =drm_eld_size (eld); +memcpy (buf, eld,min (max_bytes, ret)); }mutex_unlock (&dev_priv->av_mutex);include/drm/i915_component.h +4
-3@@ -64,7 +64,7 @@ struct i915_audio_component_ops {* Called from audio driver. After audio driver sets the * sample rate, it will call this function to set n/cts */ -int (*sync_audio_rate)(struct device *,int port,int rate); +int (*sync_audio_rate)(struct device *,int port,int dev_id,int +rate);/** * @get_eld: fill the audio state and ELD bytes for the given port * @@ -77,7 +77,7 @@ struct i915_audio_component_ops {* Note that the returned size may be over @max_bytes. Then it * implies that only a part of ELD has been copied to the buffer. */ -int (*get_eld)(struct device *,int port,bool *enabled, +int (*get_eld)(struct device *,int port,int dev_id,bool *enabled,unsigned char *buf,int max_bytes); };@@ -97,7 +97,7 @@ struct i915_audio_component_audio_ops {* status accordingly (even when the HDA controller is in power save * mode). */ -void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id); };/** include/sound/hda_i915.h index renamed from include/sound/hda_i915.h +0
-0796cabf..5ab972e 100644
include/sound/hda_i915.h +0
-0@@ -10,8 +10,9 @@int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable);int
snd_hdac_display_power(struct hdac_bus *bus, bool enable); voidsnd_hdac_i915_set_bclk(struct hdac_bus *bus); -intsnd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate); -int snd_hdac_acomp_get_eld(structhdac_device*codec,hda_nid_tnid,include/sound/hda_i915.h +4
-0+int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate); +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int dev_id,bool *audio_enabled,char *buffer,int max_bytes);int
snd_hdac_i915_init(struct hdac_bus *bus); intsnd_hdac_i915_exit(struct hdac_bus *bus); @@ -29,13 +30,13 @@ static inline voidsnd_hdac_i915_set_bclk(struct hdac_bus *bus){ } static inline int snd_hdac_sync_audio_rate(structhdac_device*codec,include/sound/hda_i915.h +1
-1- hda_nid_t nid, int rate) + hda_nid_t nid, int dev_id, int rate) { return 0; } static inline int snd_hdac_acomp_get_eld(struct hdac_device *codec,
hda_nid_tnid,include/sound/hda_i915.h +2
-2- bool *audio_enabled, char *buffer, - int max_bytes) + int dev_id, bool *audio_enabled, + char *buffer, int max_bytes) { return -ENODEV; }sound/hda/hdac_i915.c index renamed from sound/hda/hdac_i915.c +0
-0c9af022..6ea63ac 100644
sound/hda/hdac_i915.c +2
-1@@ -201,7 +201,8 @@ static int pin2port(struct hdac_device *codec,hda_nid_t pin_nid) * This function sets N/CTS value based on the given sample rate. * Returns zero for success, or a negative error code. */ -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid,int rate) +int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate) {sound/hda/hdac_i915.c +0
-1struct hdac_bus *bus = codec->bus; struct i915_audio_component *acomp = bus->audio_component; @@ -212,7 +213,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device *codec,
hda_nid_tnid, int rate)sound/hda/hdac_i915.c +4
-3port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->sync_audio_rate (acomp->dev, port, rate); +return acomp->ops->sync_audio_rate (acomp->dev, port, dev_id, rate); }EXPORT_SYMBOL_GPL (snd_hdac_sync_audio_rate);@@ -236,7 +237,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);* thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched. */ -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int dev_id,bool *audio_enabled,char *buffer,int max_bytes) {struct hdac_bus *bus = codec->bus;@@ -249,7 +250,7 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->get_eld (acomp->dev, port, audio_enabled, +return acomp->ops->get_eld (acomp->dev, port, dev_id, audio_enabled, buffer, max_bytes);}
EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld);sound/pci/hda/patch_hdmi.c index renamed from sound/pci/hda/patch_hdmi.c +0
-0d0d5ad8..077d48a 100644
sound/pci/hda/patch_hdmi.c +1
-1@@ -1485,7 +1485,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec,mutex_lock (&per_pin->lock); eld->monitor_present = false; - size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid, + size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid,-1 , &eld->monitor_present, eld->eld_buffer,ELD_MAX_SIZE );sound/pci/hda/patch_hdmi.c +2
-1if (size >0 ) {@@ -1739,7 +1739,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, /* Call sync_audio_rate to set the N/CTS/M manually if necessary */ /* Todo: add DP1.2 MST audio support later */ if (codec_has_acomp(codec)) - snd_hdac_sync_audio_rate(&codec->core, pin_nid, runtime- >rate); +snd_hdac_sync_audio_rate (&codec->core, pin_nid,-1 , + runtime->rate);sound/pci/hda/patch_hdmi.c +1
-2non_pcm =check_non_pcm_per_cvt (codec, cvt_nid);mutex_lock (&per_pin->lock);@@ -2285,7 +2286,7 @@ 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_pin_eld_notify (void *audio_ptr,int port) +static void intel_pin_eld_notify (void *audio_ptr,int port,int dev_id) {struct hda_codec *codec = audio_ptr;int pin_nid; --2.5.0
Quoted 8 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 77 lines
-----Original Message-----
From: Pandiyan, Dhinakaran
Sent: Friday, August 5, 2016 1:57 PM
To: Yang, Libin <[email protected]>
Cc: [email protected]; [email protected]; alsa-devel@alsa- project.org; [email protected]
Subject: Re: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MSTQuoted 11 lines · Libin
Quoted 11 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Dhinakaran Pandiyan
Sent: Wednesday, August 3, 2016 10:15 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Pandiyan, Dhinakaran <[email protected]>
Subject: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MSTQuoted 5 lines
Quoted 5 lines
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it'smeaning.
Quoted 50 lines
Quoted 40 lines
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_ops(quoted diff) +4
-3- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id, + int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int dev_id, + bool *enabled, unsigned char *buf, int max_bytes);struct
i915_audio_component_audio_ops(quoted diff) +2
-1- void (*pin_eld_notify)(void *audio_ptr, int port); + void (*pin_eld_notify)(void *audio_ptr, int port, int + dev_id);This patch makes dummy changes in the audio drivers for build to succeed.
Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++-- ------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/i915_drv.hindex 65ada5d..8e4c8c8 100644drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 2057
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +1
-1@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ]; -struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];We may still need save the port number info. In non-MST mode, device entry means nothing. This means av_enc_map[pipe] may not get the right
intel_encoder
Quoted 4 lines
Quoted 3 lines
Regards,
LibinWe find the encoder using port in
get_saved_encoder()
It seems it still can't get the encoder for SST/HDMI as pipe may always be -1 or 0 for SST/HDMI?
Regards,
Libin
Quoted 227 lines
Quoted 227 lines
Quoted 227 lines
drivers/gpu/drm/i915/i915_drv.h +0
-0/* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch diff --git
a/drivers/gpu/drm/i915/intel_audio.cb/drivers/gpu/drm/i915/intel_audio.c
index 8c493de..cbe44c8 100644drivers/gpu/drm/i915/intel_audio.c +0
-0@@ -500,6 +500,9 @@ void intel_audio_codec_enable(struct
intel_encoder*intel_encoder)drivers/gpu/drm/i915/intel_audio.c +3
-0struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + connector =drm_select_eld (encoder);if (!connector)@@ -522,14 +525,19 @@ void intel_audio_codec_enable(struct
intel_encoder*intel_encoder)
dev_priv->display.audio_codec_enable(connector,intel_encoder,drivers/gpu/drm/i915/intel_audio.c +5
-1adjusted_mode); +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe; +mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector = connector; +/* referred in audio callbacks */ - dev_priv->dig_port_map[port] = intel_encoder; + dev_priv->av_enc_map[pipe] = intel_encoder;mutex_unlock (&dev_priv->av_mutex); if (acomp && acomp->audio_ops && acomp->audio_ops-Quoted 1 line
pin_eld_notify)drivers/gpu/drm/i915/intel_audio.c +0
-1- acomp->audio_ops->pin_eld_notify(acomp->audio_ops-Quoted 1 line
audio_ptr, (int) port);drivers/gpu/drm/i915/intel_audio.c +1
-0+ acomp->audio_ops->pin_eld_notify(acomp->audio_ops-Quoted 1 line
audio_ptr,drivers/gpu/drm/i915/intel_audio.c +1
-0+ (int) port, dev_id); }/** @@ -542,22 +550,29 @@ void intel_audio_codec_enable(struct
intel_encoder*intel_encoder) voidintel_audio_codec_disable(struct intel_encoder *intel_encoder){drivers/gpu/drm/i915/intel_audio.c +7
-1struct drm_encoder *encoder = &intel_encoder->base; +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc);struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv =to_i915 (dev);struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe;if (dev_priv->display.audio_codec_disable) dev_priv->display.audio_codec_disable (intel_encoder);mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector =NULL ; - dev_priv->dig_port_map[port] =NULL ; + dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex); if (acomp && acomp->audio_ops && acomp->audio_ops-Quoted 1 line
pin_eld_notify)drivers/gpu/drm/i915/intel_audio.c +0
-1- acomp->audio_ops->pin_eld_notify(acomp->audio_ops-Quoted 1 line
audio_ptr, (int) port);drivers/gpu/drm/i915/intel_audio.c +1
-0+ acomp->audio_ops->pin_eld_notify(acomp->audio_ops-Quoted 1 line
audio_ptr,drivers/gpu/drm/i915/intel_audio.c +28
-2+ (int) port, dev_id); }/** @@ -628,8 +643,32 @@ static int i915_audio_component_get_cdclk_freq(struct device *dev) return dev_priv->cdclk_freq; } -static int i915_audio_component_sync_audio_rate (struct device *dev, -int port,int rate) +static struct intel_encoder *get_saved_encoder (struct intel_encoder *av_enc_map[], +int port,int dev_id) +{ + +enum pipe pipe; +struct drm_encoder *encoder; + +if (dev_id >=0 && dev_id <I915_MAX_PIPES ) +return av_enc_map[dev_id]; + +for (pipe =PIPE_A ; pipe <I915_MAX_PIPES ; pipe++) { + +if (!av_enc_map[pipe]) +continue ; + + encoder = &av_enc_map[pipe]->base; +if (port ==enc_to_dig_port (encoder)->port) +return av_enc_map[pipe]; + } + +return NULL ; + +} + +static int i915_audio_component_sync_audio_rate (struct device *dev, +int port, +int dev_id,int rate) {struct drm_i915_private *dev_priv =dev_to_i915 (dev); struct intel_encoder *intel_encoder; @@ -649,15 +688,16 @@ staticint i915_audio_component_sync_audio_rate(struct device *dev,
drivers/gpu/drm/i915/intel_audio.c +2
-2return 0 ;mutex_lock (&dev_priv->av_mutex); +/* 1. get the pipe */ - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ + intel_encoder = get_saved_encoder(dev_priv->av_enc_map, port,
dev_id);drivers/gpu/drm/i915/intel_audio.c +4
-1if (!intel_encoder || !intel_encoder->base.crtc || intel_encoder->type !=INTEL_OUTPUT_HDMI ) {DRM_DEBUG_KMS ("no valid port %c\n" ,port_name (port)); err = -ENODEV ; goto unlock; } + crtc =to_intel_crtc (intel_encoder->base.crtc); pipe = crtc->pipe;if (pipe ==INVALID_PIPE ) {@@ -702,7 +742,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, }static int i915_audio_component_get_eld (struct device *dev,int port, -bool *enabled, +int dev_id,bool *enabled,unsigned char *buf,int max_bytes) { struct drm_i915_private *dev_priv = dev_to_i915(dev); @@ -710,17 +750,21 @@ static int i915_audio_component_get_eld(struct device +*dev, intport,
drivers/gpu/drm/i915/intel_audio.c +3
-10const u8 *eld;int ret = -EINVAL ; +mutex_lock (&dev_priv->av_mutex); - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ -if (intel_encoder) { - ret =0 ; - *enabled = intel_encoder->audio_connector !=NULL ; -if (*enabled) { - eld = intel_encoder->audio_connector->eld; - ret =drm_eld_size (eld); -memcpy (buf, eld,min (max_bytes, ret)); - } + + intel_encoder = get_saved_encoder(dev_priv->av_enc_map, port,
dev_id);drivers/gpu/drm/i915/intel_audio.c +11
-0+if (!intel_encoder) { +mutex_unlock (&dev_priv->av_mutex); +return ret; + } + + ret =0 ; + *enabled = intel_encoder->audio_connector !=NULL ; +if (*enabled) { + eld = intel_encoder->audio_connector->eld; + ret =drm_eld_size (eld); +memcpy (buf, eld,min (max_bytes, ret)); }mutex_unlock (&dev_priv->av_mutex);(quoted diff) +0
-0
b/include/drm/i915_component.hindex b46fa0e..1419c98 100644include/drm/i915_component.h +5
-3@@ -64,7 +64,7 @@ struct i915_audio_component_ops {* Called from audio driver. After audio driver sets the * sample rate, it will call this function to set n/cts */ -int (*sync_audio_rate)(struct device *,int port,int rate); +int (*sync_audio_rate)(struct device *,int port,int dev_id,int +rate);/** * @get_eld: fill the audio state and ELD bytes for the given port * @@ -77,7 +77,7 @@ struct i915_audio_component_ops {* Note that the returned size may be over @max_bytes. Then it * implies that only a part of ELD has been copied to the buffer. */ -int (*get_eld)(struct device *,int port,bool *enabled, +int (*get_eld)(struct device *,int port,int dev_id,bool +*enabled,unsigned char *buf,int max_bytes); };@@ -97,7 +97,7 @@ struct i915_audio_component_audio_ops {* status accordingly (even when the HDA controller is in power save * mode). */ -void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id); };/** include/sound/hda_i915.h +0
-0@@ -10,8 +10,9 @@int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable);int
snd_hdac_display_power(struct hdac_bus *bus, bool enable); voidsnd_hdac_i915_set_bclk(struct hdac_bus *bus); -int snd_hdac_sync_audio_rate(structhdac_device*codec,hda_nid_tnid,
Quoted 121 lines
Quoted 7 lines
include/sound/hda_i915.h line 16
Quoted 7 lines
int rate); -int snd_hdac_acomp_get_eld(struct
hdac_device*codec,hda_nid_tnid,include/sound/hda_i915.h +4
-0+int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate); +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t +nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes);int
Quoted 113 lines
Quoted 105 lines
snd_hdac_i915_init(struct hdac_bus *bus); intsnd_hdac_i915_exit(struct hdac_bus *bus); @@ -29,13 +30,13 @@ static inline voidsnd_hdac_i915_set_bclk(struct hdac_bus *bus){ } static inline int snd_hdac_sync_audio_rate(structhdac_device*codec,include/sound/hda_i915.h +1
-1- hda_nid_t nid, int rate) + hda_nid_t nid, int dev_id, int rate) { return 0; } static inline int snd_hdac_acomp_get_eld(struct hdac_device *codec,
hda_nid_tnid,include/sound/hda_i915.h +2
-2- bool *audio_enabled, char *buffer, - int max_bytes) + int dev_id, bool *audio_enabled, + char *buffer, int max_bytes) { return -ENODEV; }sound/hda/hdac_i915.c index renamed from sound/hda/hdac_i915.c +0
-0c9af022..6ea63ac 100644
sound/hda/hdac_i915.c +0
-1@@ -201,7 +201,8 @@ static int pin2port(struct hdac_device *codec,hda_nid_t pin_nid) * This function sets N/CTS value based on the given sample rate. * Returns zero for success, or a negative error code. */ -int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_tnid, int
rate)sound/hda/hdac_i915.c +2
-1+int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate) {struct hdac_bus *bus = codec->bus; struct i915_audio_component *acomp = bus->audio_component; @@ -212,7 +213,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device*codec,
hda_nid_tnid, int rate)sound/hda/hdac_i915.c +4
-2port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->sync_audio_rate (acomp->dev, port, rate); +return acomp->ops->sync_audio_rate (acomp->dev, port, dev_id, +rate); }EXPORT_SYMBOL_GPL (snd_hdac_sync_audio_rate);@@ -236,7 +237,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);* thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched. */ -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t +nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes) { struct hdac_bus *bus = codec->bus; @@ -249,7 +250,7 @@ intsnd_hdac_acomp_get_eld(struct
hdac_device*codec,hda_nid_tnid,sound/hda/hdac_i915.c +1
-1port =pin2port (codec, nid);if (port <0 )return -EINVAL ; - return acomp->ops->get_eld(acomp->dev, port, audio_enabled, + return acomp->ops->get_eld(acomp->dev, port, dev_id,
audio_enabled,sound/hda/hdac_i915.c +0
-0buffer, max_bytes); }EXPORT_SYMBOL_GPL (snd_hdac_acomp_get_eld);sound/pci/hda/patch_hdmi.c +1
-1@@ -1485,7 +1485,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec,mutex_lock (&per_pin->lock); eld->monitor_present = false; - size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid, + size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid,-1 , &eld->monitor_present, eld->eld_buffer,ELD_MAX_SIZE );sound/pci/hda/patch_hdmi.c +2
-1if (size >0 ) {@@ -1739,7 +1739,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, /* Call sync_audio_rate to set the N/CTS/M manually if necessary */ /* Todo: add DP1.2 MST audio support later */ if (codec_has_acomp(codec)) - snd_hdac_sync_audio_rate(&codec->core, pin_nid, runtime- >rate); +snd_hdac_sync_audio_rate (&codec->core, pin_nid,-1 , + runtime->rate);sound/pci/hda/patch_hdmi.c +2
-2non_pcm =check_non_pcm_per_cvt (codec, cvt_nid);mutex_lock (&per_pin->lock);@@ -2285,7 +2286,7 @@ 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_pin_eld_notify (void *audio_ptr,int port) +static void intel_pin_eld_notify (void *audio_ptr,int port,int +dev_id) {struct hda_codec *codec = audio_ptr;int pin_nid; --2.5.0
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 79 lines · Libin
Quoted 79 lines
-----Original Message-----
From: Pandiyan, Dhinakaran
Sent: Friday, August 5, 2016 1:57 PM
To: Yang, Libin <[email protected]>
Cc: [email protected]; [email protected]; alsa-devel@alsa- project.org; [email protected]
Subject: Re: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MSTQuoted 11 lines · Libin
Quoted 11 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Dhinakaran Pandiyan
Sent: Wednesday, August 3, 2016 10:15 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Pandiyan, Dhinakaran <[email protected]>
Subject: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MSTQuoted 5 lines
Quoted 5 lines
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it'smeaning.
Quoted 53 lines
Quoted 40 lines
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_ops(quoted diff) +4
-3- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id, + int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int dev_id, + bool *enabled, unsigned char *buf, int max_bytes);struct
i915_audio_component_audio_ops(quoted diff) +2
-1- void (*pin_eld_notify)(void *audio_ptr, int port); + void (*pin_eld_notify)(void *audio_ptr, int port, int + dev_id);This patch makes dummy changes in the audio drivers for build to succeed.
Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++-- ------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/i915_drv.hindex 65ada5d..8e4c8c8 100644drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 2057
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +1
-1@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ]; -struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];We may still need save the port number info. In non-MST mode, device entry means nothing. This means av_enc_map[pipe] may not get the right
intel_encoderRegards,
Libin
Quoted 8 lines
Quoted 1 line
We find the encoder using port in
get_saved_encoder()It seems it still can't get the encoder for SST/HDMI as pipe may always be -1 or 0 for SST/HDMI?
Regards,
Libin
The audio driver sends dev_id=-1, but the correct "port" for SST. So, we loop through all the saved encoders and choose the one that is tied to "port"
for (pipe = PIPE_A; pipe < I915_MAX_PIPES; pipe++) {
if (!av_enc_map[pipe]) continue; encoder = &av_enc_map[pipe]->base; if (port == enc_to_dig_port(encoder)->port) return av_enc_map[pipe]; }
Quoted 349 lines
Quoted 227 lines
Quoted 227 lines
Quoted 227 lines
drivers/gpu/drm/i915/i915_drv.h +0
-0/* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch diff --git
a/drivers/gpu/drm/i915/intel_audio.cb/drivers/gpu/drm/i915/intel_audio.c
index 8c493de..cbe44c8 100644drivers/gpu/drm/i915/intel_audio.c +0
-0@@ -500,6 +500,9 @@ void intel_audio_codec_enable(struct
intel_encoder*intel_encoder)drivers/gpu/drm/i915/intel_audio.c +3
-0struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + connector =drm_select_eld (encoder);if (!connector)@@ -522,14 +525,19 @@ void intel_audio_codec_enable(struct
intel_encoder*intel_encoder)
dev_priv->display.audio_codec_enable(connector,intel_encoder,drivers/gpu/drm/i915/intel_audio.c +5
-1adjusted_mode); +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe; +mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector = connector; +/* referred in audio callbacks */ - dev_priv->dig_port_map[port] = intel_encoder; + dev_priv->av_enc_map[pipe] = intel_encoder;mutex_unlock (&dev_priv->av_mutex); if (acomp && acomp->audio_ops && acomp->audio_ops-Quoted 1 line
pin_eld_notify)drivers/gpu/drm/i915/intel_audio.c +0
-1- acomp->audio_ops->pin_eld_notify(acomp->audio_ops-Quoted 1 line
audio_ptr, (int) port);drivers/gpu/drm/i915/intel_audio.c +1
-0+ acomp->audio_ops->pin_eld_notify(acomp->audio_ops-Quoted 1 line
audio_ptr,drivers/gpu/drm/i915/intel_audio.c +1
-0+ (int) port, dev_id); }/** @@ -542,22 +550,29 @@ void intel_audio_codec_enable(struct
intel_encoder*intel_encoder) voidintel_audio_codec_disable(struct intel_encoder *intel_encoder){drivers/gpu/drm/i915/intel_audio.c +7
-1struct drm_encoder *encoder = &intel_encoder->base; +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc);struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv =to_i915 (dev);struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe;if (dev_priv->display.audio_codec_disable) dev_priv->display.audio_codec_disable (intel_encoder);mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector =NULL ; - dev_priv->dig_port_map[port] =NULL ; + dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex); if (acomp && acomp->audio_ops && acomp->audio_ops-Quoted 1 line
pin_eld_notify)drivers/gpu/drm/i915/intel_audio.c +0
-1- acomp->audio_ops->pin_eld_notify(acomp->audio_ops-Quoted 1 line
audio_ptr, (int) port);drivers/gpu/drm/i915/intel_audio.c +1
-0+ acomp->audio_ops->pin_eld_notify(acomp->audio_ops-Quoted 1 line
audio_ptr,drivers/gpu/drm/i915/intel_audio.c +28
-2+ (int) port, dev_id); }/** @@ -628,8 +643,32 @@ static int i915_audio_component_get_cdclk_freq(struct device *dev) return dev_priv->cdclk_freq; } -static int i915_audio_component_sync_audio_rate (struct device *dev, -int port,int rate) +static struct intel_encoder *get_saved_encoder (struct intel_encoder *av_enc_map[], +int port,int dev_id) +{ + +enum pipe pipe; +struct drm_encoder *encoder; + +if (dev_id >=0 && dev_id <I915_MAX_PIPES ) +return av_enc_map[dev_id]; + +for (pipe =PIPE_A ; pipe <I915_MAX_PIPES ; pipe++) { + +if (!av_enc_map[pipe]) +continue ; + + encoder = &av_enc_map[pipe]->base; +if (port ==enc_to_dig_port (encoder)->port) +return av_enc_map[pipe]; + } + +return NULL ; + +} + +static int i915_audio_component_sync_audio_rate (struct device *dev, +int port, +int dev_id,int rate) {struct drm_i915_private *dev_priv =dev_to_i915 (dev); struct intel_encoder *intel_encoder; @@ -649,15 +688,16 @@ staticint i915_audio_component_sync_audio_rate(struct device *dev,
drivers/gpu/drm/i915/intel_audio.c +2
-2return 0 ;mutex_lock (&dev_priv->av_mutex); +/* 1. get the pipe */ - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ + intel_encoder = get_saved_encoder(dev_priv->av_enc_map, port,
dev_id);drivers/gpu/drm/i915/intel_audio.c +4
-1if (!intel_encoder || !intel_encoder->base.crtc || intel_encoder->type !=INTEL_OUTPUT_HDMI ) {DRM_DEBUG_KMS ("no valid port %c\n" ,port_name (port)); err = -ENODEV ; goto unlock; } + crtc =to_intel_crtc (intel_encoder->base.crtc); pipe = crtc->pipe;if (pipe ==INVALID_PIPE ) {@@ -702,7 +742,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, }static int i915_audio_component_get_eld (struct device *dev,int port, -bool *enabled, +int dev_id,bool *enabled,unsigned char *buf,int max_bytes) { struct drm_i915_private *dev_priv = dev_to_i915(dev); @@ -710,17 +750,21 @@ static int i915_audio_component_get_eld(struct device +*dev, intport,
drivers/gpu/drm/i915/intel_audio.c +3
-10const u8 *eld;int ret = -EINVAL ; +mutex_lock (&dev_priv->av_mutex); - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ -if (intel_encoder) { - ret =0 ; - *enabled = intel_encoder->audio_connector !=NULL ; -if (*enabled) { - eld = intel_encoder->audio_connector->eld; - ret =drm_eld_size (eld); -memcpy (buf, eld,min (max_bytes, ret)); - } + + intel_encoder = get_saved_encoder(dev_priv->av_enc_map, port,
dev_id);drivers/gpu/drm/i915/intel_audio.c +11
-0+if (!intel_encoder) { +mutex_unlock (&dev_priv->av_mutex); +return ret; + } + + ret =0 ; + *enabled = intel_encoder->audio_connector !=NULL ; +if (*enabled) { + eld = intel_encoder->audio_connector->eld; + ret =drm_eld_size (eld); +memcpy (buf, eld,min (max_bytes, ret)); }mutex_unlock (&dev_priv->av_mutex);(quoted diff) +0
-0
b/include/drm/i915_component.hindex b46fa0e..1419c98 100644include/drm/i915_component.h +5
-3@@ -64,7 +64,7 @@ struct i915_audio_component_ops {* Called from audio driver. After audio driver sets the * sample rate, it will call this function to set n/cts */ -int (*sync_audio_rate)(struct device *,int port,int rate); +int (*sync_audio_rate)(struct device *,int port,int dev_id,int +rate);/** * @get_eld: fill the audio state and ELD bytes for the given port * @@ -77,7 +77,7 @@ struct i915_audio_component_ops {* Note that the returned size may be over @max_bytes. Then it * implies that only a part of ELD has been copied to the buffer. */ -int (*get_eld)(struct device *,int port,bool *enabled, +int (*get_eld)(struct device *,int port,int dev_id,bool +*enabled,unsigned char *buf,int max_bytes); };@@ -97,7 +97,7 @@ struct i915_audio_component_audio_ops {* status accordingly (even when the HDA controller is in power save * mode). */ -void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id); };/** include/sound/hda_i915.h +0
-0@@ -10,8 +10,9 @@int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable);int
snd_hdac_display_power(struct hdac_bus *bus, bool enable); voidsnd_hdac_i915_set_bclk(struct hdac_bus *bus); -int snd_hdac_sync_audio_rate(structhdac_device*codec,hda_nid_tnid,Quoted 121 lines
Quoted 7 lines
include/sound/hda_i915.h line 16
Quoted 7 lines
int rate); -int snd_hdac_acomp_get_eld(struct
hdac_device*codec,hda_nid_tnid,include/sound/hda_i915.h +4
-0+int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate); +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t +nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes);int
Quoted 113 lines
Quoted 105 lines
snd_hdac_i915_init(struct hdac_bus *bus); intsnd_hdac_i915_exit(struct hdac_bus *bus); @@ -29,13 +30,13 @@ static inline voidsnd_hdac_i915_set_bclk(struct hdac_bus *bus){ } static inline int snd_hdac_sync_audio_rate(structhdac_device*codec,include/sound/hda_i915.h +1
-1- hda_nid_t nid, int rate) + hda_nid_t nid, int dev_id, int rate) { return 0; } static inline int snd_hdac_acomp_get_eld(struct hdac_device *codec,
hda_nid_tnid,include/sound/hda_i915.h +2
-2- bool *audio_enabled, char *buffer, - int max_bytes) + int dev_id, bool *audio_enabled, + char *buffer, int max_bytes) { return -ENODEV; }sound/hda/hdac_i915.c index renamed from sound/hda/hdac_i915.c +0
-0c9af022..6ea63ac 100644
sound/hda/hdac_i915.c +0
-1@@ -201,7 +201,8 @@ static int pin2port(struct hdac_device *codec,hda_nid_t pin_nid) * This function sets N/CTS value based on the given sample rate. * Returns zero for success, or a negative error code. */ -int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_tnid, int
rate)sound/hda/hdac_i915.c +2
-1+int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, +int dev_id,int rate) {struct hdac_bus *bus = codec->bus; struct i915_audio_component *acomp = bus->audio_component; @@ -212,7 +213,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device*codec,
hda_nid_tnid, int rate)sound/hda/hdac_i915.c +4
-2port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->sync_audio_rate (acomp->dev, port, rate); +return acomp->ops->sync_audio_rate (acomp->dev, port, dev_id, +rate); }EXPORT_SYMBOL_GPL (snd_hdac_sync_audio_rate);@@ -236,7 +237,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);* thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched. */ -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t +nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes) { struct hdac_bus *bus = codec->bus; @@ -249,7 +250,7 @@ intsnd_hdac_acomp_get_eld(struct
hdac_device*codec,hda_nid_tnid,sound/hda/hdac_i915.c +1
-1port =pin2port (codec, nid);if (port <0 )return -EINVAL ; - return acomp->ops->get_eld(acomp->dev, port, audio_enabled, + return acomp->ops->get_eld(acomp->dev, port, dev_id,
audio_enabled,sound/hda/hdac_i915.c +0
-0buffer, max_bytes); }EXPORT_SYMBOL_GPL (snd_hdac_acomp_get_eld);sound/pci/hda/patch_hdmi.c +1
-1@@ -1485,7 +1485,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec,mutex_lock (&per_pin->lock); eld->monitor_present = false; - size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid, + size =snd_hdac_acomp_get_eld (&codec->core, per_pin->pin_nid,-1 , &eld->monitor_present, eld->eld_buffer,ELD_MAX_SIZE );sound/pci/hda/patch_hdmi.c +2
-1if (size >0 ) {@@ -1739,7 +1739,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, /* Call sync_audio_rate to set the N/CTS/M manually if necessary */ /* Todo: add DP1.2 MST audio support later */ if (codec_has_acomp(codec)) - snd_hdac_sync_audio_rate(&codec->core, pin_nid, runtime- >rate); +snd_hdac_sync_audio_rate (&codec->core, pin_nid,-1 , + runtime->rate);sound/pci/hda/patch_hdmi.c +2
-2non_pcm =check_non_pcm_per_cvt (codec, cvt_nid);mutex_lock (&per_pin->lock);@@ -2285,7 +2286,7 @@ 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_pin_eld_notify (void *audio_ptr,int port) +static void intel_pin_eld_notify (void *audio_ptr,int port,int +dev_id) {struct hda_codec *codec = audio_ptr;int pin_nid; --2.5.0
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/dp: DP audio API changes for MST
Quoted 108 lines
-----Original Message-----
From: Pandiyan, Dhinakaran
Sent: Friday, August 5, 2016 2:42 PM
To: Yang, Libin <[email protected]>
Cc: [email protected]; [email protected]; alsa-devel@alsa- project.org; [email protected]
Subject: Re: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MSTQuoted 44 lines · Libin
Quoted 44 lines
-----Original Message-----
From: Pandiyan, Dhinakaran
Sent: Friday, August 5, 2016 1:57 PM
To: Yang, Libin <[email protected]>
Cc: [email protected]; [email protected]; alsa-devel@alsa- project.org; [email protected]
Subject: Re: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MSTQuoted 11 lines · Libin
Quoted 11 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Dhinakaran Pandiyan
Sent: Wednesday, August 3, 2016 10:15 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Pandiyan, Dhinakaran <[email protected]>
Subject: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MSTQuoted 6 lines
Quoted 6 lines
DP MST provides the capability to send multiple video and audio streams via one single port. This requires the API's between i915 and audio drivers to distinguish between audio capable displays connected to a port. This patch adds this support via an additional parameter 'int
dev_id'. The existing parameter 'port' does not change it'smeaning.
Quoted 16 lines
Quoted 16 lines
dev_id=MST : pipe that the stream originates from Non-MST : -1Affected APIs:
structi915_audio_component_ops(quoted diff) +4
-3- int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int dev_id, + int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int dev_id, + bool *enabled, unsigned char *buf, int max_bytes);Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
struct
i915_audio_component_audio_ops(quoted diff) +2
-1- void (*pin_eld_notify)(void *audio_ptr, int port); + void (*pin_eld_notify)(void *audio_ptr, int port, int + dev_id);This patch makes dummy changes in the audio drivers for build to
succeed.
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 19 lines
Signed-off-by: Dhinakaran Pandiyan
<[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_audio.c | 82 +++++++++++++++++++++++++++++-- ------- include/drm/i915_component.h | 6 +-- include/sound/hda_i915.h | 11 ++--- sound/hda/hdac_i915.c | 9 +++-- sound/pci/hda/patch_hdmi.c | 7 ++-- 6 files changed, 82 insertions(+), 35 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/i915_drv.hindex 65ada5d..8e4c8c8 100644drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 2057
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +1
-1@@ -2054,7 +2054,7 @@ struct drm_i915_private {/* perform PHY state sanity checks? */ bool chv_phy_assert[2 ]; -struct intel_encoder *dig_port_map[I915_MAX_PORTS ]; +struct intel_encoder *av_enc_map[I915_MAX_PIPES ];We may still need save the port number info. In non-MST mode, device entry means nothing. This means av_enc_map[pipe] may not get the right
intel_encoderRegards,
LibinQuoted 8 lines
Quoted 1 line
We find the encoder using port in
get_saved_encoder()It seems it still can't get the encoder for SST/HDMI as pipe may always be -1 or 0 for SST/HDMI?
Regards,
LibinThe audio driver sends dev_id=-1, but the correct "port" for SST. So, we loop through all the saved encoders and choose the one that is tied to "port"
for (pipe =
PIPE_A; pipe <I915_MAX_PIPES; pipe++) {
Quoted 7 lines
if (!av_enc_map[pipe]) continue; encoder = &av_enc_map[pipe]->base; if (port == enc_to_dig_port(encoder)->port) return av_enc_map[pipe]; }
Get your mean. Thanks.
Quoted 292 lines
Quoted 132 lines
Quoted 41 lines
Quoted 41 lines
Quoted 41 lines
drivers/gpu/drm/i915/i915_drv.h +0
-0/* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch diff --git
a/drivers/gpu/drm/i915/intel_audio.cb/drivers/gpu/drm/i915/intel_audio.c
index 8c493de..cbe44c8 100644drivers/gpu/drm/i915/intel_audio.c +0
-0@@ -500,6 +500,9 @@ void intel_audio_codec_enable(struct
intel_encoder*intel_encoder)drivers/gpu/drm/i915/intel_audio.c +3
-0struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + connector =drm_select_eld (encoder);if (!connector)@@ -522,14 +525,19 @@ void intel_audio_codec_enable(struct
intel_encoder*intel_encoder)
dev_priv->display.audio_codec_enable(connector,intel_encoder,drivers/gpu/drm/i915/intel_audio.c +5
-1adjusted_mode); +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe; +mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector = connector; +/* referred in audio callbacks */ - dev_priv->dig_port_map[port] = intel_encoder; + dev_priv->av_enc_map[pipe] = intel_encoder;mutex_unlock (&dev_priv->av_mutex);Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_audio.c
Quoted 5 lines
if (acomp &&
acomp->audio_ops&& acomp->audio_ops-Quoted 1 line
pin_eld_notify)drivers/gpu/drm/i915/intel_audio.c +0
-1- acomp->audio_ops->pin_eld_notify(acomp->audio_ops-Quoted 1 line
audio_ptr, (int) port);drivers/gpu/drm/i915/intel_audio.c +1
-0+ acomp->audio_ops->pin_eld_notify(acomp-audio_ops-
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 1 line
audio_ptr,drivers/gpu/drm/i915/intel_audio.c +1
-0+ (int) port, dev_id); }/** @@ -542,22 +550,29 @@ void intel_audio_codec_enable(struct
intel_encoder*intel_encoder) void intel_audio_codec_disable(structintel_encoder*intel_encoder) {drivers/gpu/drm/i915/intel_audio.c +7
-1struct drm_encoder *encoder = &intel_encoder->base; +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc);struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv =to_i915 (dev);struct i915_audio_component *acomp = dev_priv->audio_component;struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);enum port port = intel_dig_port->port; +enum pipe pipe = crtc->pipe; +int dev_id =-1 ; + +if (intel_encoder->type ==INTEL_OUTPUT_DP_MST ) + dev_id = pipe;if (dev_priv->display.audio_codec_disable) dev_priv->display.audio_codec_disable (intel_encoder);mutex_lock (&dev_priv->av_mutex); intel_encoder->audio_connector =NULL ; - dev_priv->dig_port_map[port] =NULL ; + dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex);Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_audio.c
Quoted 5 lines
if (acomp &&
acomp->audio_ops&& acomp->audio_ops-Quoted 1 line
pin_eld_notify)drivers/gpu/drm/i915/intel_audio.c +0
-1- acomp->audio_ops->pin_eld_notify(acomp->audio_ops-Quoted 1 line
audio_ptr, (int) port);drivers/gpu/drm/i915/intel_audio.c +1
-0+ acomp->audio_ops->pin_eld_notify(acomp-audio_ops-
Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
Quoted 1 line
audio_ptr,drivers/gpu/drm/i915/intel_audio.c +28
-2+ (int) port, dev_id); }/** @@ -628,8 +643,32 @@ static int i915_audio_component_get_cdclk_freq(struct device *dev) return dev_priv->cdclk_freq; } -static int i915_audio_component_sync_audio_rate (struct device *dev, -int port,int rate) +static struct intel_encoder *get_saved_encoder (struct +intel_encoder *av_enc_map[], +int port,int dev_id) { + +enum pipe pipe; +struct drm_encoder *encoder; + +if (dev_id >=0 && dev_id <I915_MAX_PIPES ) +return av_enc_map[dev_id]; + +for (pipe =PIPE_A ; pipe <I915_MAX_PIPES ; pipe++) { + +if (!av_enc_map[pipe]) +continue ; + + encoder = &av_enc_map[pipe]->base; +if (port ==enc_to_dig_port (encoder)->port) +return av_enc_map[pipe]; + } + +return NULL ; + +} + +static int i915_audio_component_sync_audio_rate (struct device +*dev,int port, +int dev_id,int rate) {struct drm_i915_private *dev_priv =dev_to_i915 (dev); struct intel_encoder *intel_encoder; @@ -649,15 +688,16 @@static int i915_audio_component_sync_audio_rate(struct device *dev,
return 0;Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_audio.c static int i915_audio_component_sync_audio_rate(struct device *dev,
Quoted 6 lines
drivers/gpu/drm/i915/intel_audio.c +2
-2mutex_lock (&dev_priv->av_mutex); +/* 1. get the pipe */ - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ + intel_encoder = get_saved_encoder(dev_priv->av_enc_map,port,
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
dev_id);drivers/gpu/drm/i915/intel_audio.c +4
-2if (!intel_encoder || !intel_encoder->base.crtc || intel_encoder->type !=INTEL_OUTPUT_HDMI ) {DRM_DEBUG_KMS ("no valid port %c\n" ,port_name (port)); err = -ENODEV ; goto unlock; } + crtc =to_intel_crtc (intel_encoder->base.crtc); pipe = crtc->pipe;if (pipe ==INVALID_PIPE ) {@@ -702,7 +742,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, }static int i915_audio_component_get_eld (struct device *dev,int port, -bool *enabled, +int dev_id,bool *enabled,unsigned char *buf,int max_bytes) { struct drm_i915_private *dev_priv = dev_to_i915(dev); @@ -710 ,17 +750,21 @@ static int i915_audio_component_get_eld(struct device +*dev, intport,
drivers/gpu/drm/i915/intel_audio.c +0
-0const u8 *eld;int ret = -EINVAL ;Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_audio.c +1
-4+mutex_lock (&dev_priv->av_mutex); - intel_encoder = dev_priv->dig_port_map[port]; -/* intel_encoder might be NULL for DP MST */ -if (intel_encoder) { - ret =0 ;Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_audio.c static int i915_audio_component_get_eld(struct device *dev, int port,
Quoted 8 lines
drivers/gpu/drm/i915/intel_audio.c +2
-6- *enabled = intel_encoder->audio_connector !=NULL ; -if (*enabled) { - eld = intel_encoder->audio_connector->eld; - ret =drm_eld_size (eld); -memcpy (buf, eld,min (max_bytes, ret)); - } + + intel_encoder = get_saved_encoder(dev_priv->av_enc_map,port,
Quoted 46 lines
Quoted 46 lines
Quoted 46 lines
Quoted 46 lines
dev_id);drivers/gpu/drm/i915/intel_audio.c +11
-0+if (!intel_encoder) { +mutex_unlock (&dev_priv->av_mutex); +return ret; + } + + ret =0 ; + *enabled = intel_encoder->audio_connector !=NULL ; +if (*enabled) { + eld = intel_encoder->audio_connector->eld; + ret =drm_eld_size (eld); +memcpy (buf, eld,min (max_bytes, ret)); }mutex_unlock (&dev_priv->av_mutex);(quoted diff) +0
-0
b/include/drm/i915_component.hindex b46fa0e..1419c98 100644include/drm/i915_component.h +5
-3@@ -64,7 +64,7 @@ struct i915_audio_component_ops {* Called from audio driver. After audio driver sets the * sample rate, it will call this function to set n/cts */ -int (*sync_audio_rate)(struct device *,int port,int rate); +int (*sync_audio_rate)(struct device *,int port,int dev_id, +int rate);/** * @get_eld: fill the audio state and ELD bytes for the given port * @@ -77,7 +77,7 @@ struct i915_audio_component_ops {* Note that the returned size may be over @max_bytes. Then it * implies that only a part of ELD has been copied to the buffer. */ -int (*get_eld)(struct device *,int port,bool *enabled, +int (*get_eld)(struct device *,int port,int dev_id,bool +*enabled,unsigned char *buf,int max_bytes); };@@ -97,7 +97,7 @@ struct i915_audio_component_audio_ops {* status accordingly (even when the HDA controller is in power save * mode). */ -void (*pin_eld_notify)(void *audio_ptr,int port); +void (*pin_eld_notify)(void *audio_ptr,int port,int dev_id); };Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
include/drm/i915_component.h +0
-0/** include/sound/hda_i915.h +0
-0Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
include/sound/hda_i915.h +0
-0@@ -10,8 +10,9 @@ int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, boolenable); int
snd_hdac_display_power(struct hdac_bus *bus, bool enable); voidsnd_hdac_i915_set_bclk(struct hdac_bus *bus); -intsnd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate); -int snd_hdac_acomp_get_eld(structhdac_device*codec,hda_nid_tnid,
+int snd_hdac_sync_audio_rate(structhdac_device*codec,hda_nid_tnid,
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
include/sound/hda_i915.h line 16
Quoted 4 lines
include/sound/hda_i915.h +3
-0+ int dev_id, int rate); +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t +nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes);int
Quoted 4 lines
Quoted 4 lines
snd_hdac_i915_init(struct hdac_bus *bus); intsnd_hdac_i915_exit(struct hdac_bus *bus); @@ -29,13 +30,13 @@ static inline voidsnd_hdac_i915_set_bclk(struct hdac_bus *bus){ } static inline int snd_hdac_sync_audio_rate(structhdac_device*codec,
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
include/sound/hda_i915.h
Quoted 2 lines
include/sound/hda_i915.h +1
-1- hda_nid_t nid, int rate) + hda_nid_t nid, int dev_id,int rate)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
include/sound/hda_i915.h static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus)
Quoted 8 lines
{
return 0;
}
static inline int snd_hdac_acomp_get_eld(structhdac_device
*codec,hda_nid_tnid,include/sound/hda_i915.h +1
-2- bool *audio_enabled, char *buffer, - int max_bytes) +int dev_id, bool
*audio_enabled,Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
include/sound/hda_i915.h +1
-0+ char *buffer, int max_bytes) {return -ENODEV ; }sound/hda/hdac_i915.c index renamed from sound/hda/hdac_i915.c +0
-0c9af022..6ea63ac 100644
sound/hda/hdac_i915.c +0
-0@@ -201,7 +201,8 @@ static int pin2port(struct hdac_deviceQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
sound/hda/hdac_i915.c +0
-1*codec, hda_nid_t pin_nid) * This function sets N/CTS value based on the given sample rate. * Returns zero for success, or a negative error code. */ -int snd_hdac_sync_audio_rate(struct hdac_device *codec,
hda_nid_tnid, int
rate)
+int snd_hdac_sync_audio_rate(structhdac_device*codec,hda_nid_tnid,
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
sound/hda/hdac_i915.c int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate)
Quoted 11 lines
sound/hda/hdac_i915.c +1
-1+ int dev_id, int rate) {struct hdac_bus *bus = codec->bus; struct i915_audio_component *acomp = bus->audio_component; @@ -212,7 +213,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device*codec,
hda_nid_tnid, int rate)sound/hda/hdac_i915.c +1
-1port =pin2port (codec, nid);if (port <0 )return -EINVAL ; -return acomp->ops->sync_audio_rate (acomp->dev, port, rate); + return acomp->ops->sync_audio_rate(acomp->dev, port,
dev_id,
Quoted 79 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
sound/hda/hdac_i915.c
Quoted 5 lines
sound/hda/hdac_i915.c +1
-0+rate); }EXPORT_SYMBOL_GPL (snd_hdac_sync_audio_rate);@@ -236,7 +237,7 @@
EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);Quoted 73 lines
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
sound/hda/hdac_i915.c +2
-1* thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched. */ -int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, +int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t +nid,int dev_id,bool *audio_enabled,char *buffer,int max_bytes) { struct hdac_bus *bus = codec->bus; @@ -249,7 +250,7 @@ intsnd_hdac_acomp_get_eld(struct
hdac_device*codec,hda_nid_tnid,sound/hda/hdac_i915.c +1
-1port =pin2port (codec, nid);if (port <0 )return -EINVAL ; - return acomp->ops->get_eld(acomp->dev, port, audio_enabled, + return acomp->ops->get_eld(acomp->dev, port, dev_id,
audio_enabled,sound/hda/hdac_i915.c +0
-0buffer, max_bytes); }EXPORT_SYMBOL_GPL (snd_hdac_acomp_get_eld);(quoted diff) +0
-0
b/sound/pci/hda/patch_hdmi.cindex d0d5ad8..077d48a 100644sound/pci/hda/patch_hdmi.c +0
-0@@ -1485,7 +1485,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec,Quoted 4 lines
Quoted 4 lines
sound/pci/hda/patch_hdmi.c static void sync_eld_via_acomp(struct hda_codec *codec,
Quoted 4 lines
sound/pci/hda/patch_hdmi.c +1
-1mutex_lock (&per_pin->lock); eld->monitor_present = false; - size = snd_hdac_acomp_get_eld(&codec->core, per_pin->pin_nid, + size = snd_hdac_acomp_get_eld(&codec->core, per_pin-
pin_nid,Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
sound/pci/hda/patch_hdmi.c +3
-1+-1 , &eld->monitor_present, eld->eld_buffer, ELD_MAX_SIZE);if (size >0 ) {@@ -1739,7 +1739,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, /* Call sync_audio_rate to set the N/CTS/M manually if necessary */ /* Todo: add DP1.2 MST audio support later */ if (codec_has_acomp(codec)) - snd_hdac_sync_audio_rate(&codec->core, pin_nid, runtime- >rate); +snd_hdac_sync_audio_rate (&codec->core, pin_nid,-1 , + runtime->rate);sound/pci/hda/patch_hdmi.c +2
-2non_pcm =check_non_pcm_per_cvt (codec, cvt_nid);mutex_lock (&per_pin->lock);@@ -2285,7 +2286,7 @@ 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_pin_eld_notify (void *audio_ptr,int port) +static void intel_pin_eld_notify (void *audio_ptr,int port,int +dev_id) {struct hda_codec *codec = audio_ptr;int pin_nid; --2.5.0
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Ro.CI.BAT: failure for drm/i915/dp: DP audio API changes for MST
In reply to Dhinakaran Pandiyan== Series Details ==
== Series Details ==
Series: drm/i915/dp: DP audio API changes for MST
URL : https://patchwork.freedesktop.org/series/10571/
State : failure
== Summary ==
Applying: drm/i915/dp: DP audio API changes for MST
Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/intel_audio.c
M sound/pci/hda/patch_hdmi.c
Falling back to patching base and 3-way merge... Auto-merging sound/pci/hda/patch_hdmi.c
Auto-merging drivers/gpu/drm/i915/intel_audio.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/intel_audio.c
error: Failed to merge in the changes.
Patch failed at 0001 drm/i915/dp: DP audio API changes for MST The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 9 lines · Dhinakaran Pandiyan
An additional parameter has been added to the API's between i915 and audio drivers to identify display devices that can be connected to the same port. Currently only the port identity is being shared, but this is not sufficient as multiple displays can be driven from the same port (E.g. DP MST). This patch makes the API changes with dummy changes in the audio driver (Thanks Libin). Implementation to fully enable DP MST audio will follow later.
You should put this rather in the patch description, as it's a single patch.
thanks,
Takashi
Quoted 4 lines
Dhinakaran Pandiyan(1):
drm/i915/dp: DP audio API changes for MST
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx