diff options
author | Takashi Iwai <tiwai@suse.de> | 2016-03-15 15:38:42 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-03-15 16:12:03 +0100 |
commit | 855eadf304b7492d0a6db4cbfa1ad74efc05644e (patch) | |
tree | 663680d4bf16672af5d26807415a96f2c6791260 | |
parent | d213a4adb1bc2a8193dd28cc718bf3071dafd7ab (diff) | |
download | hda-emu-855eadf304b7492d0a6db4cbfa1ad74efc05644e.tar.gz |
Add the build stub for hdmi_chmap.c
The recent restructuring of HDMI chmap helper requires the workarounds
in hda-emu side, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | include/sound/hda_chmap.h | 76 | ||||
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | lib/hdmi_chmap.c | 6 |
4 files changed, 91 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 07f7917..f9439ce 100644 --- a/configure.ac +++ b/configure.ac @@ -617,4 +617,12 @@ if test "$NEW_JACK_API" = "1"; then AC_DEFINE(NEW_JACK_API) fi +AC_MSG_CHECKING(for HDMI chmap helper) +if test -f dist/sound/hda/hdmi_chmap.c; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_HDMI_CHMAP) +else + AC_MSG_RESULT(no) +fi + AC_OUTPUT(Makefile lib/Makefile kernel/Makefile include/Makefile) diff --git a/include/sound/hda_chmap.h b/include/sound/hda_chmap.h new file mode 100644 index 0000000..e20d219 --- /dev/null +++ b/include/sound/hda_chmap.h @@ -0,0 +1,76 @@ +/* + * For multichannel support + */ + +#ifndef __SOUND_HDA_CHMAP_H +#define __SOUND_HDA_CHMAP_H + +#include <sound/pcm.h> +#include <sound/hdaudio.h> + + +#define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80 + +struct hdac_cea_channel_speaker_allocation { + int ca_index; + int speakers[8]; + + /* derived values, just for convenience */ + int channels; + int spk_mask; +}; +struct hdac_chmap; + +struct hdac_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 hdac_chmap *chmap, + struct hdac_cea_channel_speaker_allocation *cap, int channels); + void (*cea_alloc_to_tlv_chmap)(struct hdac_chmap *hchmap, + struct hdac_cea_channel_speaker_allocation *cap, + unsigned int *chmap, int channels); + + /* check that the user-given chmap is supported */ + int (*chmap_validate)(struct hdac_chmap *hchmap, 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_pcm_attached)(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); + void (*set_channel_count)(struct hdac_device *codec, + hda_nid_t cvt_nid, int chs); +}; + +struct hdac_chmap { + unsigned int channels_max; /* max over all cvts */ + struct hdac_chmap_ops ops; + struct hdac_device *hdac; +}; + +void snd_hdac_register_chmap_ops(struct hdac_device *hdac, + struct hdac_chmap *chmap); +int snd_hdac_channel_allocation(struct hdac_device *hdac, int spk_alloc, + int channels, bool chmap_set, + bool non_pcm, unsigned char *map); +int snd_hdac_get_active_channels(int ca); +void snd_hdac_setup_channel_mapping(struct hdac_chmap *chmap, + hda_nid_t pin_nid, bool non_pcm, int ca, + int channels, unsigned char *map, + bool chmap_set); +void snd_hdac_print_channel_allocation(int spk_alloc, char *buf, int buflen); +struct hdac_cea_channel_speaker_allocation *snd_hdac_get_ch_alloc_from_ca(int ca); +int snd_hdac_chmap_to_spk_mask(unsigned char c); +int snd_hdac_spk_to_chmap(int spk); +int snd_hdac_add_chmap_ctls(struct snd_pcm *pcm, int pcm_idx, + struct hdac_chmap *chmap); +#endif /* __SOUND_HDA_CHMAP_H */ diff --git a/lib/Makefile.am b/lib/Makefile.am index 4ec9ad0..4719eaa 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,4 +1,4 @@ noinst_LIBRARIES = libhdacore.a libhdacore_a_SOURCES = hda_bus_type.c hdac_bus.c hdac_device.c hdac_sysfs.c \ - hdac_regmap.c array.c hdac_stream.c + hdac_regmap.c array.c hdac_stream.c hdmi_chmap.c INCLUDES = -I$(top_srcdir)/include diff --git a/lib/hdmi_chmap.c b/lib/hdmi_chmap.c new file mode 100644 index 0000000..bca5fc9 --- /dev/null +++ b/lib/hdmi_chmap.c @@ -0,0 +1,6 @@ +#ifdef NEW_HDA_INFRA +#ifdef HAVE_HDMI_CHMAP +#include <sound/core.h> +#include "../dist/sound/hda/hdmi_chmap.c" +#endif +#endif |