diff mbox series

[9/9] ALSA: emu10k1: actually show some S/PDIF status in /proc for E-MU cards

Message ID 20230612191325.1315854-10-oswald.buddenhagen@gmx.de
State Accepted
Commit 58cc6133cc27496c1f041f302e13c33f0867be8a
Headers show
Series ALSA: emu10k1: improvements related to the switchable word clock of E-MU cards | expand

Commit Message

Oswald Buddenhagen June 12, 2023, 7:13 p.m. UTC
The file is called spdif-in, but we abused it to show only sample rates
from various sources. Rectify it as far as possible (the FPGA doesn't
give us a lot of information).

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

---

FIXME: the polarity of "no copy" isn't clear - it could mean either "no
copyright asserted" or "no copies permitted". my attempts to test it
with an 0404b fed by an intel hda board went nowhere - the bit is never
set regardless of what i poke into the hda codec, and i don't know
whether the source or the card is to blame.
---
 sound/pci/emu10k1/emuproc.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c
index 993b35362499..7e2cc532471f 100644
--- a/sound/pci/emu10k1/emuproc.c
+++ b/sound/pci/emu10k1/emuproc.c
@@ -194,6 +194,14 @@  static void snd_emu10k1_proc_spdif_read(struct snd_info_entry *entry,
 		    emu->card_capabilities->emu_model == EMU_MODEL_EMU1010)
 			snd_iprintf(buffer, "BNC rate: %dHz\n",
 				    snd_emu1010_get_raw_rate(emu, EMU_HANA_WCLOCK_SYNC_BNC));
+
+		snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &value);
+		if (value & EMU_HANA_SPDIF_MODE_RX_INVALID)
+			snd_iprintf(buffer, "\nS/PDIF input invalid\n");
+		else
+			snd_iprintf(buffer, "\nS/PDIF mode: %s%s\n",
+				    value & EMU_HANA_SPDIF_MODE_RX_PRO ? "professional" : "consumer",
+				    value & EMU_HANA_SPDIF_MODE_RX_NOCOPY ? ", no copy" : "");
 	} else {
 		snd_emu10k1_proc_spdif_status(emu, buffer, "CD-ROM S/PDIF In", CDCS, CDSRCS);
 		snd_emu10k1_proc_spdif_status(emu, buffer, "Optical or Coax S/PDIF In", GPSCS, GPSRCS);