aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/cmipci.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 7cf4fc193419..085a36751ac0 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -431,15 +431,13 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
431 431
432struct cmipci_pcm { 432struct cmipci_pcm {
433 struct snd_pcm_substream *substream; 433 struct snd_pcm_substream *substream;
434 int running; /* dac/adc running? */ 434 u8 running; /* dac/adc running? */
435 u8 fmt; /* format bits */
436 u8 is_dac;
435 unsigned int dma_size; /* in frames */ 437 unsigned int dma_size; /* in frames */
436 unsigned int period_size; /* in frames */ 438 unsigned int shift;
439 unsigned int ch; /* channel (0/1) */
437 unsigned int offset; /* physical address of the buffer */ 440 unsigned int offset; /* physical address of the buffer */
438 unsigned int fmt; /* format bits */
439 int ch; /* channel (0/1) */
440 unsigned int is_dac; /* is dac? */
441 int bytes_per_frame;
442 int shift;
443}; 441};
444 442
445/* mixer elements toggled/resumed during ac3 playback */ 443/* mixer elements toggled/resumed during ac3 playback */
@@ -785,6 +783,7 @@ static int snd_cmipci_pcm_prepare(struct cmipci *cm, struct cmipci_pcm *rec,
785 struct snd_pcm_substream *substream) 783 struct snd_pcm_substream *substream)
786{ 784{
787 unsigned int reg, freq, val; 785 unsigned int reg, freq, val;
786 unsigned int period_size;
788 struct snd_pcm_runtime *runtime = substream->runtime; 787 struct snd_pcm_runtime *runtime = substream->runtime;
789 788
790 rec->fmt = 0; 789 rec->fmt = 0;
@@ -804,11 +803,11 @@ static int snd_cmipci_pcm_prepare(struct cmipci *cm, struct cmipci_pcm *rec,
804 rec->offset = runtime->dma_addr; 803 rec->offset = runtime->dma_addr;
805 /* buffer and period sizes in frame */ 804 /* buffer and period sizes in frame */
806 rec->dma_size = runtime->buffer_size << rec->shift; 805 rec->dma_size = runtime->buffer_size << rec->shift;
807 rec->period_size = runtime->period_size << rec->shift; 806 period_size = runtime->period_size << rec->shift;
808 if (runtime->channels > 2) { 807 if (runtime->channels > 2) {
809 /* multi-channels */ 808 /* multi-channels */
810 rec->dma_size = (rec->dma_size * runtime->channels) / 2; 809 rec->dma_size = (rec->dma_size * runtime->channels) / 2;
811 rec->period_size = (rec->period_size * runtime->channels) / 2; 810 period_size = (period_size * runtime->channels) / 2;
812 } 811 }
813 812
814 spin_lock_irq(&cm->reg_lock); 813 spin_lock_irq(&cm->reg_lock);
@@ -819,7 +818,7 @@ static int snd_cmipci_pcm_prepare(struct cmipci *cm, struct cmipci_pcm *rec,
819 /* program sample counts */ 818 /* program sample counts */
820 reg = rec->ch ? CM_REG_CH1_FRAME2 : CM_REG_CH0_FRAME2; 819 reg = rec->ch ? CM_REG_CH1_FRAME2 : CM_REG_CH0_FRAME2;
821 snd_cmipci_write_w(cm, reg, rec->dma_size - 1); 820 snd_cmipci_write_w(cm, reg, rec->dma_size - 1);
822 snd_cmipci_write_w(cm, reg + 2, rec->period_size - 1); 821 snd_cmipci_write_w(cm, reg + 2, period_size - 1);
823 822
824 /* set adc/dac flag */ 823 /* set adc/dac flag */
825 val = rec->ch ? CM_CHADC1 : CM_CHADC0; 824 val = rec->ch ? CM_CHADC1 : CM_CHADC0;
@@ -875,7 +874,7 @@ static int snd_cmipci_pcm_prepare(struct cmipci *cm, struct cmipci_pcm *rec,
875 * PCM trigger/stop 874 * PCM trigger/stop
876 */ 875 */
877static int snd_cmipci_pcm_trigger(struct cmipci *cm, struct cmipci_pcm *rec, 876static int snd_cmipci_pcm_trigger(struct cmipci *cm, struct cmipci_pcm *rec,
878 struct snd_pcm_substream *substream, int cmd) 877 int cmd)
879{ 878{
880 unsigned int inthld, chen, reset, pause; 879 unsigned int inthld, chen, reset, pause;
881 int result = 0; 880 int result = 0;
@@ -955,7 +954,7 @@ static int snd_cmipci_playback_trigger(struct snd_pcm_substream *substream,
955 int cmd) 954 int cmd)
956{ 955{
957 struct cmipci *cm = snd_pcm_substream_chip(substream); 956 struct cmipci *cm = snd_pcm_substream_chip(substream);
958 return snd_cmipci_pcm_trigger(cm, &cm->channel[CM_CH_PLAY], substream, cmd); 957 return snd_cmipci_pcm_trigger(cm, &cm->channel[CM_CH_PLAY], cmd);
959} 958}
960 959
961static snd_pcm_uframes_t snd_cmipci_playback_pointer(struct snd_pcm_substream *substream) 960static snd_pcm_uframes_t snd_cmipci_playback_pointer(struct snd_pcm_substream *substream)
@@ -974,7 +973,7 @@ static int snd_cmipci_capture_trigger(struct snd_pcm_substream *substream,
974 int cmd) 973 int cmd)
975{ 974{
976 struct cmipci *cm = snd_pcm_substream_chip(substream); 975 struct cmipci *cm = snd_pcm_substream_chip(substream);
977 return snd_cmipci_pcm_trigger(cm, &cm->channel[CM_CH_CAPT], substream, cmd); 976 return snd_cmipci_pcm_trigger(cm, &cm->channel[CM_CH_CAPT], cmd);
978} 977}
979 978
980static snd_pcm_uframes_t snd_cmipci_capture_pointer(struct snd_pcm_substream *substream) 979static snd_pcm_uframes_t snd_cmipci_capture_pointer(struct snd_pcm_substream *substream)