| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: hdafg.c,v 1.19 2020/01/18 12:00:33 jmcneill Exp $ */ | | 1 | /* $NetBSD: hdafg.c,v 1.20 2020/01/30 00:21:23 jmcneill Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk> | | 4 | * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk> |
5 | * Copyright (c) 2009-2011 Jared D. McNeill <jmcneill@invisible.ca> | | 5 | * Copyright (c) 2009-2011 Jared D. McNeill <jmcneill@invisible.ca> |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * This code is derived from software contributed to The NetBSD Foundation | | 8 | * This code is derived from software contributed to The NetBSD Foundation |
9 | * by Precedence Technologies Ltd | | 9 | * by Precedence Technologies Ltd |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -50,27 +50,27 @@ | | | @@ -50,27 +50,27 @@ |
50 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 50 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
51 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 51 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
59 | * SUCH DAMAGE. | | 59 | * SUCH DAMAGE. |
60 | */ | | 60 | */ |
61 | | | 61 | |
62 | #include <sys/cdefs.h> | | 62 | #include <sys/cdefs.h> |
63 | __KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.19 2020/01/18 12:00:33 jmcneill Exp $"); | | 63 | __KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.20 2020/01/30 00:21:23 jmcneill Exp $"); |
64 | | | 64 | |
65 | #include <sys/types.h> | | 65 | #include <sys/types.h> |
66 | #include <sys/param.h> | | 66 | #include <sys/param.h> |
67 | #include <sys/systm.h> | | 67 | #include <sys/systm.h> |
68 | #include <sys/kernel.h> | | 68 | #include <sys/kernel.h> |
69 | #include <sys/device.h> | | 69 | #include <sys/device.h> |
70 | #include <sys/conf.h> | | 70 | #include <sys/conf.h> |
71 | #include <sys/bus.h> | | 71 | #include <sys/bus.h> |
72 | #include <sys/kmem.h> | | 72 | #include <sys/kmem.h> |
73 | #include <sys/module.h> | | 73 | #include <sys/module.h> |
74 | | | 74 | |
75 | #include <sys/audioio.h> | | 75 | #include <sys/audioio.h> |
76 | #include <dev/audio/audio_if.h> | | 76 | #include <dev/audio/audio_if.h> |
| @@ -879,51 +879,53 @@ hdafg_assoc_dump_dd(struct hdafg_softc * | | | @@ -879,51 +879,53 @@ hdafg_assoc_dump_dd(struct hdafg_softc * |
879 | #endif | | 879 | #endif |
880 | break; | | 880 | break; |
881 | } | | 881 | } |
882 | elddata[i] = COP_ELD_DATA(res); | | 882 | elddata[i] = COP_ELD_DATA(res); |
883 | } | | 883 | } |
884 | | | 884 | |
885 | if (hdafg_dd_parse_info(elddata, elddatalen, &hdi) != 0) { | | 885 | if (hdafg_dd_parse_info(elddata, elddatalen, &hdi) != 0) { |
886 | #ifdef HDAFG_HDMI_DEBUG | | 886 | #ifdef HDAFG_HDMI_DEBUG |
887 | hda_error(sc, "failed to parse ELD data\n"); | | 887 | hda_error(sc, "failed to parse ELD data\n"); |
888 | #endif | | 888 | #endif |
889 | return; | | 889 | return; |
890 | } | | 890 | } |
891 | | | 891 | |
| | | 892 | #ifdef HDAFG_HDMI_DEBUG |
892 | hda_print(sc, " ELD version=0x%x", ELD_VER(&hdi.eld)); | | 893 | hda_print(sc, " ELD version=0x%x", ELD_VER(&hdi.eld)); |
893 | hda_print1(sc, ",len=%u", hdi.eld.header.baseline_eld_len * 4); | | 894 | hda_print1(sc, ",len=%u", hdi.eld.header.baseline_eld_len * 4); |
894 | hda_print1(sc, ",edid=0x%x", ELD_CEA_EDID_VER(&hdi.eld)); | | 895 | hda_print1(sc, ",edid=0x%x", ELD_CEA_EDID_VER(&hdi.eld)); |
895 | hda_print1(sc, ",port=0x%" PRIx64, hdi.eld.port_id); | | 896 | hda_print1(sc, ",port=0x%" PRIx64, hdi.eld.port_id); |
896 | hda_print1(sc, ",vendor=0x%04x", hdi.eld.vendor); | | 897 | hda_print1(sc, ",vendor=0x%04x", hdi.eld.vendor); |
897 | hda_print1(sc, ",product=0x%04x", hdi.eld.product); | | 898 | hda_print1(sc, ",product=0x%04x", hdi.eld.product); |
898 | hda_print1(sc, "\n"); | | 899 | hda_print1(sc, "\n"); |
899 | hda_print(sc, " Monitor = '%s'\n", hdi.monitor); | | 900 | hda_print(sc, " Monitor = '%s'\n", hdi.monitor); |
900 | for (i = 0; i < hdi.nsad; i++) { | | 901 | for (i = 0; i < hdi.nsad; i++) { |
901 | hda_print(sc, " SAD id=%u", i); | | 902 | hda_print(sc, " SAD id=%u", i); |
902 | hda_print1(sc, ",format=%u", | | 903 | hda_print1(sc, ",format=%u", |
903 | CEA_AUDIO_FORMAT(&hdi.sad[i])); | | 904 | CEA_AUDIO_FORMAT(&hdi.sad[i])); |
904 | hda_print1(sc, ",channels=%u", | | 905 | hda_print1(sc, ",channels=%u", |
905 | CEA_MAX_CHANNELS(&hdi.sad[i])); | | 906 | CEA_MAX_CHANNELS(&hdi.sad[i])); |
906 | hda_print1(sc, ",rate=0x%02x", | | 907 | hda_print1(sc, ",rate=0x%02x", |
907 | CEA_SAMPLE_RATE(&hdi.sad[i])); | | 908 | CEA_SAMPLE_RATE(&hdi.sad[i])); |
908 | if (CEA_AUDIO_FORMAT(&hdi.sad[i]) == | | 909 | if (CEA_AUDIO_FORMAT(&hdi.sad[i]) == |
909 | CEA_AUDIO_FORMAT_LPCM) | | 910 | CEA_AUDIO_FORMAT_LPCM) |
910 | hda_print1(sc, ",precision=0x%x", | | 911 | hda_print1(sc, ",precision=0x%x", |
911 | CEA_PRECISION(&hdi.sad[i])); | | 912 | CEA_PRECISION(&hdi.sad[i])); |
912 | else | | 913 | else |
913 | hda_print1(sc, ",maxbitrate=%u", | | 914 | hda_print1(sc, ",maxbitrate=%u", |
914 | CEA_MAX_BITRATE(&hdi.sad[i])); | | 915 | CEA_MAX_BITRATE(&hdi.sad[i])); |
915 | hda_print1(sc, "\n"); | | 916 | hda_print1(sc, "\n"); |
916 | } | | 917 | } |
| | | 918 | #endif |
917 | } | | 919 | } |
918 | } | | 920 | } |
919 | | | 921 | |
920 | static char * | | 922 | static char * |
921 | hdafg_mixer_mask2allname(uint32_t mask, char *buf, size_t len) | | 923 | hdafg_mixer_mask2allname(uint32_t mask, char *buf, size_t len) |
922 | { | | 924 | { |
923 | static const char *audioname[] = HDAUDIO_DEVICE_NAMES; | | 925 | static const char *audioname[] = HDAUDIO_DEVICE_NAMES; |
924 | int i, first = 1; | | 926 | int i, first = 1; |
925 | | | 927 | |
926 | memset(buf, 0, len); | | 928 | memset(buf, 0, len); |
927 | for (i = 0; i < HDAUDIO_MIXER_NRDEVICES; i++) { | | 929 | for (i = 0; i < HDAUDIO_MIXER_NRDEVICES; i++) { |
928 | if (mask & (1 << i)) { | | 930 | if (mask & (1 << i)) { |
929 | if (first == 0) | | 931 | if (first == 0) |