Lines 313-318
Link Here
|
313 |
uint8_t mute_id; |
313 |
uint8_t mute_id; |
314 |
}; |
314 |
}; |
315 |
|
315 |
|
|
|
316 |
#define UAUDIO_SPDIF_OUT 0x01 /* Enable SPDIF output */ |
317 |
#define UAUDIO_SPDIF_OUT_48K 0x02 /* Out sample rate = 48K */ |
318 |
#define UAUDIO_SPDIF_OUT_96K 0x04 /* Out sample rate = 96K */ |
319 |
#define UAUDIO_SPDIF_IN_MIX 0x10 /* Input mix enable */ |
320 |
|
316 |
struct uaudio_softc { |
321 |
struct uaudio_softc { |
317 |
struct sbuf sc_sndstat; |
322 |
struct sbuf sc_sndstat; |
318 |
struct sndcard_func sc_sndcard_func; |
323 |
struct sndcard_func sc_sndcard_func; |
Lines 349-354
Link Here
|
349 |
uint8_t sc_uq_bad_adc:1; |
354 |
uint8_t sc_uq_bad_adc:1; |
350 |
uint8_t sc_uq_au_vendor_class:1; |
355 |
uint8_t sc_uq_au_vendor_class:1; |
351 |
uint8_t sc_pcm_bitperfect:1; |
356 |
uint8_t sc_pcm_bitperfect:1; |
|
|
357 |
|
358 |
int (*sc_set_spdif_fn)(struct uaudio_softc *, int); |
352 |
}; |
359 |
}; |
353 |
|
360 |
|
354 |
struct uaudio_terminal_node { |
361 |
struct uaudio_terminal_node { |
Lines 861-866
Link Here
|
861 |
return (ENXIO); |
868 |
return (ENXIO); |
862 |
} |
869 |
} |
863 |
|
870 |
|
|
|
871 |
/* |
872 |
* Set Cmedia CM6206 S/PDIF settings |
873 |
* Source: CM6206 Datasheet v2.3. |
874 |
*/ |
875 |
static int |
876 |
uaudio_set_spdif_cm6206(struct uaudio_softc *sc, int flags) |
877 |
{ |
878 |
u_int8_t cmd[2][4] = { |
879 |
{ 0x20, 0x20,0x00, 0 }, |
880 |
{ 0x20, 0x30,0x02, 1 } |
881 |
}; |
882 |
int i; |
883 |
|
884 |
if (flags & UAUDIO_SPDIF_OUT) { |
885 |
cmd[1][1] = 0x00; |
886 |
} else { |
887 |
cmd[1][1] = 0x02; |
888 |
} |
889 |
if (flags & UAUDIO_SPDIF_OUT_96K) |
890 |
cmd[0][1] = 0x60; /* 96K: 3'b110 */ |
891 |
if (flags & UAUDIO_SPDIF_IN_MIX) |
892 |
cmd[1][1] = 0x03; /* SPDIFMIX */ |
893 |
|
894 |
for (i = 0; i < 2; i++) { |
895 |
if (usbd_req_set_report(sc->sc_udev, NULL, |
896 |
cmd[i], sizeof(cmd[i]), |
897 |
sc->sc_mixer_iface_index, UHID_OUTPUT_REPORT, 0) != 0) { |
898 |
return (-1); |
899 |
} |
900 |
} |
901 |
return (0); |
902 |
} |
903 |
|
904 |
|
864 |
static int |
905 |
static int |
865 |
uaudio_attach(device_t dev) |
906 |
uaudio_attach(device_t dev) |
866 |
{ |
907 |
{ |
Lines 1031-1036
Link Here
|
1031 |
/* reload all mixer settings */ |
1072 |
/* reload all mixer settings */ |
1032 |
uaudio_mixer_reload_all(sc); |
1073 |
uaudio_mixer_reload_all(sc); |
1033 |
|
1074 |
|
|
|
1075 |
/* Enable SPDIF output */ |
1076 |
if (uaa->info.idVendor == USB_VENDOR_CMEDIA && |
1077 |
(uaa->info.idProduct == USB_PRODUCT_CMEDIA_CM6206)) { |
1078 |
device_printf(dev, "C-Media CM6206\n"); |
1079 |
sc->sc_set_spdif_fn = uaudio_set_spdif_cm6206; |
1080 |
if (sc->sc_set_spdif_fn(sc, |
1081 |
UAUDIO_SPDIF_OUT|UAUDIO_SPDIF_OUT_48K) != 0) |
1082 |
device_printf(dev, "Failed to enable S/PDIF at 48K\n"); |
1083 |
} else { |
1084 |
sc->sc_set_spdif_fn = NULL; |
1085 |
} |
1086 |
|
1034 |
return (0); /* success */ |
1087 |
return (0); /* success */ |
1035 |
|
1088 |
|
1036 |
detach: |
1089 |
detach: |
Lines 1115-1120
Link Here
|
1115 |
struct uaudio_softc *sc = device_get_softc(device_get_parent(dev)); |
1168 |
struct uaudio_softc *sc = device_get_softc(device_get_parent(dev)); |
1116 |
int error = 0; |
1169 |
int error = 0; |
1117 |
|
1170 |
|
|
|
1171 |
if (sc->sc_set_spdif_fn != NULL) |
1172 |
sc->sc_set_spdif_fn(sc, 0); |
1118 |
repeat: |
1173 |
repeat: |
1119 |
if (sc->sc_pcm_registered) { |
1174 |
if (sc->sc_pcm_registered) { |
1120 |
error = pcm_unregister(dev); |
1175 |
error = pcm_unregister(dev); |