diff options
author | Adrian Knoth <adi@drcomp.erfurt.thur.de> | 2013-07-05 05:28:04 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-07-05 08:51:21 -0400 |
commit | 5760107c8263cf518968ece65453b7d9b8ca3d0a (patch) | |
tree | ef5303ce286a43a4592ee31f6de49fcbca74babd /sound/pci/rme9652 | |
parent | 1cb7dbf489f9985b7a117e34d00f20799adb138a (diff) |
ALSA: hdspm - Create TCO readout function
This patch separates the TCO bits from snd_hdspm_proc_read_madi(), so
the new function can later be shared between MADI and AES32 cards.
It's essentially only moving code around, no new functionality.
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/rme9652')
-rw-r--r-- | sound/pci/rme9652/hdspm.c | 137 |
1 files changed, 77 insertions, 60 deletions
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 06e69de0801e..58b21048c2e8 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -4636,77 +4636,22 @@ static int snd_hdspm_create_controls(struct snd_card *card, | |||
4636 | ------------------------------------------------------------*/ | 4636 | ------------------------------------------------------------*/ |
4637 | 4637 | ||
4638 | static void | 4638 | static void |
4639 | snd_hdspm_proc_read_madi(struct snd_info_entry * entry, | 4639 | snd_hdspm_proc_read_tco(struct snd_info_entry *entry, |
4640 | struct snd_info_buffer *buffer) | 4640 | struct snd_info_buffer *buffer) |
4641 | { | 4641 | { |
4642 | struct hdspm *hdspm = entry->private_data; | 4642 | struct hdspm *hdspm = entry->private_data; |
4643 | unsigned int status, status2, control, freq; | 4643 | unsigned int status, control; |
4644 | |||
4645 | char *pref_sync_ref; | ||
4646 | char *autosync_ref; | ||
4647 | char *system_clock_mode; | ||
4648 | char *insel; | ||
4649 | int x, x2; | ||
4650 | |||
4651 | /* TCO stuff */ | ||
4652 | int a, ltc, frames, seconds, minutes, hours; | 4644 | int a, ltc, frames, seconds, minutes, hours; |
4653 | unsigned int period; | 4645 | unsigned int period; |
4654 | u64 freq_const = 0; | 4646 | u64 freq_const = 0; |
4655 | u32 rate; | 4647 | u32 rate; |
4656 | 4648 | ||
4649 | snd_iprintf(buffer, "--- TCO ---\n"); | ||
4650 | |||
4657 | status = hdspm_read(hdspm, HDSPM_statusRegister); | 4651 | status = hdspm_read(hdspm, HDSPM_statusRegister); |
4658 | status2 = hdspm_read(hdspm, HDSPM_statusRegister2); | ||
4659 | control = hdspm->control_register; | 4652 | control = hdspm->control_register; |
4660 | freq = hdspm_read(hdspm, HDSPM_timecodeRegister); | ||
4661 | |||
4662 | snd_iprintf(buffer, "%s (Card #%d) Rev.%x Status2first3bits: %x\n", | ||
4663 | hdspm->card_name, hdspm->card->number + 1, | ||
4664 | hdspm->firmware_rev, | ||
4665 | (status2 & HDSPM_version0) | | ||
4666 | (status2 & HDSPM_version1) | (status2 & | ||
4667 | HDSPM_version2)); | ||
4668 | |||
4669 | snd_iprintf(buffer, "HW Serial: 0x%06x%06x\n", | ||
4670 | (hdspm_read(hdspm, HDSPM_midiStatusIn1)>>8) & 0xFFFFFF, | ||
4671 | hdspm->serial); | ||
4672 | |||
4673 | snd_iprintf(buffer, "IRQ: %d Registers bus: 0x%lx VM: 0x%lx\n", | ||
4674 | hdspm->irq, hdspm->port, (unsigned long)hdspm->iobase); | ||
4675 | |||
4676 | snd_iprintf(buffer, "--- System ---\n"); | ||
4677 | 4653 | ||
4678 | snd_iprintf(buffer, | ||
4679 | "IRQ Pending: Audio=%d, MIDI0=%d, MIDI1=%d, IRQcount=%d\n", | ||
4680 | status & HDSPM_audioIRQPending, | ||
4681 | (status & HDSPM_midi0IRQPending) ? 1 : 0, | ||
4682 | (status & HDSPM_midi1IRQPending) ? 1 : 0, | ||
4683 | hdspm->irq_count); | ||
4684 | snd_iprintf(buffer, | ||
4685 | "HW pointer: id = %d, rawptr = %d (%d->%d) " | ||
4686 | "estimated= %ld (bytes)\n", | ||
4687 | ((status & HDSPM_BufferID) ? 1 : 0), | ||
4688 | (status & HDSPM_BufferPositionMask), | ||
4689 | (status & HDSPM_BufferPositionMask) % | ||
4690 | (2 * (int)hdspm->period_bytes), | ||
4691 | ((status & HDSPM_BufferPositionMask) - 64) % | ||
4692 | (2 * (int)hdspm->period_bytes), | ||
4693 | (long) hdspm_hw_pointer(hdspm) * 4); | ||
4694 | 4654 | ||
4695 | snd_iprintf(buffer, | ||
4696 | "MIDI FIFO: Out1=0x%x, Out2=0x%x, In1=0x%x, In2=0x%x \n", | ||
4697 | hdspm_read(hdspm, HDSPM_midiStatusOut0) & 0xFF, | ||
4698 | hdspm_read(hdspm, HDSPM_midiStatusOut1) & 0xFF, | ||
4699 | hdspm_read(hdspm, HDSPM_midiStatusIn0) & 0xFF, | ||
4700 | hdspm_read(hdspm, HDSPM_midiStatusIn1) & 0xFF); | ||
4701 | snd_iprintf(buffer, | ||
4702 | "MIDIoverMADI FIFO: In=0x%x, Out=0x%x \n", | ||
4703 | hdspm_read(hdspm, HDSPM_midiStatusIn2) & 0xFF, | ||
4704 | hdspm_read(hdspm, HDSPM_midiStatusOut2) & 0xFF); | ||
4705 | snd_iprintf(buffer, | ||
4706 | "Register: ctrl1=0x%x, ctrl2=0x%x, status1=0x%x, " | ||
4707 | "status2=0x%x\n", | ||
4708 | hdspm->control_register, hdspm->control2_register, | ||
4709 | status, status2); | ||
4710 | if (status & HDSPM_tco_detect) { | 4655 | if (status & HDSPM_tco_detect) { |
4711 | snd_iprintf(buffer, "TCO module detected.\n"); | 4656 | snd_iprintf(buffer, "TCO module detected.\n"); |
4712 | a = hdspm_read(hdspm, HDSPM_RD_TCO+4); | 4657 | a = hdspm_read(hdspm, HDSPM_RD_TCO+4); |
@@ -4800,6 +4745,75 @@ snd_hdspm_proc_read_madi(struct snd_info_entry * entry, | |||
4800 | } else { | 4745 | } else { |
4801 | snd_iprintf(buffer, "No TCO module detected.\n"); | 4746 | snd_iprintf(buffer, "No TCO module detected.\n"); |
4802 | } | 4747 | } |
4748 | } | ||
4749 | |||
4750 | static void | ||
4751 | snd_hdspm_proc_read_madi(struct snd_info_entry *entry, | ||
4752 | struct snd_info_buffer *buffer) | ||
4753 | { | ||
4754 | struct hdspm *hdspm = entry->private_data; | ||
4755 | unsigned int status, status2, control, freq; | ||
4756 | |||
4757 | char *pref_sync_ref; | ||
4758 | char *autosync_ref; | ||
4759 | char *system_clock_mode; | ||
4760 | char *insel; | ||
4761 | int x, x2; | ||
4762 | |||
4763 | status = hdspm_read(hdspm, HDSPM_statusRegister); | ||
4764 | status2 = hdspm_read(hdspm, HDSPM_statusRegister2); | ||
4765 | control = hdspm->control_register; | ||
4766 | freq = hdspm_read(hdspm, HDSPM_timecodeRegister); | ||
4767 | |||
4768 | snd_iprintf(buffer, "%s (Card #%d) Rev.%x Status2first3bits: %x\n", | ||
4769 | hdspm->card_name, hdspm->card->number + 1, | ||
4770 | hdspm->firmware_rev, | ||
4771 | (status2 & HDSPM_version0) | | ||
4772 | (status2 & HDSPM_version1) | (status2 & | ||
4773 | HDSPM_version2)); | ||
4774 | |||
4775 | snd_iprintf(buffer, "HW Serial: 0x%06x%06x\n", | ||
4776 | (hdspm_read(hdspm, HDSPM_midiStatusIn1)>>8) & 0xFFFFFF, | ||
4777 | hdspm->serial); | ||
4778 | |||
4779 | snd_iprintf(buffer, "IRQ: %d Registers bus: 0x%lx VM: 0x%lx\n", | ||
4780 | hdspm->irq, hdspm->port, (unsigned long)hdspm->iobase); | ||
4781 | |||
4782 | snd_iprintf(buffer, "--- System ---\n"); | ||
4783 | |||
4784 | snd_iprintf(buffer, | ||
4785 | "IRQ Pending: Audio=%d, MIDI0=%d, MIDI1=%d, IRQcount=%d\n", | ||
4786 | status & HDSPM_audioIRQPending, | ||
4787 | (status & HDSPM_midi0IRQPending) ? 1 : 0, | ||
4788 | (status & HDSPM_midi1IRQPending) ? 1 : 0, | ||
4789 | hdspm->irq_count); | ||
4790 | snd_iprintf(buffer, | ||
4791 | "HW pointer: id = %d, rawptr = %d (%d->%d) " | ||
4792 | "estimated= %ld (bytes)\n", | ||
4793 | ((status & HDSPM_BufferID) ? 1 : 0), | ||
4794 | (status & HDSPM_BufferPositionMask), | ||
4795 | (status & HDSPM_BufferPositionMask) % | ||
4796 | (2 * (int)hdspm->period_bytes), | ||
4797 | ((status & HDSPM_BufferPositionMask) - 64) % | ||
4798 | (2 * (int)hdspm->period_bytes), | ||
4799 | (long) hdspm_hw_pointer(hdspm) * 4); | ||
4800 | |||
4801 | snd_iprintf(buffer, | ||
4802 | "MIDI FIFO: Out1=0x%x, Out2=0x%x, In1=0x%x, In2=0x%x \n", | ||
4803 | hdspm_read(hdspm, HDSPM_midiStatusOut0) & 0xFF, | ||
4804 | hdspm_read(hdspm, HDSPM_midiStatusOut1) & 0xFF, | ||
4805 | hdspm_read(hdspm, HDSPM_midiStatusIn0) & 0xFF, | ||
4806 | hdspm_read(hdspm, HDSPM_midiStatusIn1) & 0xFF); | ||
4807 | snd_iprintf(buffer, | ||
4808 | "MIDIoverMADI FIFO: In=0x%x, Out=0x%x \n", | ||
4809 | hdspm_read(hdspm, HDSPM_midiStatusIn2) & 0xFF, | ||
4810 | hdspm_read(hdspm, HDSPM_midiStatusOut2) & 0xFF); | ||
4811 | snd_iprintf(buffer, | ||
4812 | "Register: ctrl1=0x%x, ctrl2=0x%x, status1=0x%x, " | ||
4813 | "status2=0x%x\n", | ||
4814 | hdspm->control_register, hdspm->control2_register, | ||
4815 | status, status2); | ||
4816 | |||
4803 | 4817 | ||
4804 | snd_iprintf(buffer, "--- Settings ---\n"); | 4818 | snd_iprintf(buffer, "--- Settings ---\n"); |
4805 | 4819 | ||
@@ -4903,6 +4917,9 @@ snd_hdspm_proc_read_madi(struct snd_info_entry * entry, | |||
4903 | (status & HDSPM_RX_64ch) ? "64 channels" : | 4917 | (status & HDSPM_RX_64ch) ? "64 channels" : |
4904 | "56 channels"); | 4918 | "56 channels"); |
4905 | 4919 | ||
4920 | /* call readout function for TCO specific status */ | ||
4921 | snd_hdspm_proc_read_tco(entry, buffer); | ||
4922 | |||
4906 | snd_iprintf(buffer, "\n"); | 4923 | snd_iprintf(buffer, "\n"); |
4907 | } | 4924 | } |
4908 | 4925 | ||