aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2011-01-27 07:03:15 -0500
committerTakashi Iwai <tiwai@suse.de>2011-01-27 07:10:33 -0500
commit730a5865152be843eea5fe87e2b309623c730435 (patch)
tree08cd8ff659de6e05974b9090313ed513d537c498 /sound
parent55a57606b26665870f2993dc53a43daad157dbcd (diff)
ALSA: hdspm - remove unused arrays, reduce stack usage in hwdep_ioctl
Signed-off-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/rme9652/hdspm.c55
1 files changed, 15 insertions, 40 deletions
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 28a1eb3f4d02..6de88b0ce9f4 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -575,12 +575,6 @@ static char *texts_freq[] = {
575 "192 kHz" 575 "192 kHz"
576}; 576};
577 577
578static char *texts_sync_status[] = {
579 "no lock",
580 "lock",
581 "sync"
582};
583
584static char *texts_ports_madi[] = { 578static char *texts_ports_madi[] = {
585 "MADI.1", "MADI.2", "MADI.3", "MADI.4", "MADI.5", "MADI.6", 579 "MADI.1", "MADI.2", "MADI.3", "MADI.4", "MADI.5", "MADI.6",
586 "MADI.7", "MADI.8", "MADI.9", "MADI.10", "MADI.11", "MADI.12", 580 "MADI.7", "MADI.8", "MADI.9", "MADI.10", "MADI.11", "MADI.12",
@@ -692,28 +686,6 @@ static char channel_map_unity_ss[HDSPM_MAX_CHANNELS] = {
692 56, 57, 58, 59, 60, 61, 62, 63 686 56, 57, 58, 59, 60, 61, 62, 63
693}; 687};
694 688
695static char channel_map_unity_ds[HDSPM_MAX_CHANNELS] = {
696 0, 2, 4, 6, 8, 10, 12, 14,
697 16, 18, 20, 22, 24, 26, 28, 30,
698 32, 34, 36, 38, 40, 42, 44, 46,
699 48, 50, 52, 54, 56, 58, 60, 62,
700 -1, -1, -1, -1, -1, -1, -1, -1,
701 -1, -1, -1, -1, -1, -1, -1, -1,
702 -1, -1, -1, -1, -1, -1, -1, -1,
703 -1, -1, -1, -1, -1, -1, -1, -1,
704};
705
706static char channel_map_unity_qs[HDSPM_MAX_CHANNELS] = {
707 0, 4, 8, 12, 16, 20, 24, 28,
708 32, 36, 40, 44, 48, 52, 56, 60,
709 -1, -1, -1, -1, -1, -1, -1, -1,
710 -1, -1, -1, -1, -1, -1, -1, -1,
711 -1, -1, -1, -1, -1, -1, -1, -1,
712 -1, -1, -1, -1, -1, -1, -1, -1,
713 -1, -1, -1, -1, -1, -1, -1, -1,
714 -1, -1, -1, -1, -1, -1, -1, -1,
715};
716
717static char channel_map_raydat_ss[HDSPM_MAX_CHANNELS] = { 689static char channel_map_raydat_ss[HDSPM_MAX_CHANNELS] = {
718 4, 5, 6, 7, 8, 9, 10, 11, /* ADAT 1 */ 690 4, 5, 6, 7, 8, 9, 10, 11, /* ADAT 1 */
719 12, 13, 14, 15, 16, 17, 18, 19, /* ADAT 2 */ 691 12, 13, 14, 15, 16, 17, 18, 19, /* ADAT 2 */
@@ -952,6 +924,8 @@ struct hdspm {
952 int texts_autosync_items; 924 int texts_autosync_items;
953 925
954 cycles_t last_interrupt; 926 cycles_t last_interrupt;
927
928 struct hdspm_peak_rms peak_rms;
955}; 929};
956 930
957 931
@@ -5952,7 +5926,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
5952 struct hdspm_config info; 5926 struct hdspm_config info;
5953 struct hdspm_status status; 5927 struct hdspm_status status;
5954 struct hdspm_version hdspm_version; 5928 struct hdspm_version hdspm_version;
5955 struct hdspm_peak_rms levels; 5929 struct hdspm_peak_rms *levels;
5956 struct hdspm_ltc ltc; 5930 struct hdspm_ltc ltc;
5957 unsigned int statusregister; 5931 unsigned int statusregister;
5958 long unsigned int s; 5932 long unsigned int s;
@@ -5961,28 +5935,29 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
5961 switch (cmd) { 5935 switch (cmd) {
5962 5936
5963 case SNDRV_HDSPM_IOCTL_GET_PEAK_RMS: 5937 case SNDRV_HDSPM_IOCTL_GET_PEAK_RMS:
5938 levels = &hdspm->peak_rms;
5964 for (i = 0; i < HDSPM_MAX_CHANNELS; i++) { 5939 for (i = 0; i < HDSPM_MAX_CHANNELS; i++) {
5965 levels.input_peaks[i] = 5940 levels->input_peaks[i] =
5966 readl(hdspm->iobase + 5941 readl(hdspm->iobase +
5967 HDSPM_MADI_INPUT_PEAK + i*4); 5942 HDSPM_MADI_INPUT_PEAK + i*4);
5968 levels.playback_peaks[i] = 5943 levels->playback_peaks[i] =
5969 readl(hdspm->iobase + 5944 readl(hdspm->iobase +
5970 HDSPM_MADI_PLAYBACK_PEAK + i*4); 5945 HDSPM_MADI_PLAYBACK_PEAK + i*4);
5971 levels.output_peaks[i] = 5946 levels->output_peaks[i] =
5972 readl(hdspm->iobase + 5947 readl(hdspm->iobase +
5973 HDSPM_MADI_OUTPUT_PEAK + i*4); 5948 HDSPM_MADI_OUTPUT_PEAK + i*4);
5974 5949
5975 levels.input_rms[i] = 5950 levels->input_rms[i] =
5976 ((uint64_t) readl(hdspm->iobase + 5951 ((uint64_t) readl(hdspm->iobase +
5977 HDSPM_MADI_INPUT_RMS_H + i*4) << 32) | 5952 HDSPM_MADI_INPUT_RMS_H + i*4) << 32) |
5978 (uint64_t) readl(hdspm->iobase + 5953 (uint64_t) readl(hdspm->iobase +
5979 HDSPM_MADI_INPUT_RMS_L + i*4); 5954 HDSPM_MADI_INPUT_RMS_L + i*4);
5980 levels.playback_rms[i] = 5955 levels->playback_rms[i] =
5981 ((uint64_t)readl(hdspm->iobase + 5956 ((uint64_t)readl(hdspm->iobase +
5982 HDSPM_MADI_PLAYBACK_RMS_H+i*4) << 32) | 5957 HDSPM_MADI_PLAYBACK_RMS_H+i*4) << 32) |
5983 (uint64_t)readl(hdspm->iobase + 5958 (uint64_t)readl(hdspm->iobase +
5984 HDSPM_MADI_PLAYBACK_RMS_L + i*4); 5959 HDSPM_MADI_PLAYBACK_RMS_L + i*4);
5985 levels.output_rms[i] = 5960 levels->output_rms[i] =
5986 ((uint64_t)readl(hdspm->iobase + 5961 ((uint64_t)readl(hdspm->iobase +
5987 HDSPM_MADI_OUTPUT_RMS_H + i*4) << 32) | 5962 HDSPM_MADI_OUTPUT_RMS_H + i*4) << 32) |
5988 (uint64_t)readl(hdspm->iobase + 5963 (uint64_t)readl(hdspm->iobase +
@@ -5990,15 +5965,15 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
5990 } 5965 }
5991 5966
5992 if (hdspm->system_sample_rate > 96000) { 5967 if (hdspm->system_sample_rate > 96000) {
5993 levels.speed = qs; 5968 levels->speed = qs;
5994 } else if (hdspm->system_sample_rate > 48000) { 5969 } else if (hdspm->system_sample_rate > 48000) {
5995 levels.speed = ds; 5970 levels->speed = ds;
5996 } else { 5971 } else {
5997 levels.speed = ss; 5972 levels->speed = ss;
5998 } 5973 }
5999 levels.status2 = hdspm_read(hdspm, HDSPM_statusRegister2); 5974 levels->status2 = hdspm_read(hdspm, HDSPM_statusRegister2);
6000 5975
6001 s = copy_to_user(argp, &levels, sizeof(struct hdspm_peak_rms)); 5976 s = copy_to_user(argp, levels, sizeof(struct hdspm_peak_rms));
6002 if (0 != s) { 5977 if (0 != s) {
6003 /* snd_printk(KERN_ERR "copy_to_user(.., .., %lu): %lu 5978 /* snd_printk(KERN_ERR "copy_to_user(.., .., %lu): %lu
6004 [Levels]\n", sizeof(struct hdspm_peak_rms), s); 5979 [Levels]\n", sizeof(struct hdspm_peak_rms), s);