diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-08-03 02:48:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-08-03 02:48:22 -0400 |
commit | 0d7e92da50763b53b59b490ce57a323039ee241d (patch) | |
tree | 9a1ee0292fce0243406f2e66c170d25e062730a2 /sound | |
parent | c027a474a68065391c8773f6e83ed5412657e369 (diff) | |
parent | 9f3b24948f22e4e21e961bd514c2089d24f0938e (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
ALSA: asihpi - Clarify adapter index validity check
ALSA: asihpi - Don't leak firmware if mem alloc fails
ALSA: rtctimer.c needs module.h
ASoC: Fix txx9aclc.c build
ALSA: hdspm - Add firmware revision 0xcc for RME MADI
ALSA: hdspm - Fix reported external sample rate on RME MADI and MADIface
ALSA: hdspm - Provide MADI speed mode selector on RME MADI and MADIface
ALSA: sound/core/pcm_compat.c: adjust array index
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/pcm_compat.c | 2 | ||||
-rw-r--r-- | sound/core/rtctimer.c | 2 | ||||
-rw-r--r-- | sound/pci/asihpi/hpidspcd.c | 9 | ||||
-rw-r--r-- | sound/pci/asihpi/hpioctl.c | 19 | ||||
-rw-r--r-- | sound/pci/rme9652/hdspm.c | 109 | ||||
-rw-r--r-- | sound/soc/txx9/txx9aclc.c | 1 |
6 files changed, 128 insertions, 14 deletions
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c index 5fb2e28e796f..91cdf9435fec 100644 --- a/sound/core/pcm_compat.c +++ b/sound/core/pcm_compat.c | |||
@@ -342,7 +342,7 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream, | |||
342 | kfree(bufs); | 342 | kfree(bufs); |
343 | return -EFAULT; | 343 | return -EFAULT; |
344 | } | 344 | } |
345 | bufs[ch] = compat_ptr(ptr); | 345 | bufs[i] = compat_ptr(ptr); |
346 | bufptr++; | 346 | bufptr++; |
347 | } | 347 | } |
348 | if (dir == SNDRV_PCM_STREAM_PLAYBACK) | 348 | if (dir == SNDRV_PCM_STREAM_PLAYBACK) |
diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c index 0851cd13e303..e85e72baff9e 100644 --- a/sound/core/rtctimer.c +++ b/sound/core/rtctimer.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/moduleparam.h> | 25 | #include <linux/module.h> |
26 | #include <linux/log2.h> | 26 | #include <linux/log2.h> |
27 | #include <sound/core.h> | 27 | #include <sound/core.h> |
28 | #include <sound/timer.h> | 28 | #include <sound/timer.h> |
diff --git a/sound/pci/asihpi/hpidspcd.c b/sound/pci/asihpi/hpidspcd.c index 3a7afa31c1d8..71d32c868c92 100644 --- a/sound/pci/asihpi/hpidspcd.c +++ b/sound/pci/asihpi/hpidspcd.c | |||
@@ -43,6 +43,7 @@ short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code, | |||
43 | struct pci_dev *dev = os_data; | 43 | struct pci_dev *dev = os_data; |
44 | struct code_header header; | 44 | struct code_header header; |
45 | char fw_name[20]; | 45 | char fw_name[20]; |
46 | short err_ret = HPI_ERROR_DSP_FILE_NOT_FOUND; | ||
46 | int err; | 47 | int err; |
47 | 48 | ||
48 | sprintf(fw_name, "asihpi/dsp%04x.bin", adapter); | 49 | sprintf(fw_name, "asihpi/dsp%04x.bin", adapter); |
@@ -85,8 +86,10 @@ short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code, | |||
85 | 86 | ||
86 | HPI_DEBUG_LOG(DEBUG, "dsp code %s opened\n", fw_name); | 87 | HPI_DEBUG_LOG(DEBUG, "dsp code %s opened\n", fw_name); |
87 | dsp_code->pvt = kmalloc(sizeof(*dsp_code->pvt), GFP_KERNEL); | 88 | dsp_code->pvt = kmalloc(sizeof(*dsp_code->pvt), GFP_KERNEL); |
88 | if (!dsp_code->pvt) | 89 | if (!dsp_code->pvt) { |
89 | return HPI_ERROR_MEMORY_ALLOC; | 90 | err_ret = HPI_ERROR_MEMORY_ALLOC; |
91 | goto error2; | ||
92 | } | ||
90 | 93 | ||
91 | dsp_code->pvt->dev = dev; | 94 | dsp_code->pvt->dev = dev; |
92 | dsp_code->pvt->firmware = firmware; | 95 | dsp_code->pvt->firmware = firmware; |
@@ -99,7 +102,7 @@ error2: | |||
99 | release_firmware(firmware); | 102 | release_firmware(firmware); |
100 | error1: | 103 | error1: |
101 | dsp_code->block_length = 0; | 104 | dsp_code->block_length = 0; |
102 | return HPI_ERROR_DSP_FILE_NOT_FOUND; | 105 | return err_ret; |
103 | } | 106 | } |
104 | 107 | ||
105 | /*-------------------------------------------------------------------*/ | 108 | /*-------------------------------------------------------------------*/ |
diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index 9683f84ecdc8..a32502e796de 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c | |||
@@ -177,16 +177,21 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
177 | } else { | 177 | } else { |
178 | u16 __user *ptr = NULL; | 178 | u16 __user *ptr = NULL; |
179 | u32 size = 0; | 179 | u32 size = 0; |
180 | 180 | u32 adapter_present; | |
181 | /* -1=no data 0=read from user mem, 1=write to user mem */ | 181 | /* -1=no data 0=read from user mem, 1=write to user mem */ |
182 | int wrflag = -1; | 182 | int wrflag = -1; |
183 | u32 adapter = hm->h.adapter_index; | 183 | struct hpi_adapter *pa; |
184 | struct hpi_adapter *pa = &adapters[adapter]; | 184 | |
185 | if (hm->h.adapter_index < HPI_MAX_ADAPTERS) { | ||
186 | pa = &adapters[hm->h.adapter_index]; | ||
187 | adapter_present = pa->type; | ||
188 | } else { | ||
189 | adapter_present = 0; | ||
190 | } | ||
185 | 191 | ||
186 | if ((adapter >= HPI_MAX_ADAPTERS) || (!pa->type)) { | 192 | if (!adapter_present) { |
187 | hpi_init_response(&hr->r0, HPI_OBJ_ADAPTER, | 193 | hpi_init_response(&hr->r0, hm->h.object, |
188 | HPI_ADAPTER_OPEN, | 194 | hm->h.function, HPI_ERROR_BAD_ADAPTER_NUMBER); |
189 | HPI_ERROR_BAD_ADAPTER_NUMBER); | ||
190 | 195 | ||
191 | uncopied_bytes = | 196 | uncopied_bytes = |
192 | copy_to_user(puhr, hr, sizeof(hr->h)); | 197 | copy_to_user(puhr, hr, sizeof(hr->h)); |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index af130ee0c45d..6edc67ced905 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -521,6 +521,7 @@ MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}"); | |||
521 | #define HDSPM_DMA_AREA_KILOBYTES (HDSPM_DMA_AREA_BYTES/1024) | 521 | #define HDSPM_DMA_AREA_KILOBYTES (HDSPM_DMA_AREA_BYTES/1024) |
522 | 522 | ||
523 | /* revisions >= 230 indicate AES32 card */ | 523 | /* revisions >= 230 indicate AES32 card */ |
524 | #define HDSPM_MADI_ANCIENT_REV 204 | ||
524 | #define HDSPM_MADI_OLD_REV 207 | 525 | #define HDSPM_MADI_OLD_REV 207 |
525 | #define HDSPM_MADI_REV 210 | 526 | #define HDSPM_MADI_REV 210 |
526 | #define HDSPM_RAYDAT_REV 211 | 527 | #define HDSPM_RAYDAT_REV 211 |
@@ -1217,6 +1218,22 @@ static int hdspm_external_sample_rate(struct hdspm *hdspm) | |||
1217 | rate = 0; | 1218 | rate = 0; |
1218 | break; | 1219 | break; |
1219 | } | 1220 | } |
1221 | |||
1222 | /* QS and DS rates normally can not be detected | ||
1223 | * automatically by the card. Only exception is MADI | ||
1224 | * in 96k frame mode. | ||
1225 | * | ||
1226 | * So if we read SS values (32 .. 48k), check for | ||
1227 | * user-provided DS/QS bits in the control register | ||
1228 | * and multiply the base frequency accordingly. | ||
1229 | */ | ||
1230 | if (rate <= 48000) { | ||
1231 | if (hdspm->control_register & HDSPM_QuadSpeed) | ||
1232 | rate *= 4; | ||
1233 | else if (hdspm->control_register & | ||
1234 | HDSPM_DoubleSpeed) | ||
1235 | rate *= 2; | ||
1236 | } | ||
1220 | } | 1237 | } |
1221 | break; | 1238 | break; |
1222 | } | 1239 | } |
@@ -3415,6 +3432,91 @@ static int snd_hdspm_put_qs_wire(struct snd_kcontrol *kcontrol, | |||
3415 | return change; | 3432 | return change; |
3416 | } | 3433 | } |
3417 | 3434 | ||
3435 | #define HDSPM_MADI_SPEEDMODE(xname, xindex) \ | ||
3436 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
3437 | .name = xname, \ | ||
3438 | .index = xindex, \ | ||
3439 | .info = snd_hdspm_info_madi_speedmode, \ | ||
3440 | .get = snd_hdspm_get_madi_speedmode, \ | ||
3441 | .put = snd_hdspm_put_madi_speedmode \ | ||
3442 | } | ||
3443 | |||
3444 | static int hdspm_madi_speedmode(struct hdspm *hdspm) | ||
3445 | { | ||
3446 | if (hdspm->control_register & HDSPM_QuadSpeed) | ||
3447 | return 2; | ||
3448 | if (hdspm->control_register & HDSPM_DoubleSpeed) | ||
3449 | return 1; | ||
3450 | return 0; | ||
3451 | } | ||
3452 | |||
3453 | static int hdspm_set_madi_speedmode(struct hdspm *hdspm, int mode) | ||
3454 | { | ||
3455 | hdspm->control_register &= ~(HDSPM_DoubleSpeed | HDSPM_QuadSpeed); | ||
3456 | switch (mode) { | ||
3457 | case 0: | ||
3458 | break; | ||
3459 | case 1: | ||
3460 | hdspm->control_register |= HDSPM_DoubleSpeed; | ||
3461 | break; | ||
3462 | case 2: | ||
3463 | hdspm->control_register |= HDSPM_QuadSpeed; | ||
3464 | break; | ||
3465 | } | ||
3466 | hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register); | ||
3467 | |||
3468 | return 0; | ||
3469 | } | ||
3470 | |||
3471 | static int snd_hdspm_info_madi_speedmode(struct snd_kcontrol *kcontrol, | ||
3472 | struct snd_ctl_elem_info *uinfo) | ||
3473 | { | ||
3474 | static char *texts[] = { "Single", "Double", "Quad" }; | ||
3475 | |||
3476 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
3477 | uinfo->count = 1; | ||
3478 | uinfo->value.enumerated.items = 3; | ||
3479 | |||
3480 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | ||
3481 | uinfo->value.enumerated.item = | ||
3482 | uinfo->value.enumerated.items - 1; | ||
3483 | strcpy(uinfo->value.enumerated.name, | ||
3484 | texts[uinfo->value.enumerated.item]); | ||
3485 | |||
3486 | return 0; | ||
3487 | } | ||
3488 | |||
3489 | static int snd_hdspm_get_madi_speedmode(struct snd_kcontrol *kcontrol, | ||
3490 | struct snd_ctl_elem_value *ucontrol) | ||
3491 | { | ||
3492 | struct hdspm *hdspm = snd_kcontrol_chip(kcontrol); | ||
3493 | |||
3494 | spin_lock_irq(&hdspm->lock); | ||
3495 | ucontrol->value.enumerated.item[0] = hdspm_madi_speedmode(hdspm); | ||
3496 | spin_unlock_irq(&hdspm->lock); | ||
3497 | return 0; | ||
3498 | } | ||
3499 | |||
3500 | static int snd_hdspm_put_madi_speedmode(struct snd_kcontrol *kcontrol, | ||
3501 | struct snd_ctl_elem_value *ucontrol) | ||
3502 | { | ||
3503 | struct hdspm *hdspm = snd_kcontrol_chip(kcontrol); | ||
3504 | int change; | ||
3505 | int val; | ||
3506 | |||
3507 | if (!snd_hdspm_use_is_exclusive(hdspm)) | ||
3508 | return -EBUSY; | ||
3509 | val = ucontrol->value.integer.value[0]; | ||
3510 | if (val < 0) | ||
3511 | val = 0; | ||
3512 | if (val > 2) | ||
3513 | val = 2; | ||
3514 | spin_lock_irq(&hdspm->lock); | ||
3515 | change = val != hdspm_madi_speedmode(hdspm); | ||
3516 | hdspm_set_madi_speedmode(hdspm, val); | ||
3517 | spin_unlock_irq(&hdspm->lock); | ||
3518 | return change; | ||
3519 | } | ||
3418 | 3520 | ||
3419 | #define HDSPM_MIXER(xname, xindex) \ | 3521 | #define HDSPM_MIXER(xname, xindex) \ |
3420 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 3522 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ |
@@ -4289,7 +4391,8 @@ static struct snd_kcontrol_new snd_hdspm_controls_madi[] = { | |||
4289 | HDSPM_TX_64("TX 64 channels mode", 0), | 4391 | HDSPM_TX_64("TX 64 channels mode", 0), |
4290 | HDSPM_C_TMS("Clear Track Marker", 0), | 4392 | HDSPM_C_TMS("Clear Track Marker", 0), |
4291 | HDSPM_SAFE_MODE("Safe Mode", 0), | 4393 | HDSPM_SAFE_MODE("Safe Mode", 0), |
4292 | HDSPM_INPUT_SELECT("Input Select", 0) | 4394 | HDSPM_INPUT_SELECT("Input Select", 0), |
4395 | HDSPM_MADI_SPEEDMODE("MADI Speed Mode", 0) | ||
4293 | }; | 4396 | }; |
4294 | 4397 | ||
4295 | 4398 | ||
@@ -4302,7 +4405,8 @@ static struct snd_kcontrol_new snd_hdspm_controls_madiface[] = { | |||
4302 | HDSPM_SYNC_CHECK("MADI SyncCheck", 0), | 4405 | HDSPM_SYNC_CHECK("MADI SyncCheck", 0), |
4303 | HDSPM_TX_64("TX 64 channels mode", 0), | 4406 | HDSPM_TX_64("TX 64 channels mode", 0), |
4304 | HDSPM_C_TMS("Clear Track Marker", 0), | 4407 | HDSPM_C_TMS("Clear Track Marker", 0), |
4305 | HDSPM_SAFE_MODE("Safe Mode", 0) | 4408 | HDSPM_SAFE_MODE("Safe Mode", 0), |
4409 | HDSPM_MADI_SPEEDMODE("MADI Speed Mode", 0) | ||
4306 | }; | 4410 | }; |
4307 | 4411 | ||
4308 | static struct snd_kcontrol_new snd_hdspm_controls_aio[] = { | 4412 | static struct snd_kcontrol_new snd_hdspm_controls_aio[] = { |
@@ -6381,6 +6485,7 @@ static int __devinit snd_hdspm_create(struct snd_card *card, | |||
6381 | switch (hdspm->firmware_rev) { | 6485 | switch (hdspm->firmware_rev) { |
6382 | case HDSPM_MADI_REV: | 6486 | case HDSPM_MADI_REV: |
6383 | case HDSPM_MADI_OLD_REV: | 6487 | case HDSPM_MADI_OLD_REV: |
6488 | case HDSPM_MADI_ANCIENT_REV: | ||
6384 | hdspm->io_type = MADI; | 6489 | hdspm->io_type = MADI; |
6385 | hdspm->card_name = "RME MADI"; | 6490 | hdspm->card_name = "RME MADI"; |
6386 | hdspm->midiPorts = 3; | 6491 | hdspm->midiPorts = 3; |
diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c index 34aa972669ed..3de99af8cb82 100644 --- a/sound/soc/txx9/txx9aclc.c +++ b/sound/soc/txx9/txx9aclc.c | |||
@@ -290,6 +290,7 @@ static void txx9aclc_pcm_free_dma_buffers(struct snd_pcm *pcm) | |||
290 | 290 | ||
291 | static int txx9aclc_pcm_new(struct snd_soc_pcm_runtime *rtd) | 291 | static int txx9aclc_pcm_new(struct snd_soc_pcm_runtime *rtd) |
292 | { | 292 | { |
293 | struct snd_card *card = rtd->card->snd_card; | ||
293 | struct snd_soc_dai *dai = rtd->cpu_dai; | 294 | struct snd_soc_dai *dai = rtd->cpu_dai; |
294 | struct snd_pcm *pcm = rtd->pcm; | 295 | struct snd_pcm *pcm = rtd->pcm; |
295 | struct platform_device *pdev = to_platform_device(dai->platform->dev); | 296 | struct platform_device *pdev = to_platform_device(dai->platform->dev); |