ALSA: hda: Move chmap helpers to core
cover ALSA: hda: Move chmap helpers to core
The HDMI channel map helper APIs and control registration can be reused by ASoC skylake HDMI drivers.
A common chmap object is created, channel map control callback handlers, helper APIs and data structures are moved to the core. Driver object store an instance of this chmap object to register chmap controls and program channel allocation for HDMI infoframe. Driver registers ops for specific operations.
Subhransu S. Prusty (3):
ALSA: hda - Create common chmap object
ALSA: hda - Move chmap support helpers/structures to core
ALSA: hda - Use the helpers from HDA core
include/sound/hdaudio.h | 1 + include/sound/hdmi_chmap.h | 84 +++++ sound/hda/Makefile | 2 +- sound/hda/hdmi_chmap.c | 763 +++++++++++++++++++++++++++++++++++++++++++ sound/pci/hda/hda_eld.c | 31 +- sound/pci/hda/patch_hdmi.c | 794 ++++----------------------------------------- 6 files changed, 923 insertions(+), 752 deletions(-) create mode 100644 include/sound/hdmi_chmap.h create mode 100644 sound/hda/hdmi_chmap.c
Signature · 1 line
1.9.1
PATCH 1/3 ALSA: hda - Create common chmap object
Common chmap object represents multichannel capablity and contains chmap ops. Legacy driver is udpated to use this and later ASoC hdac hdmi driver will also use.
In the mixer control callback handlers, information specific to driver are accessed through ops. Also during chmap control registration, use the common hdmi_chmap object instead of hda_codec.
--- include/sound/hdmi_chmap.h | 39 ++++++++++++ sound/pci/hda/patch_hdmi.c | 145 ++++++++++++++++++++++++++++----------------- 2 files changed, 131 insertions(+), 53 deletions(-) create mode 100644 include/sound/hdmi_chmap.h
include/sound/hdmi_chmap.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* For multichannel support +*/ + +#ifndef __SOUND_HDMI_CHMAP_H +#define __SOUND_HDMI_CHMAP_H + +#include <sound/hdaudio.h> + +struct cea_channel_speaker_allocation ; + +struct hdmi_chmap_ops { +/* +* Helpers for producing the channel map TLVs. These can be overridden +* for devices that have non-standard mapping requirements. +*/ +int (*chmap_cea_alloc_validate_get_type) + (struct cea_channel_speaker_allocation *cap,int channels); +void (*cea_alloc_to_tlv_chmap) + (struct cea_channel_speaker_allocation *cap, +unsigned int *chmap,int channels); + +/* check that the user-given chmap is supported */ +int (*chmap_validate)(int ca,int channels,unsigned char *chmap); + +void (*get_chmap)(struct hdac_device *hdac,int pcm_idx, +unsigned char *chmap); +void (*set_chmap)(struct hdac_device *hdac,int pcm_idx, +unsigned char *chmap,int prepared); +bool (*is_monitor_connected)(struct hdac_device *hdac,int pcm_idx); +}; + +struct hdmi_chmap { +unsigned int channels_max;/* max over all cvts */ +struct hdmi_chmap_ops ops; +struct hdac_device *hdac; +}; + +#endif /* __SOUND_HDMI_CHMAP_H */
sound/pci/hda/patch_hdmi.c +92 -53
296 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH 1/3] ALSA: hda - Create common chmap object
Quoted 5 lines · Subhransu S. Prusty
Common chmap object represents multichannel capablity and contains chmap ops. Legacy driver is udpated to use this and later ASoC hdac hdmi driver will also use.
Quoted 7 lines
In the mixer control callback handlers, information specific to driver are accessed through ops. Also during chmap control registration, use the common
hdmi_chmapobject instead ofhda_codec.Signed-off-by Subhransu S. Prusty <[email protected]>Signed-off-by Vinod Koul <[email protected]>
To make review easier, could you split this patch into two, one for just moving the hdmi_chmap out of spec, and another is the addition of new ops, get_chmap, set_chmap, etc.
thanks,
Takashi
Quoted 373 lines
--- include/sound/hdmi_chmap.h | 39 ++++++++++++ sound/pci/hda/patch_hdmi.c | 145 ++++++++++++++++++++++++++++----------------- 2 files changed, 131 insertions(+), 53 deletions(-) create mode 100644 include/sound/hdmi_chmap.hinclude/sound/hdmi_chmap.h new file +39
-0@@ -0,0 +1,39 @@ +/* +* For multichannel support +*/ + +#ifndef __SOUND_HDMI_CHMAP_H +#define __SOUND_HDMI_CHMAP_H + +#include <sound/hdaudio.h> + +struct cea_channel_speaker_allocation ; + +struct hdmi_chmap_ops { +/* +* Helpers for producing the channel map TLVs. These can be overridden +* for devices that have non-standard mapping requirements. +*/ +int (*chmap_cea_alloc_validate_get_type) + (struct cea_channel_speaker_allocation *cap,int channels); +void (*cea_alloc_to_tlv_chmap) + (struct cea_channel_speaker_allocation *cap, +unsigned int *chmap,int channels); + +/* check that the user-given chmap is supported */ +int (*chmap_validate)(int ca,int channels,unsigned char *chmap); + +void (*get_chmap)(struct hdac_device *hdac,int pcm_idx, +unsigned char *chmap); +void (*set_chmap)(struct hdac_device *hdac,int pcm_idx, +unsigned char *chmap,int prepared); +bool (*is_monitor_connected)(struct hdac_device *hdac,int pcm_idx); +}; + +struct hdmi_chmap { +unsigned int channels_max;/* max over all cvts */ +struct hdmi_chmap_ops ops; +struct hdac_device *hdac; +}; + +#endif /* __SOUND_HDMI_CHMAP_H */ sound/pci/hda/patch_hdmi.c +92
-53@@ -37,8 +37,10 @@#include <sound/jack.h> #include <sound/asoundef.h> #include <sound/tlv.h> +#include <sound/hdaudio.h> #include <sound/hda_i915.h> +#include <sound/hdmi_chmap.h> #include "hda_codec.h" #include "hda_local.h" #include "hda_jack.h" @@ -101,7 +103,6 @@ struct hdmi_spec_per_pin { };struct cea_channel_speaker_allocation ; -/* operations used by generic code that can be overridden by patches */ struct hdmi_ops { int (*pin_get_eld)(struct hda_codec *codec, hda_nid_t pin_nid,@@ -122,15 +123,6 @@ struct hdmi_ops {int (*setup_stream)(struct hda_codec *codec,hda_nid_t cvt_nid,hda_nid_t pin_nid,u32 stream_tag,int format); -/* Helpers for producing the channel map TLVs. These can be overridden -* for devices that have non-standard mapping requirements. */ -int (*chmap_cea_alloc_validate_get_type)(struct cea_channel_speaker_allocation *cap, -int channels); -void (*cea_alloc_to_tlv_chmap)(struct cea_channel_speaker_allocation *cap, -unsigned int *chmap,int channels); - -/* check that the user-given chmap is supported */ -int (*chmap_validate)(int ca,int channels,unsigned char *chmap); };struct hdmi_pcm {@@ -155,7 +147,6 @@ struct hdmi_spec {* bit 1 means the second playback PCM, and so on. */ unsigned long pcm_in_use; -unsigned int channels_max;/* max over all cvts */ struct hdmi_eld temp_eld;struct hdmi_ops ops;@@ -171,6 +162,8 @@ struct hdmi_spec {/* i915/powerwell (Haswell+/Valleyview+) specific */ struct i915_audio_component_audio_ops i915_audio_ops;bool i915_bound;/* was i915 bound in this driver? */ + +struct hdmi_chmap chmap; };#ifdef CONFIG_SND_HDA_I915 @@ -2096,8 +2089,8 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) per_cvt->channels_min =2 ;if (chans <=16 ) { per_cvt->channels_max = chans; -if (chans > spec->channels_max) - spec->channels_max = chans; +if (chans > spec->chmap.channels_max) + spec->chmap.channels_max = chans; } err = snd_hda_query_supported_pcm(codec, cvt_nid,@@ -2321,10 +2314,10 @@ static int hdmi_chmap_ctl_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) {struct snd_pcm_chmap *info =snd_kcontrol_chip (kcontrol); -struct hda_codec *codec = info->private_data; -struct hdmi_spec *spec = codec->spec; +struct hdmi_chmap *chmap = info->private_data; + uinfo->type =SNDRV_CTL_ELEM_TYPE_INTEGER ; - uinfo->count = spec->channels_max; + uinfo->count = chmap->channels_max; uinfo->value.integer.min =0 ; uinfo->value.integer.max =SNDRV_CHMAP_LAST ;return 0 ;@@ -2358,12 +2351,49 @@ static void hdmi_cea_alloc_to_tlv_chmap(struct cea_channel_speaker_allocation *cWARN_ON (count != channels); } +static void hdmi_get_chmap (struct hdac_device *hdac,int pcm_idx, +unsigned char *chmap) +{ + struct hda_codec *codec = container_of(hdac, struct hda_codec, core); +struct hdmi_spec *spec = codec->spec; +struct hdmi_spec_per_pin *per_pin =pcm_idx_to_pin (spec, pcm_idx); + +/* chmap is already set to 0 in caller */ +if (!per_pin) +return ; + +memcpy (chmap, per_pin->chmap,ARRAY_SIZE (per_pin->chmap)); +} + +static void hdmi_set_chmap (struct hdac_device *hdac,int pcm_idx, +unsigned char *chmap,int prepared) +{ + struct hda_codec *codec = container_of(hdac, struct hda_codec, core); +struct hdmi_spec *spec = codec->spec; +struct hdmi_spec_per_pin *per_pin =pcm_idx_to_pin (spec, pcm_idx); + +mutex_lock (&per_pin->lock); + per_pin->chmap_set = true; +memcpy (per_pin->chmap, chmap,ARRAY_SIZE (per_pin->chmap)); +if (prepared) +hdmi_setup_audio_infoframe (codec, per_pin, per_pin->non_pcm); +mutex_unlock (&per_pin->lock); +} + +static bool is_hdmi_monitor_connected (struct hdac_device *hdac,int pcm_idx) +{ + struct hda_codec *codec = container_of(hdac, struct hda_codec, core); +struct hdmi_spec *spec = codec->spec; +struct hdmi_spec_per_pin *per_pin =pcm_idx_to_pin (spec, pcm_idx); + +return per_pin ? true:false; +} +static int hdmi_chmap_ctl_tlv (struct snd_kcontrol *kcontrol,int op_flag,unsigned int size,unsigned int __user *tlv) {struct snd_pcm_chmap *info =snd_kcontrol_chip (kcontrol); -struct hda_codec *codec = info->private_data; -struct hdmi_spec *spec = codec->spec; +struct hdmi_chmap *chmap = info->private_data;unsigned int __user *dst;int chs, count =0 ;@@ -2373,13 +2403,14 @@ static int hdmi_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag,return -EFAULT ; size -=8 ; dst = tlv +2 ; -for (chs =2 ; chs <= spec->channels_max; chs++) { +for (chs =2 ; chs <= chmap->channels_max; chs++) {int i;struct cea_channel_speaker_allocation *cap; cap = channel_allocations;for (i =0 ; i <ARRAY_SIZE (channel_allocations); i++, cap++) {int chs_bytes = chs *4 ; -int type = spec->ops.chmap_cea_alloc_validate_get_type (cap, chs); +int type = chmap->ops.chmap_cea_alloc_validate_get_type ( + cap, chs);unsigned int tlv_chmap[8 ];if (type <0 )@@ -2396,7 +2427,7 @@ static int hdmi_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag,return -ENOMEM ; size -= chs_bytes; count += chs_bytes; - spec->ops.cea_alloc_to_tlv_chmap (cap, tlv_chmap, chs); + chmap->ops.cea_alloc_to_tlv_chmap (cap, tlv_chmap, chs);if (copy_to_user (dst, tlv_chmap, chs_bytes))return -EFAULT ; dst += chs;@@ -2411,20 +2442,17 @@ static int hdmi_chmap_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) {struct snd_pcm_chmap *info =snd_kcontrol_chip (kcontrol); -struct hda_codec *codec = info->private_data; -struct hdmi_spec *spec = codec->spec; +struct hdmi_chmap *hchmap = info->private_data;int pcm_idx = kcontrol->private_value; -struct hdmi_spec_per_pin *per_pin =pcm_idx_to_pin (spec, pcm_idx); +unsigned char chmap[8 ];int i; -if (!per_pin) { -for (i =0 ; i < spec->channels_max; i++) - ucontrol->value.integer.value[i] =0 ; -return 0 ; - } +memset (chmap,0 ,sizeof (chmap)); + hchmap->ops.get_chmap (hchmap->hdac, pcm_idx, chmap); + +for (i =0 ; i <sizeof (chmap); i++) + ucontrol->value.integer.value[i] = chmap[i]; -for (i =0 ; i <ARRAY_SIZE (per_pin->chmap); i++) - ucontrol->value.integer.value[i] = per_pin->chmap[i];return 0 ; }@@ -2432,19 +2460,17 @@ static int hdmi_chmap_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) {struct snd_pcm_chmap *info =snd_kcontrol_chip (kcontrol); -struct hda_codec *codec = info->private_data; -struct hdmi_spec *spec = codec->spec; +struct hdmi_chmap *hchmap = info->private_data;int pcm_idx = kcontrol->private_value; -struct hdmi_spec_per_pin *per_pin =pcm_idx_to_pin (spec, pcm_idx);unsigned int ctl_idx;struct snd_pcm_substream *substream; -unsigned char chmap[8 ]; +unsigned char chmap[8 ], per_pin_chmap[8 ];int i, err, ca, prepared =0 ;/* No monitor is connected in dyn_pcm_assign. * It's invalid to setup the chmap */ -if (!per_pin) +if (!hchmap->ops.is_monitor_connected (hchmap->hdac, pcm_idx))return 0 ; ctl_idx =snd_ctl_get_ioffidx (kcontrol, &ucontrol->id);@@ -2464,22 +2490,20 @@ static int hdmi_chmap_ctl_put(struct snd_kcontrol *kcontrol,memset (chmap,0 ,sizeof (chmap));for (i =0 ; i <ARRAY_SIZE (chmap); i++) chmap[i] = ucontrol->value.integer.value[i]; -if (!memcmp (chmap, per_pin->chmap,sizeof (chmap))) + + hchmap->ops.get_chmap (hchmap->hdac, pcm_idx, per_pin_chmap); +if (!memcmp (chmap, per_pin_chmap,sizeof (chmap)))return 0 ; ca =hdmi_manual_channel_allocation (ARRAY_SIZE (chmap), chmap);if (ca <0 )return -EINVAL ; -if (spec->ops.chmap_validate) { - err = spec->ops.chmap_validate (ca,ARRAY_SIZE (chmap), chmap); +if (hchmap->ops.chmap_validate) { + err = hchmap->ops.chmap_validate (ca,ARRAY_SIZE (chmap), chmap);if (err)return err; } -mutex_lock (&per_pin->lock); - per_pin->chmap_set = true; -memcpy (per_pin->chmap, chmap,sizeof (chmap)); -if (prepared) -hdmi_setup_audio_infoframe (codec, per_pin, per_pin->non_pcm); -mutex_unlock (&per_pin->lock); + + hchmap->ops.set_chmap (hchmap->hdac, pcm_idx, chmap, prepared);return 0 ; }@@ -2638,7 +2662,7 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)if (err <0 )return err;/* override handlers */ - chmap->private_data = codec; + chmap->private_data = &spec->chmap; kctl = chmap->kctl;for (i =0 ; i < kctl->count; i++) kctl->vd[i].access |=SNDRV_CTL_ELEM_ACCESS_WRITE ;@@ -2762,11 +2786,16 @@ static const struct hdmi_ops generic_standard_hdmi_ops = { .pin_setup_infoframe = hdmi_pin_setup_infoframe, .pin_hbr_setup = hdmi_pin_hbr_setup, .setup_stream = hdmi_setup_stream, +}; + +static const struct hdmi_chmap_ops chmap_ops = { .chmap_cea_alloc_validate_get_type = hdmi_chmap_cea_alloc_validate_get_type, .cea_alloc_to_tlv_chmap = hdmi_cea_alloc_to_tlv_chmap, + .get_chmap = hdmi_get_chmap, + .set_chmap = hdmi_set_chmap, + .is_monitor_connected = is_hdmi_monitor_connected, }; -static void intel_haswell_fixup_connect_list (struct hda_codec *codec,hda_nid_t nid) {@@ -2868,6 +2897,8 @@ static int patch_generic_hdmi(struct hda_codec *codec) spec->ops = generic_standard_hdmi_ops;mutex_init (&spec->pcm_lock); + spec->chmap.ops = chmap_ops; + spec->chmap.hdac = &codec->core; codec->spec = spec;hdmi_array_init (spec,4 );@@ -3483,9 +3514,12 @@ static int patch_nvhdmi(struct hda_codec *codec) spec = codec->spec; spec->dyn_pin_out = true; - spec->ops.chmap_cea_alloc_validate_get_type = + spec->chmap.ops.chmap_cea_alloc_validate_get_type = nvhdmi_chmap_cea_alloc_validate_get_type; - spec->ops.chmap_validate = nvhdmi_chmap_validate; + spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; + spec->chmap.ops.get_chmap = hdmi_get_chmap; + spec->chmap.ops.set_chmap = hdmi_set_chmap; + spec->chmap.ops.is_monitor_connected = is_hdmi_monitor_connected;return 0 ; }@@ -3992,10 +4026,15 @@ static int patch_atihdmi(struct hda_codec *codec)if (!has_amd_full_remap_support (codec)) {/* override to ATI/AMD-specific versions with pairwise mapping */ - spec->ops.chmap_cea_alloc_validate_get_type = + spec->chmap.ops.chmap_cea_alloc_validate_get_type = atihdmi_paired_chmap_cea_alloc_validate_get_type; - spec->ops.cea_alloc_to_tlv_chmap = atihdmi_paired_cea_alloc_to_tlv_chmap; - spec->ops.chmap_validate = atihdmi_paired_chmap_validate; + spec->chmap.ops.cea_alloc_to_tlv_chmap = + atihdmi_paired_cea_alloc_to_tlv_chmap; + spec->chmap.ops.chmap_validate = atihdmi_paired_chmap_validate; + spec->chmap.ops.get_chmap = hdmi_get_chmap; + spec->chmap.ops.set_chmap = hdmi_set_chmap; + spec->chmap.ops.is_monitor_connected = + is_hdmi_monitor_connected; }/* ATI/AMD converters do not advertise all of their capabilities */ @@ -4007,7 +4046,7 @@ static int patch_atihdmi(struct hda_codec *codec) per_cvt->maxbps =max (per_cvt->maxbps,24u ); } - spec->channels_max =max (spec->channels_max,8u ); + spec->chmap.channels_max =max (spec->chmap.channels_max,8u );return 0 ; }Signature · 1 line
1.9.1
Re: [PATCH 1/3] ALSA: hda - Create common chmap object
Quoted 12 lines · Takashi Iwai
Quoted 10 lines · Subhransu S. Prusty
Common chmap object represents multichannel capablity and contains chmap ops. Legacy driver is udpated to use this and later ASoC hdac hdmi driver will also use.
In the mixer control callback handlers, information specific to driver are accessed through ops. Also during chmap control registration, use the common
hdmi_chmapobject instead ofhda_codec.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Subhransu S. Prusty <[email protected]>Signed-off-by Vinod Koul <[email protected]>To make review easier, could you split this patch into two, one for just moving the
hdmi_chmapout of spec, and another is the addition of new ops,get_chmap,set_chmap, etc.
Sure, will do it.
Quoted 379 lines
thanks,
Takashi
Quoted 373 lines
--- include/sound/hdmi_chmap.h | 39 ++++++++++++ sound/pci/hda/patch_hdmi.c | 145 ++++++++++++++++++++++++++++----------------- 2 files changed, 131 insertions(+), 53 deletions(-) create mode 100644 include/sound/hdmi_chmap.hinclude/sound/hdmi_chmap.h new file +39
-0@@ -0,0 +1,39 @@ +/* +* For multichannel support +*/ + +#ifndef __SOUND_HDMI_CHMAP_H +#define __SOUND_HDMI_CHMAP_H + +#include <sound/hdaudio.h> + +struct cea_channel_speaker_allocation ; + +struct hdmi_chmap_ops { +/* +* Helpers for producing the channel map TLVs. These can be overridden +* for devices that have non-standard mapping requirements. +*/ +int (*chmap_cea_alloc_validate_get_type) + (struct cea_channel_speaker_allocation *cap,int channels); +void (*cea_alloc_to_tlv_chmap) + (struct cea_channel_speaker_allocation *cap, +unsigned int *chmap,int channels); + +/* check that the user-given chmap is supported */ +int (*chmap_validate)(int ca,int channels,unsigned char *chmap); + +void (*get_chmap)(struct hdac_device *hdac,int pcm_idx, +unsigned char *chmap); +void (*set_chmap)(struct hdac_device *hdac,int pcm_idx, +unsigned char *chmap,int prepared); +bool (*is_monitor_connected)(struct hdac_device *hdac,int pcm_idx); +}; + +struct hdmi_chmap { +unsigned int channels_max;/* max over all cvts */ +struct hdmi_chmap_ops ops; +struct hdac_device *hdac; +}; + +#endif /* __SOUND_HDMI_CHMAP_H */ sound/pci/hda/patch_hdmi.c +92
-53@@ -37,8 +37,10 @@#include <sound/jack.h> #include <sound/asoundef.h> #include <sound/tlv.h> +#include <sound/hdaudio.h> #include <sound/hda_i915.h> +#include <sound/hdmi_chmap.h> #include "hda_codec.h" #include "hda_local.h" #include "hda_jack.h" @@ -101,7 +103,6 @@ struct hdmi_spec_per_pin { };struct cea_channel_speaker_allocation ; -/* operations used by generic code that can be overridden by patches */ struct hdmi_ops { int (*pin_get_eld)(struct hda_codec *codec, hda_nid_t pin_nid,@@ -122,15 +123,6 @@ struct hdmi_ops {int (*setup_stream)(struct hda_codec *codec,hda_nid_t cvt_nid,hda_nid_t pin_nid,u32 stream_tag,int format); -/* Helpers for producing the channel map TLVs. These can be overridden -* for devices that have non-standard mapping requirements. */ -int (*chmap_cea_alloc_validate_get_type)(struct cea_channel_speaker_allocation *cap, -int channels); -void (*cea_alloc_to_tlv_chmap)(struct cea_channel_speaker_allocation *cap, -unsigned int *chmap,int channels); - -/* check that the user-given chmap is supported */ -int (*chmap_validate)(int ca,int channels,unsigned char *chmap); };struct hdmi_pcm {@@ -155,7 +147,6 @@ struct hdmi_spec {* bit 1 means the second playback PCM, and so on. */ unsigned long pcm_in_use; -unsigned int channels_max;/* max over all cvts */ struct hdmi_eld temp_eld;struct hdmi_ops ops;@@ -171,6 +162,8 @@ struct hdmi_spec {/* i915/powerwell (Haswell+/Valleyview+) specific */ struct i915_audio_component_audio_ops i915_audio_ops;bool i915_bound;/* was i915 bound in this driver? */ + +struct hdmi_chmap chmap; };#ifdef CONFIG_SND_HDA_I915 @@ -2096,8 +2089,8 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) per_cvt->channels_min =2 ;if (chans <=16 ) { per_cvt->channels_max = chans; -if (chans > spec->channels_max) - spec->channels_max = chans; +if (chans > spec->chmap.channels_max) + spec->chmap.channels_max = chans; } err = snd_hda_query_supported_pcm(codec, cvt_nid,@@ -2321,10 +2314,10 @@ static int hdmi_chmap_ctl_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) {struct snd_pcm_chmap *info =snd_kcontrol_chip (kcontrol); -struct hda_codec *codec = info->private_data; -struct hdmi_spec *spec = codec->spec; +struct hdmi_chmap *chmap = info->private_data; + uinfo->type =SNDRV_CTL_ELEM_TYPE_INTEGER ; - uinfo->count = spec->channels_max; + uinfo->count = chmap->channels_max; uinfo->value.integer.min =0 ; uinfo->value.integer.max =SNDRV_CHMAP_LAST ;return 0 ;@@ -2358,12 +2351,49 @@ static void hdmi_cea_alloc_to_tlv_chmap(struct cea_channel_speaker_allocation *cWARN_ON (count != channels); } +static void hdmi_get_chmap (struct hdac_device *hdac,int pcm_idx, +unsigned char *chmap) +{ + struct hda_codec *codec = container_of(hdac, struct hda_codec, core); +struct hdmi_spec *spec = codec->spec; +struct hdmi_spec_per_pin *per_pin =pcm_idx_to_pin (spec, pcm_idx); + +/* chmap is already set to 0 in caller */ +if (!per_pin) +return ; + +memcpy (chmap, per_pin->chmap,ARRAY_SIZE (per_pin->chmap)); +} + +static void hdmi_set_chmap (struct hdac_device *hdac,int pcm_idx, +unsigned char *chmap,int prepared) +{ + struct hda_codec *codec = container_of(hdac, struct hda_codec, core); +struct hdmi_spec *spec = codec->spec; +struct hdmi_spec_per_pin *per_pin =pcm_idx_to_pin (spec, pcm_idx); + +mutex_lock (&per_pin->lock); + per_pin->chmap_set = true; +memcpy (per_pin->chmap, chmap,ARRAY_SIZE (per_pin->chmap)); +if (prepared) +hdmi_setup_audio_infoframe (codec, per_pin, per_pin->non_pcm); +mutex_unlock (&per_pin->lock); +} + +static bool is_hdmi_monitor_connected (struct hdac_device *hdac,int pcm_idx) +{ + struct hda_codec *codec = container_of(hdac, struct hda_codec, core); +struct hdmi_spec *spec = codec->spec; +struct hdmi_spec_per_pin *per_pin =pcm_idx_to_pin (spec, pcm_idx); + +return per_pin ? true:false; +} +static int hdmi_chmap_ctl_tlv (struct snd_kcontrol *kcontrol,int op_flag,unsigned int size,unsigned int __user *tlv) {struct snd_pcm_chmap *info =snd_kcontrol_chip (kcontrol); -struct hda_codec *codec = info->private_data; -struct hdmi_spec *spec = codec->spec; +struct hdmi_chmap *chmap = info->private_data;unsigned int __user *dst;int chs, count =0 ;@@ -2373,13 +2403,14 @@ static int hdmi_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag,return -EFAULT ; size -=8 ; dst = tlv +2 ; -for (chs =2 ; chs <= spec->channels_max; chs++) { +for (chs =2 ; chs <= chmap->channels_max; chs++) {int i;struct cea_channel_speaker_allocation *cap; cap = channel_allocations;for (i =0 ; i <ARRAY_SIZE (channel_allocations); i++, cap++) {int chs_bytes = chs *4 ; -int type = spec->ops.chmap_cea_alloc_validate_get_type (cap, chs); +int type = chmap->ops.chmap_cea_alloc_validate_get_type ( + cap, chs);unsigned int tlv_chmap[8 ];if (type <0 )@@ -2396,7 +2427,7 @@ static int hdmi_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag,return -ENOMEM ; size -= chs_bytes; count += chs_bytes; - spec->ops.cea_alloc_to_tlv_chmap (cap, tlv_chmap, chs); + chmap->ops.cea_alloc_to_tlv_chmap (cap, tlv_chmap, chs);if (copy_to_user (dst, tlv_chmap, chs_bytes))return -EFAULT ; dst += chs;@@ -2411,20 +2442,17 @@ static int hdmi_chmap_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) {struct snd_pcm_chmap *info =snd_kcontrol_chip (kcontrol); -struct hda_codec *codec = info->private_data; -struct hdmi_spec *spec = codec->spec; +struct hdmi_chmap *hchmap = info->private_data;int pcm_idx = kcontrol->private_value; -struct hdmi_spec_per_pin *per_pin =pcm_idx_to_pin (spec, pcm_idx); +unsigned char chmap[8 ];int i; -if (!per_pin) { -for (i =0 ; i < spec->channels_max; i++) - ucontrol->value.integer.value[i] =0 ; -return 0 ; - } +memset (chmap,0 ,sizeof (chmap)); + hchmap->ops.get_chmap (hchmap->hdac, pcm_idx, chmap); + +for (i =0 ; i <sizeof (chmap); i++) + ucontrol->value.integer.value[i] = chmap[i]; -for (i =0 ; i <ARRAY_SIZE (per_pin->chmap); i++) - ucontrol->value.integer.value[i] = per_pin->chmap[i];return 0 ; }@@ -2432,19 +2460,17 @@ static int hdmi_chmap_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) {struct snd_pcm_chmap *info =snd_kcontrol_chip (kcontrol); -struct hda_codec *codec = info->private_data; -struct hdmi_spec *spec = codec->spec; +struct hdmi_chmap *hchmap = info->private_data;int pcm_idx = kcontrol->private_value; -struct hdmi_spec_per_pin *per_pin =pcm_idx_to_pin (spec, pcm_idx);unsigned int ctl_idx;struct snd_pcm_substream *substream; -unsigned char chmap[8 ]; +unsigned char chmap[8 ], per_pin_chmap[8 ];int i, err, ca, prepared =0 ;/* No monitor is connected in dyn_pcm_assign. * It's invalid to setup the chmap */ -if (!per_pin) +if (!hchmap->ops.is_monitor_connected (hchmap->hdac, pcm_idx))return 0 ; ctl_idx =snd_ctl_get_ioffidx (kcontrol, &ucontrol->id);@@ -2464,22 +2490,20 @@ static int hdmi_chmap_ctl_put(struct snd_kcontrol *kcontrol,memset (chmap,0 ,sizeof (chmap));for (i =0 ; i <ARRAY_SIZE (chmap); i++) chmap[i] = ucontrol->value.integer.value[i]; -if (!memcmp (chmap, per_pin->chmap,sizeof (chmap))) + + hchmap->ops.get_chmap (hchmap->hdac, pcm_idx, per_pin_chmap); +if (!memcmp (chmap, per_pin_chmap,sizeof (chmap)))return 0 ; ca =hdmi_manual_channel_allocation (ARRAY_SIZE (chmap), chmap);if (ca <0 )return -EINVAL ; -if (spec->ops.chmap_validate) { - err = spec->ops.chmap_validate (ca,ARRAY_SIZE (chmap), chmap); +if (hchmap->ops.chmap_validate) { + err = hchmap->ops.chmap_validate (ca,ARRAY_SIZE (chmap), chmap);if (err)return err; } -mutex_lock (&per_pin->lock); - per_pin->chmap_set = true; -memcpy (per_pin->chmap, chmap,sizeof (chmap)); -if (prepared) -hdmi_setup_audio_infoframe (codec, per_pin, per_pin->non_pcm); -mutex_unlock (&per_pin->lock); + + hchmap->ops.set_chmap (hchmap->hdac, pcm_idx, chmap, prepared);return 0 ; }@@ -2638,7 +2662,7 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)if (err <0 )return err;/* override handlers */ - chmap->private_data = codec; + chmap->private_data = &spec->chmap; kctl = chmap->kctl;for (i =0 ; i < kctl->count; i++) kctl->vd[i].access |=SNDRV_CTL_ELEM_ACCESS_WRITE ;@@ -2762,11 +2786,16 @@ static const struct hdmi_ops generic_standard_hdmi_ops = { .pin_setup_infoframe = hdmi_pin_setup_infoframe, .pin_hbr_setup = hdmi_pin_hbr_setup, .setup_stream = hdmi_setup_stream, +}; + +static const struct hdmi_chmap_ops chmap_ops = { .chmap_cea_alloc_validate_get_type = hdmi_chmap_cea_alloc_validate_get_type, .cea_alloc_to_tlv_chmap = hdmi_cea_alloc_to_tlv_chmap, + .get_chmap = hdmi_get_chmap, + .set_chmap = hdmi_set_chmap, + .is_monitor_connected = is_hdmi_monitor_connected, }; -static void intel_haswell_fixup_connect_list (struct hda_codec *codec,hda_nid_t nid) {@@ -2868,6 +2897,8 @@ static int patch_generic_hdmi(struct hda_codec *codec) spec->ops = generic_standard_hdmi_ops;mutex_init (&spec->pcm_lock); + spec->chmap.ops = chmap_ops; + spec->chmap.hdac = &codec->core; codec->spec = spec;hdmi_array_init (spec,4 );@@ -3483,9 +3514,12 @@ static int patch_nvhdmi(struct hda_codec *codec) spec = codec->spec; spec->dyn_pin_out = true; - spec->ops.chmap_cea_alloc_validate_get_type = + spec->chmap.ops.chmap_cea_alloc_validate_get_type = nvhdmi_chmap_cea_alloc_validate_get_type; - spec->ops.chmap_validate = nvhdmi_chmap_validate; + spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; + spec->chmap.ops.get_chmap = hdmi_get_chmap; + spec->chmap.ops.set_chmap = hdmi_set_chmap; + spec->chmap.ops.is_monitor_connected = is_hdmi_monitor_connected;return 0 ; }@@ -3992,10 +4026,15 @@ static int patch_atihdmi(struct hda_codec *codec)if (!has_amd_full_remap_support (codec)) {/* override to ATI/AMD-specific versions with pairwise mapping */ - spec->ops.chmap_cea_alloc_validate_get_type = + spec->chmap.ops.chmap_cea_alloc_validate_get_type = atihdmi_paired_chmap_cea_alloc_validate_get_type; - spec->ops.cea_alloc_to_tlv_chmap = atihdmi_paired_cea_alloc_to_tlv_chmap; - spec->ops.chmap_validate = atihdmi_paired_chmap_validate; + spec->chmap.ops.cea_alloc_to_tlv_chmap = + atihdmi_paired_cea_alloc_to_tlv_chmap; + spec->chmap.ops.chmap_validate = atihdmi_paired_chmap_validate; + spec->chmap.ops.get_chmap = hdmi_get_chmap; + spec->chmap.ops.set_chmap = hdmi_set_chmap; + spec->chmap.ops.is_monitor_connected = + is_hdmi_monitor_connected; }/* ATI/AMD converters do not advertise all of their capabilities */ @@ -4007,7 +4046,7 @@ static int patch_atihdmi(struct hda_codec *codec) per_cvt->maxbps =max (per_cvt->maxbps,24u ); } - spec->channels_max =max (spec->channels_max,8u ); + spec->chmap.channels_max =max (spec->chmap.channels_max,8u );return 0 ; }Signature · 1 line
1.9.1
PATCH 2/3 ALSA: hda - Move chmap support helpers/structures to core
In reply to Subhransu S. PrustyCopy the channel map helpers to core. The exported channel map API names are prefixed with snd_hdmi for namespace management. Arguments of the helpers are modified to take hdac_device object argument instead of hda_codec specific object. With this it can be used by other hdac devices.
Next patch removes the local channel map helpers from patch_hdmi.c and uses these common helpers.
--- include/sound/hdmi_chmap.h | 45 +++ sound/hda/Makefile | 2 +- sound/hda/hdmi_chmap.c | 763 +++++++++++++++++++++++++++++++++++++++++++++ sound/pci/hda/patch_hdmi.c | 10 - 4 files changed, 809 insertions(+), 11 deletions(-) create mode 100644 sound/hda/hdmi_chmap.c
include/sound/hdmi_chmap.h +45 -0
@@ -5,10 +5,22 @@#ifndef __SOUND_HDMI_CHMAP_H#define __SOUND_HDMI_CHMAP_H +#include <sound/pcm.h> #include <sound/hdaudio.h> struct cea_channel_speaker_allocation ; +#define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80 + +struct cea_channel_speaker_allocation { +int ca_index; +int speakers[8 ]; + +/* derived values, just for convenience */ +int channels; +int spk_mask; +}; + struct hdmi_chmap_ops {/* * Helpers for producing the channel map TLVs. These can be overridden
@@ -28,6 +40,11 @@ struct hdmi_chmap_ops {void (*set_chmap)(struct hdac_device *hdac,int pcm_idx,unsigned char *chmap,int prepared);bool (*is_monitor_connected)(struct hdac_device *hdac,int pcm_idx); +/* get and set channel assigned to each HDMI ASP (audio sample packet) slot */ +int (*pin_get_slot_channel)(struct hdac_device *codec, +hda_nid_t pin_nid,int asp_slot); +int (*pin_set_slot_channel)(struct hdac_device *codec, +hda_nid_t pin_nid,int asp_slot,int channel); };struct hdmi_chmap {
@@ -36,4 +53,32 @@ struct hdmi_chmap {struct hdac_device *hdac; }; +void snd_hdmi_init_channel_allocations (void ); +int snd_hdmi_get_channel_allocation_order (int ca); +int snd_hdmi_get_active_channels (int ca); +struct cea_channel_speaker_allocation *snd_hdmi_get_ch_alloc_from_ca (int ca); +void snd_hdmi_print_channel_allocation (int spk_alloc,char *buf,int buflen); +int snd_hdmi_channel_allocation (struct hdac_device *codec, +int spk_alloc,int channels); +int snd_hdmi_to_spk_mask (unsigned char c); +int snd_hdmi_spk_to_chmap (int spk); +int snd_hdmi_manual_channel_allocation (int chs,unsigned char *map); +void snd_hdmi_setup_channel_mapping (struct hdmi_chmap *chmap, +hda_nid_t pin_nid,bool non_pcm,int ca, +int channels,unsigned char *map, +bool chmap_set); +int snd_hdmi_pin_set_slot_channel (struct hdac_device *codec,hda_nid_t pin_nid, +int asp_slot,int channel); +int snd_hdmi_pin_get_slot_channel (struct hdac_device *codec,hda_nid_t pin_nid, +int asp_slot); +void snd_hdmi_set_channel_count (struct hdac_device *codec, +hda_nid_t cvt_nid,int chs); +int snd_hdmi_chmap_cea_alloc_validate_get_type ( +struct cea_channel_speaker_allocation *cap, +int channels); +void snd_hdmi_cea_alloc_to_tlv_chmap ( +struct cea_channel_speaker_allocation *cap, +unsigned int *chmap,int channels); +int snd_hdmi_add_chmap_ctls (struct snd_pcm *pcm,int pcm_idx, +struct hdmi_chmap *chmap);#endif /* __SOUND_HDMI_CHMAP_H */
sound/hda/Makefile +1 -1
@@ -1,5 +1,5 @@ snd-hda-core-objs := hda_bus_type.o hdac_bus.o hdac_device.o hdac_sysfs.o \ - hdac_regmap.o hdac_controller.o hdac_stream.o array.o + hdac_regmap.o hdac_controller.o hdac_stream.o array.o hdmi_chmap.o snd-hda-core-objs += trace.o CFLAGS_trace.o := -I$(src)
sound/hda/hdmi_chmap.c new file +763 -0
763 lines not on this page · raw message
sound/pci/hda/patch_hdmi.c +0 -10
@@ -102,7 +102,6 @@ struct hdmi_spec_per_pin {#endif }; -struct cea_channel_speaker_allocation ;/* operations used by generic code that can be overridden by patches */ struct hdmi_ops { int (*pin_get_eld)(struct hda_codec *codec, hda_nid_t pin_nid,
@@ -257,15 +256,6 @@ static int eld_speaker_allocation_bits[] = { [10] = FCH, }; -struct cea_channel_speaker_allocation { -int ca_index; -int speakers[8 ]; - -/* derived values, just for convenience */ -int channels; -int spk_mask; -}; -/* * ALSA sequence is: *
Signature · 1 line
1.9.1
Re: [PATCH 2/3] ALSA: hda - Move chmap support helpers/structures to core
Quoted 81 lines · Subhransu S. Prusty
Copy the channel map helpers to core. The exported channel map API names are prefixed with
snd_hdmifor namespace management. Arguments of the helpers are modified to takehdac_deviceobject argument instead ofhda_codecspecific object. With this it can be used by other hdac devices.Next patch removes the local channel map helpers from
patch_hdmi.cand uses these common helpers.Signed-off-by Subhransu S. Prusty <[email protected]>Signed-off-by Vinod Koul <[email protected]>--- include/sound/hdmi_chmap.h | 45 +++ sound/hda/Makefile | 2 +- sound/hda/hdmi_chmap.c | 763 +++++++++++++++++++++++++++++++++++++++++++++ sound/pci/hda/patch_hdmi.c | 10 - 4 files changed, 809 insertions(+), 11 deletions(-) create mode 100644 sound/hda/hdmi_chmap.cinclude/sound/hdmi_chmap.h +35
-0@@ -5,10 +5,22 @@#ifndef __SOUND_HDMI_CHMAP_H#define __SOUND_HDMI_CHMAP_H +#include <sound/pcm.h> #include <sound/hdaudio.h> struct cea_channel_speaker_allocation ; +#define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80 + +struct cea_channel_speaker_allocation { +int ca_index; +int speakers[8 ]; + +/* derived values, just for convenience */ +int channels; +int spk_mask; +}; + struct hdmi_chmap_ops {/* * Helpers for producing the channel map TLVs. These can be overridden @@ -28,6 +40,11 @@ struct hdmi_chmap_ops {void (*set_chmap)(struct hdac_device *hdac,int pcm_idx,unsigned char *chmap,int prepared);bool (*is_monitor_connected)(struct hdac_device *hdac,int pcm_idx); +/* get and set channel assigned to each HDMI ASP (audio sample packet) slot */ +int (*pin_get_slot_channel)(struct hdac_device *codec, +hda_nid_t pin_nid,int asp_slot); +int (*pin_set_slot_channel)(struct hdac_device *codec, +hda_nid_t pin_nid,int asp_slot,int channel); };struct hdmi_chmap {@@ -36,4 +53,32 @@ struct hdmi_chmap {struct hdac_device *hdac; }; +void snd_hdmi_init_channel_allocations (void ); +int snd_hdmi_get_channel_allocation_order (int ca); +int snd_hdmi_get_active_channels (int ca); +struct cea_channel_speaker_allocation *snd_hdmi_get_ch_alloc_from_ca (int ca); +void snd_hdmi_print_channel_allocation (int spk_alloc,char *buf,int buflen); +int snd_hdmi_channel_allocation (struct hdac_device *codec, +int spk_alloc,int channels); +int snd_hdmi_to_spk_mask (unsigned char c); +int snd_hdmi_spk_to_chmap (int spk); +int snd_hdmi_manual_channel_allocation (int chs,unsigned char *map); +void snd_hdmi_setup_channel_mapping (struct hdmi_chmap *chmap, +hda_nid_t pin_nid,bool non_pcm,int ca, +int channels,unsigned char *map, +bool chmap_set); +int snd_hdmi_pin_set_slot_channel (struct hdac_device *codec,hda_nid_t pin_nid, +int asp_slot,int channel); +int snd_hdmi_pin_get_slot_channel (struct hdac_device *codec,hda_nid_t pin_nid, +int asp_slot);
include/sound/hdmi_chmap.h struct hdmi_chmap { · line 83
Quoted 10 lines
include/sound/hdmi_chmap.h +10
-0+void snd_hdmi_set_channel_count (struct hdac_device *codec, +hda_nid_t cvt_nid,int chs); +int snd_hdmi_chmap_cea_alloc_validate_get_type ( +struct cea_channel_speaker_allocation *cap, +int channels); +void snd_hdmi_cea_alloc_to_tlv_chmap ( +struct cea_channel_speaker_allocation *cap, +unsigned int *chmap,int channels); +int snd_hdmi_add_chmap_ctls (struct snd_pcm *pcm,int pcm_idx, +struct hdmi_chmap *chmap);
Do we really need to export all these? Can't be they somehow self-contained?
Takashi
Re: [PATCH 2/3] ALSA: hda - Move chmap support helpers/structures to core
Quoted 25 lines · Takashi Iwai
Quoted 23 lines · Subhransu S. Prusty
include/sound/hdmi_chmap.h +23
-0+void snd_hdmi_init_channel_allocations (void ); +int snd_hdmi_get_channel_allocation_order (int ca); +int snd_hdmi_get_active_channels (int ca); +struct cea_channel_speaker_allocation *snd_hdmi_get_ch_alloc_from_ca (int ca); +void snd_hdmi_print_channel_allocation (int spk_alloc,char *buf,int buflen); +int snd_hdmi_channel_allocation (struct hdac_device *codec, +int spk_alloc,int channels); +int snd_hdmi_to_spk_mask (unsigned char c); +int snd_hdmi_spk_to_chmap (int spk); +int snd_hdmi_manual_channel_allocation (int chs,unsigned char *map); +void snd_hdmi_setup_channel_mapping (struct hdmi_chmap *chmap, +hda_nid_t pin_nid,bool non_pcm,int ca, +int channels,unsigned char *map, +bool chmap_set); +int snd_hdmi_pin_set_slot_channel (struct hdac_device *codec,hda_nid_t pin_nid, +int asp_slot,int channel); +int snd_hdmi_pin_get_slot_channel (struct hdac_device *codec,hda_nid_t pin_nid, +int asp_slot); +void snd_hdmi_set_channel_count (struct hdac_device *codec, +hda_nid_t cvt_nid,int chs); +int snd_hdmi_chmap_cea_alloc_validate_get_type ( +struct cea_channel_speaker_allocation *cap, +int channels);
Quoted 8 lines
include/sound/hdmi_chmap.h struct hdmi_chmap { · line 83
Quoted 5 lines
include/sound/hdmi_chmap.h +5
-0+void snd_hdmi_cea_alloc_to_tlv_chmap ( +struct cea_channel_speaker_allocation *cap, +unsigned int *chmap,int channels); +int snd_hdmi_add_chmap_ctls (struct snd_pcm *pcm,int pcm_idx, +struct hdmi_chmap *chmap);Do we really need to export all these? Can't be they somehow self-contained?
Yes, I think we can do this by using common chmap ops instance and driver can override the specific handlers. Will check for other APIs as well.
Quoted 3 lines
Takashi
PATCH 3/3 ALSA: hda - Use the helpers from HDA core
In reply to Subhransu S. PrustyThis patch removes the local channel map definitions from legacy hda driver and uses the helpers from core.
--- include/sound/hdaudio.h | 1 + sound/pci/hda/hda_eld.c | 31 +- sound/pci/hda/patch_hdmi.c | 731 ++------------------------------------------- 3 files changed, 29 insertions(+), 734 deletions(-)
include/sound/hdaudio.h +1 -0
@@ -22,6 +22,7 @@ struct hdac_device;struct hdac_driver ;struct hdac_widget_tree ;struct hda_device_id ; +struct hdmi_chmap_ops ;/* * exported bus type
sound/pci/hda/hda_eld.c +3 -28
@@ -26,6 +26,7 @@#include <linux/slab.h> #include <sound/core.h> #include <asm/unaligned.h> +#include <sound/hdmi_chmap.h> #include "hda_codec.h" #include "hda_local.h"
@@ -42,20 +43,6 @@ enum cea_edid_versions { CEA_EDID_VER_RESERVED = 4, }; -static const char *const cea_speaker_allocation_names[] = { -/* 0 */ "FL/FR" , -/* 1 */ "LFE" , -/* 2 */ "FC" , -/* 3 */ "RL/RR" , -/* 4 */ "RC" , -/* 5 */ "FLC/FRC" , -/* 6 */ "RLC/RRC" , -/* 7 */ "FLW/FRW" , -/* 8 */ "FLH/FRH" , -/* 9 */ "TC" , -/* 10 */ "FCH" , -}; -static const char *const eld_connection_type_names[4 ] = {"HDMI" ,"DisplayPort" ,
@@ -419,18 +406,6 @@ static void hdmi_show_short_audio_desc(struct hda_codec *codec, a->channels, buf, buf2); } -void snd_print_channel_allocation (int spk_alloc,char *buf,int buflen) -{ -int i, j; - -for (i =0 , j =0 ; i <ARRAY_SIZE (cea_speaker_allocation_names); i++) { -if (spk_alloc & (1 << i)) - j +=snprintf (buf + j, buflen - j," %s" , - cea_speaker_allocation_names[i]); - } - buf[j] ='\0' ;/* necessary when j == 0 */ -} -void snd_hdmi_show_eld (struct hda_codec *codec,struct parsed_hdmi_eld *e) {int i;
@@ -441,7 +416,7 @@ void snd_hdmi_show_eld(struct hda_codec *codec, struct parsed_hdmi_eld *e)if (e->spk_alloc) {char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE ]; -snd_print_channel_allocation (e->spk_alloc, buf,sizeof (buf)); +snd_hdmi_print_channel_allocation (e->spk_alloc, buf,sizeof (buf));codec_dbg (codec,"HDMI: available speakers:%s\n" , buf); }
@@ -516,7 +491,7 @@ void snd_hdmi_print_eld_info(struct hdmi_eld *eld,snd_iprintf (buffer,"support_ai\t\t%d\n" , e->support_ai);snd_iprintf (buffer,"audio_sync_delay\t%d\n" , e->aud_synch_delay); -snd_print_channel_allocation (e->spk_alloc, buf,sizeof (buf)); +snd_hdmi_print_channel_allocation (e->spk_alloc, buf,sizeof (buf));snd_iprintf (buffer,"speakers\t\t[0x%x]%s\n" , e->spk_alloc, buf);snd_iprintf (buffer,"sad_count\t\t%d\n" , e->sad_count);
sound/pci/hda/patch_hdmi.c +25 -706
869 lines not on this page · raw message
Signature · 1 line
1.9.1