Merge branch 'master'
[powerpc.git] / sound / pci / ymfpci / ymfpci_main.c
index d54f88a..88a43e0 100644 (file)
@@ -92,9 +92,9 @@ static int snd_ymfpci_codec_ready(ymfpci_t *chip, int secondary)
                if ((snd_ymfpci_readw(chip, reg) & 0x8000) == 0)
                        return 0;
                set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
        } while (time_before(jiffies, end_time));
-       snd_printk("codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg));
+       snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg));
        return -EBUSY;
 }
 
@@ -321,6 +321,26 @@ static void snd_ymfpci_pcm_interrupt(ymfpci_t *chip, ymfpci_voice_t *voice)
                        snd_pcm_period_elapsed(ypcm->substream);
                        spin_lock(&chip->reg_lock);
                }
+
+               if (unlikely(ypcm->update_pcm_vol)) {
+                       unsigned int subs = ypcm->substream->number;
+                       unsigned int next_bank = 1 - chip->active_bank;
+                       snd_ymfpci_playback_bank_t *bank;
+                       u32 volume;
+                       
+                       bank = &voice->bank[next_bank];
+                       volume = cpu_to_le32(chip->pcm_mixer[subs].left << 15);
+                       bank->left_gain_end = volume;
+                       if (ypcm->output_rear)
+                               bank->eff2_gain_end = volume;
+                       if (ypcm->voices[1])
+                               bank = &ypcm->voices[1]->bank[next_bank];
+                       volume = cpu_to_le32(chip->pcm_mixer[subs].right << 15);
+                       bank->right_gain_end = volume;
+                       if (ypcm->output_rear)
+                               bank->eff3_gain_end = volume;
+                       ypcm->update_pcm_vol--;
+               }
        }
        spin_unlock(&chip->reg_lock);
 }
@@ -451,87 +471,74 @@ static int snd_ymfpci_pcm_voice_alloc(ymfpci_pcm_t *ypcm, int voices)
        return 0;
 }
 
-static void snd_ymfpci_pcm_init_voice(ymfpci_voice_t *voice, int stereo,
-                                     int rate, int w_16, unsigned long addr,
-                                     unsigned int end,
-                                     int output_front, int output_rear)
+static void snd_ymfpci_pcm_init_voice(ymfpci_pcm_t *ypcm, unsigned int voiceidx,
+                                     snd_pcm_runtime_t *runtime,
+                                     int has_pcm_volume)
 {
+       ymfpci_voice_t *voice = ypcm->voices[voiceidx];
        u32 format;
-       u32 delta = snd_ymfpci_calc_delta(rate);
-       u32 lpfQ = snd_ymfpci_calc_lpfQ(rate);
-       u32 lpfK = snd_ymfpci_calc_lpfK(rate);
+       u32 delta = snd_ymfpci_calc_delta(runtime->rate);
+       u32 lpfQ = snd_ymfpci_calc_lpfQ(runtime->rate);
+       u32 lpfK = snd_ymfpci_calc_lpfK(runtime->rate);
        snd_ymfpci_playback_bank_t *bank;
        unsigned int nbank;
+       u32 vol_left, vol_right;
+       u8 use_left, use_right;
 
        snd_assert(voice != NULL, return);
-       format = (stereo ? 0x00010000 : 0) | (w_16 ? 0 : 0x80000000);
+       if (runtime->channels == 1) {
+               use_left = 1;
+               use_right = 1;
+       } else {
+               use_left = (voiceidx & 1) == 0;
+               use_right = !use_left;
+       }
+       if (has_pcm_volume) {
+               vol_left = cpu_to_le32(ypcm->chip->pcm_mixer
+                                      [ypcm->substream->number].left << 15);
+               vol_right = cpu_to_le32(ypcm->chip->pcm_mixer
+                                       [ypcm->substream->number].right << 15);
+       } else {
+               vol_left = cpu_to_le32(0x40000000);
+               vol_right = cpu_to_le32(0x40000000);
+       }
+       format = runtime->channels == 2 ? 0x00010000 : 0;
+       if (snd_pcm_format_width(runtime->format) == 8)
+               format |= 0x80000000;
+       if (runtime->channels == 2 && (voiceidx & 1) != 0)
+               format |= 1;
        for (nbank = 0; nbank < 2; nbank++) {
                bank = &voice->bank[nbank];
+               memset(bank, 0, sizeof(*bank));
                bank->format = cpu_to_le32(format);
-               bank->loop_default = 0;
-               bank->base = cpu_to_le32(addr);
-               bank->loop_start = 0;
-               bank->loop_end = cpu_to_le32(end);
-               bank->loop_frac = 0;
-               bank->eg_gain_end = cpu_to_le32(0x40000000);
+               bank->base = cpu_to_le32(runtime->dma_addr);
+               bank->loop_end = cpu_to_le32(ypcm->buffer_size);
                bank->lpfQ = cpu_to_le32(lpfQ);
-               bank->status = 0;
-               bank->num_of_frames = 0;
-               bank->loop_count = 0;
-               bank->start = 0;
-               bank->start_frac = 0;
                bank->delta =
                bank->delta_end = cpu_to_le32(delta);
                bank->lpfK =
                bank->lpfK_end = cpu_to_le32(lpfK);
-               bank->eg_gain = cpu_to_le32(0x40000000);
-               bank->lpfD1 =
-               bank->lpfD2 = 0;
-
-               bank->left_gain = 
-               bank->right_gain =
-               bank->left_gain_end =
-               bank->right_gain_end =
-               bank->eff1_gain =
-               bank->eff2_gain =
-               bank->eff3_gain =
-               bank->eff1_gain_end =
-               bank->eff2_gain_end =
-               bank->eff3_gain_end = 0;
-
-               if (!stereo) {
-                       if (output_front) {
-                               bank->left_gain = 
+               bank->eg_gain =
+               bank->eg_gain_end = cpu_to_le32(0x40000000);
+
+               if (ypcm->output_front) {
+                       if (use_left) {
+                               bank->left_gain =
+                               bank->left_gain_end = vol_left;
+                       }
+                       if (use_right) {
                                bank->right_gain =
-                               bank->left_gain_end =
-                               bank->right_gain_end = cpu_to_le32(0x40000000);
+                               bank->right_gain_end = vol_right;
                        }
-                       if (output_rear) {
+               }
+               if (ypcm->output_rear) {
+                       if (use_left) {
                                bank->eff2_gain =
-                               bank->eff2_gain_end =
-                               bank->eff3_gain =
-                               bank->eff3_gain_end = cpu_to_le32(0x40000000);
-                       }
-               } else {
-                       if (output_front) {
-                               if ((voice->number & 1) == 0) {
-                                       bank->left_gain =
-                                       bank->left_gain_end = cpu_to_le32(0x40000000);
-                               } else {
-                                       bank->format |= cpu_to_le32(1);
-                                       bank->right_gain =
-                                       bank->right_gain_end = cpu_to_le32(0x40000000);
-                               }
+                               bank->eff2_gain_end = vol_left;
                        }
-                       if (output_rear) {
-                               if ((voice->number & 1) == 0) {
-                                       bank->eff3_gain =
-                                       bank->eff3_gain_end = cpu_to_le32(0x40000000);
-                               } else {
-                                       bank->format |= cpu_to_le32(1);
-                                       bank->eff2_gain =
-                                       bank->eff2_gain_end = cpu_to_le32(0x40000000);
-                               }
+                       if (use_right) {
+                               bank->eff3_gain =
+                               bank->eff3_gain_end = vol_right;
                        }
                }
        }
@@ -613,7 +620,7 @@ static int snd_ymfpci_playback_hw_free(snd_pcm_substream_t * substream)
 
 static int snd_ymfpci_playback_prepare(snd_pcm_substream_t * substream)
 {
-       // ymfpci_t *chip = snd_pcm_substream_chip(substream);
+       ymfpci_t *chip = snd_pcm_substream_chip(substream);
        snd_pcm_runtime_t *runtime = substream->runtime;
        ymfpci_pcm_t *ypcm = runtime->private_data;
        unsigned int nvoice;
@@ -623,14 +630,8 @@ static int snd_ymfpci_playback_prepare(snd_pcm_substream_t * substream)
        ypcm->period_pos = 0;
        ypcm->last_pos = 0;
        for (nvoice = 0; nvoice < runtime->channels; nvoice++)
-               snd_ymfpci_pcm_init_voice(ypcm->voices[nvoice],
-                                         runtime->channels == 2,
-                                         runtime->rate,
-                                         snd_pcm_format_width(runtime->format) == 16,
-                                         runtime->dma_addr,
-                                         ypcm->buffer_size,
-                                         ypcm->output_front,
-                                         ypcm->output_rear);
+               snd_ymfpci_pcm_init_voice(ypcm, nvoice, runtime,
+                                         substream->pcm == chip->pcm);
        return 0;
 }
 
@@ -727,8 +728,7 @@ static void snd_ymfpci_irq_wait(ymfpci_t *chip)
                init_waitqueue_entry(&wait, current);
                add_wait_queue(&chip->interrupt_sleep, &wait);
                atomic_inc(&chip->interrupt_sleep_count);
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(HZ/20);
+               schedule_timeout_uninterruptible(msecs_to_jiffies(50));
                remove_wait_queue(&chip->interrupt_sleep, &wait);
        }
 }
@@ -838,7 +838,7 @@ static int snd_ymfpci_playback_open_1(snd_pcm_substream_t * substream)
        snd_pcm_runtime_t *runtime = substream->runtime;
        ymfpci_pcm_t *ypcm;
 
-       ypcm = kcalloc(1, sizeof(*ypcm), GFP_KERNEL);
+       ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
        if (ypcm == NULL)
                return -ENOMEM;
        ypcm->chip = chip;
@@ -882,6 +882,7 @@ static int snd_ymfpci_playback_open(snd_pcm_substream_t * substream)
        ymfpci_t *chip = snd_pcm_substream_chip(substream);
        snd_pcm_runtime_t *runtime = substream->runtime;
        ymfpci_pcm_t *ypcm;
+       snd_kcontrol_t *kctl;
        int err;
        
        if ((err = snd_ymfpci_playback_open_1(substream)) < 0)
@@ -895,6 +896,10 @@ static int snd_ymfpci_playback_open(snd_pcm_substream_t * substream)
                chip->rear_opened++;
        }
        spin_unlock_irq(&chip->reg_lock);
+
+       kctl = chip->pcm_mixer[substream->number].ctl;
+       kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+       snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_INFO, &kctl->id);
        return 0;
 }
 
@@ -951,7 +956,7 @@ static int snd_ymfpci_capture_open(snd_pcm_substream_t * substream,
        snd_pcm_runtime_t *runtime = substream->runtime;
        ymfpci_pcm_t *ypcm;
 
-       ypcm = kcalloc(1, sizeof(*ypcm), GFP_KERNEL);
+       ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
        if (ypcm == NULL)
                return -ENOMEM;
        ypcm->chip = chip;
@@ -987,6 +992,7 @@ static int snd_ymfpci_playback_close(snd_pcm_substream_t * substream)
 {
        ymfpci_t *chip = snd_pcm_substream_chip(substream);
        ymfpci_pcm_t *ypcm = substream->runtime->private_data;
+       snd_kcontrol_t *kctl;
 
        spin_lock_irq(&chip->reg_lock);
        if (ypcm->output_rear && chip->rear_opened > 0) {
@@ -994,6 +1000,9 @@ static int snd_ymfpci_playback_close(snd_pcm_substream_t * substream)
                ymfpci_close_extension(chip);
        }
        spin_unlock_irq(&chip->reg_lock);
+       kctl = chip->pcm_mixer[substream->number].ctl;
+       kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+       snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_INFO, &kctl->id);
        return snd_ymfpci_playback_close_1(substream);
 }
 
@@ -1411,15 +1420,18 @@ static snd_kcontrol_new_t snd_ymfpci_drec_source __devinitdata = {
  *  Mixer controls
  */
 
-#define YMFPCI_SINGLE(xname, xindex, reg) \
+#define YMFPCI_SINGLE(xname, xindex, reg, shift) \
 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
   .info = snd_ymfpci_info_single, \
   .get = snd_ymfpci_get_single, .put = snd_ymfpci_put_single, \
-  .private_value = reg }
+  .private_value = ((reg) | ((shift) << 16)) }
 
-static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol,
+                                 snd_ctl_elem_info_t *uinfo)
 {
-       switch (kcontrol->private_value) {
+       int reg = kcontrol->private_value & 0xffff;
+
+       switch (reg) {
        case YDSXGR_SPDIFOUTCTRL: break;
        case YDSXGR_SPDIFINCTRL: break;
        default: return -EINVAL;
@@ -1431,30 +1443,35 @@ static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
        return 0;
 }
 
-static int snd_ymfpci_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+static int snd_ymfpci_get_single(snd_kcontrol_t *kcontrol,
+                                snd_ctl_elem_value_t *ucontrol)
 {
        ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
-       int reg = kcontrol->private_value;
-       unsigned int shift = 0, mask = 1;
+       int reg = kcontrol->private_value & 0xffff;
+       unsigned int shift = (kcontrol->private_value >> 16) & 0xff;
+       unsigned int mask = 1;
        
-       switch (kcontrol->private_value) {
+       switch (reg) {
        case YDSXGR_SPDIFOUTCTRL: break;
        case YDSXGR_SPDIFINCTRL: break;
        default: return -EINVAL;
        }
-       ucontrol->value.integer.value[0] = (snd_ymfpci_readl(chip, reg) >> shift) & mask;
+       ucontrol->value.integer.value[0] =
+               (snd_ymfpci_readl(chip, reg) >> shift) & mask;
        return 0;
 }
 
-static int snd_ymfpci_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+static int snd_ymfpci_put_single(snd_kcontrol_t *kcontrol,
+                                snd_ctl_elem_value_t *ucontrol)
 {
        ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
-       int reg = kcontrol->private_value;
-       unsigned int shift = 0, mask = 1;
+       int reg = kcontrol->private_value & 0xffff;
+       unsigned int shift = (kcontrol->private_value >> 16) & 0xff;
+       unsigned int mask = 1;
        int change;
        unsigned int val, oval;
        
-       switch (kcontrol->private_value) {
+       switch (reg) {
        case YDSXGR_SPDIFOUTCTRL: break;
        case YDSXGR_SPDIFINCTRL: break;
        default: return -EINVAL;
@@ -1573,8 +1590,9 @@ YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ", PLAYBACK,VOLUME), 0, YDSXGR_ZVOUTVO
 YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("", CAPTURE,VOLUME), 0, YDSXGR_ZVLOOPVOL),
 YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ",PLAYBACK,VOLUME), 1, YDSXGR_SPDIFOUTVOL),
 YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,VOLUME), 1, YDSXGR_SPDIFLOOPVOL),
-YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL),
-YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL),
+YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL, 0),
+YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL, 0),
+YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("Loop",NONE,NONE), 0, YDSXGR_SPDIFINCTRL, 4),
 {
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
        .name = "4ch Duplication",
@@ -1665,6 +1683,66 @@ static snd_kcontrol_new_t snd_ymfpci_rear_shared __devinitdata = {
        .private_value = 2,
 };
 
+/*
+ * PCM voice volume
+ */
+
+static int snd_ymfpci_pcm_vol_info(snd_kcontrol_t *kcontrol,
+                                  snd_ctl_elem_info_t *uinfo)
+{
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+       uinfo->count = 2;
+       uinfo->value.integer.min = 0;
+       uinfo->value.integer.max = 0x8000;
+       return 0;
+}
+
+static int snd_ymfpci_pcm_vol_get(snd_kcontrol_t *kcontrol,
+                                 snd_ctl_elem_value_t *ucontrol)
+{
+       ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
+       unsigned int subs = kcontrol->id.subdevice;
+
+       ucontrol->value.integer.value[0] = chip->pcm_mixer[subs].left;
+       ucontrol->value.integer.value[1] = chip->pcm_mixer[subs].right;
+       return 0;
+}
+
+static int snd_ymfpci_pcm_vol_put(snd_kcontrol_t *kcontrol,
+                                 snd_ctl_elem_value_t *ucontrol)
+{
+       ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
+       unsigned int subs = kcontrol->id.subdevice;
+       snd_pcm_substream_t *substream;
+       unsigned long flags;
+
+       if (ucontrol->value.integer.value[0] != chip->pcm_mixer[subs].left ||
+           ucontrol->value.integer.value[1] != chip->pcm_mixer[subs].right) {
+               chip->pcm_mixer[subs].left = ucontrol->value.integer.value[0];
+               chip->pcm_mixer[subs].right = ucontrol->value.integer.value[1];
+
+               substream = (snd_pcm_substream_t *)kcontrol->private_value;
+               spin_lock_irqsave(&chip->voice_lock, flags);
+               if (substream->runtime && substream->runtime->private_data) {
+                       ymfpci_pcm_t *ypcm = substream->runtime->private_data;
+                       ypcm->update_pcm_vol = 2;
+               }
+               spin_unlock_irqrestore(&chip->voice_lock, flags);
+               return 1;
+       }
+       return 0;
+}
+
+static snd_kcontrol_new_t snd_ymfpci_pcm_volume __devinitdata = {
+       .iface = SNDRV_CTL_ELEM_IFACE_PCM,
+       .name = "PCM Playback Volume",
+       .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
+               SNDRV_CTL_ELEM_ACCESS_INACTIVE,
+       .info = snd_ymfpci_pcm_vol_info,
+       .get = snd_ymfpci_pcm_vol_get,
+       .put = snd_ymfpci_pcm_vol_put,
+};
+
 
 /*
  *  Mixer routines
@@ -1686,6 +1764,7 @@ int __devinit snd_ymfpci_mixer(ymfpci_t *chip, int rear_switch)
 {
        ac97_template_t ac97;
        snd_kcontrol_t *kctl;
+       snd_pcm_substream_t *substream;
        unsigned int idx;
        int err;
        static ac97_bus_ops_t ops = {
@@ -1739,6 +1818,23 @@ int __devinit snd_ymfpci_mixer(ymfpci_t *chip, int rear_switch)
                        return err;
        }
 
+       /* per-voice volume */
+       substream = chip->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
+       for (idx = 0; idx < 32; ++idx) {
+               kctl = snd_ctl_new1(&snd_ymfpci_pcm_volume, chip);
+               if (!kctl)
+                       return -ENOMEM;
+               kctl->id.device = chip->pcm->device;
+               kctl->id.subdevice = idx;
+               kctl->private_value = (unsigned long)substream;
+               if ((err = snd_ctl_add(chip->card, kctl)) < 0)
+                       return err;
+               chip->pcm_mixer[idx].left = 0x8000;
+               chip->pcm_mixer[idx].right = 0x8000;
+               chip->pcm_mixer[idx].ctl = kctl;
+               substream = substream->next;
+       }
+
        return 0;
 }
 
@@ -1754,9 +1850,7 @@ static int snd_ymfpci_timer_start(snd_timer_t *timer)
        unsigned int count;
 
        chip = snd_timer_chip(timer);
-       count = timer->sticks - 1;
-       if (count == 0) /* minimum time is 20.8 us */
-               count = 1;
+       count = (timer->sticks << 1) - 1;
        spin_lock_irqsave(&chip->reg_lock, flags);
        snd_ymfpci_writew(chip, YDSXGR_TIMERCOUNT, count);
        snd_ymfpci_writeb(chip, YDSXGR_TIMERCTRL, 0x03);
@@ -1780,14 +1874,14 @@ static int snd_ymfpci_timer_precise_resolution(snd_timer_t *timer,
                                               unsigned long *num, unsigned long *den)
 {
        *num = 1;
-       *den = 96000;
+       *den = 48000;
        return 0;
 }
 
 static struct _snd_timer_hardware snd_ymfpci_timer_hw = {
        .flags = SNDRV_TIMER_HW_AUTO,
-       .resolution = 10417, /* 1/2fs = 10.41666...us */
-       .ticks = 65536,
+       .resolution = 20833, /* 1/fs = 20.8333...us */
+       .ticks = 0x8000,
        .start = snd_ymfpci_timer_start,
        .stop = snd_ymfpci_timer_stop,
        .precise_resolution = snd_ymfpci_timer_precise_resolution,
@@ -2054,14 +2148,8 @@ static int snd_ymfpci_free(ymfpci_t *chip)
 #ifdef CONFIG_PM
        vfree(chip->saved_regs);
 #endif
-       if (chip->mpu_res) {
-               release_resource(chip->mpu_res);
-               kfree_nocheck(chip->mpu_res);
-       }
-       if (chip->fm_res) {
-               release_resource(chip->fm_res);
-               kfree_nocheck(chip->fm_res);
-       }
+       release_and_free_resource(chip->mpu_res);
+       release_and_free_resource(chip->fm_res);
        snd_ymfpci_free_gameport(chip);
        if (chip->reg_area_virt)
                iounmap(chip->reg_area_virt);
@@ -2070,10 +2158,7 @@ static int snd_ymfpci_free(ymfpci_t *chip)
        
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *)chip);
-       if (chip->res_reg_area) {
-               release_resource(chip->res_reg_area);
-               kfree_nocheck(chip->res_reg_area);
-       }
+       release_and_free_resource(chip->res_reg_area);
 
        pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl);
        
@@ -2182,7 +2267,7 @@ int __devinit snd_ymfpci_create(snd_card_t * card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -2202,12 +2287,12 @@ int __devinit snd_ymfpci_create(snd_card_t * card,
        pci_set_master(pci);
 
        if ((chip->res_reg_area = request_mem_region(chip->reg_area_phys, 0x8000, "YMFPCI")) == NULL) {
-               snd_printk("unable to grab memory region 0x%lx-0x%lx\n", chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1);
+               snd_printk(KERN_ERR "unable to grab memory region 0x%lx-0x%lx\n", chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1);
                snd_ymfpci_free(chip);
                return -EBUSY;
        }
        if (request_irq(pci->irq, snd_ymfpci_interrupt, SA_INTERRUPT|SA_SHIRQ, "YMFPCI", (void *) chip)) {
-               snd_printk("unable to grab IRQ %d\n", pci->irq);
+               snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
                snd_ymfpci_free(chip);
                return -EBUSY;
        }