From: Takashi Iwai Subject: Re: [PATCH 2/3] ALSA: hda - Move chmap support helpers/structures to core Date: Mon, 22 Feb 2016 10:44:57 +0100 Message-ID: References: <1456128040-12141-1-git-send-email-subhransu.s.prusty@intel.com> <1456128040-12141-3-git-send-email-subhransu.s.prusty@intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 78BC426047F for ; Mon, 22 Feb 2016 10:44:57 +0100 (CET) In-Reply-To: <1456128040-12141-3-git-send-email-subhransu.s.prusty@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: "Subhransu S. Prusty" Cc: patches.audio@intel.com, Vinod Koul , alsa-devel@alsa-project.org, broonie@kernel.org, lgirdwood@gmail.com List-Id: alsa-devel@alsa-project.org On Mon, 22 Feb 2016 09:00:39 +0100, Subhransu S. Prusty wrote: > > Copy 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. > > Signed-off-by: Subhransu S. Prusty > Signed-off-by: Vinod Koul > --- > 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 > > diff --git a/include/sound/hdmi_chmap.h b/include/sound/hdmi_chmap.h > index e5ea02a..8e9ddb1 100644 > --- a/include/sound/hdmi_chmap.h > +++ b/include/sound/hdmi_chmap.h > @@ -5,10 +5,22 @@ > #ifndef __SOUND_HDMI_CHMAP_H > #define __SOUND_HDMI_CHMAP_H > > +#include > #include > > 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); Do we really need to export all these? Can't be they somehow self-contained? Takashi