~ubuntu-branches/ubuntu/precise/alsa-driver/precise

« back to all changes in this revision

Viewing changes to alsa-kernel/pci/rme9652/hdsp.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2011-02-21 18:06:40 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20110221180640-a8p2yxtvgf7xbxub
Tags: 1.0.24+dfsg-0ubuntu1
* New upstream release
* Refreshed patches:
  - distinguish_kernel_makefile_and_source_dirs.patch
  - debian_dfsg_configure.patch
* debian/control: Update Vcs-bzr field to point to new branch location

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
                "{RME HDSP-9652},"
61
61
                "{RME HDSP-9632}}");
62
62
#ifdef HDSP_FW_LOADER
 
63
MODULE_FIRMWARE("rpm_firmware.bin");
63
64
MODULE_FIRMWARE("multiface_firmware.bin");
64
65
MODULE_FIRMWARE("multiface_firmware_rev11.bin");
65
66
MODULE_FIRMWARE("digiface_firmware.bin");
81
82
#define H9632_SS_CHANNELS        12
82
83
#define H9632_DS_CHANNELS        8
83
84
#define H9632_QS_CHANNELS        4
 
85
#define RPM_CHANNELS             6
84
86
 
85
87
/* Write registers. These are defined as byte-offsets from the iobase value.
86
88
 */
191
193
#define HDSP_PhoneGain1           (1<<30)
192
194
#define HDSP_QuadSpeed            (1<<31)
193
195
 
 
196
/* RPM uses some of the registers for special purposes */
 
197
#define HDSP_RPM_Inp12            0x04A00
 
198
#define HDSP_RPM_Inp12_Phon_6dB   0x00800  /* Dolby */
 
199
#define HDSP_RPM_Inp12_Phon_0dB   0x00000  /* .. */
 
200
#define HDSP_RPM_Inp12_Phon_n6dB  0x04000  /* inp_0 */
 
201
#define HDSP_RPM_Inp12_Line_0dB   0x04200  /* Dolby+PRO */
 
202
#define HDSP_RPM_Inp12_Line_n6dB  0x00200  /* PRO */
 
203
 
 
204
#define HDSP_RPM_Inp34            0x32000
 
205
#define HDSP_RPM_Inp34_Phon_6dB   0x20000  /* SyncRef1 */
 
206
#define HDSP_RPM_Inp34_Phon_0dB   0x00000  /* .. */
 
207
#define HDSP_RPM_Inp34_Phon_n6dB  0x02000  /* SyncRef2 */
 
208
#define HDSP_RPM_Inp34_Line_0dB   0x30000  /* SyncRef1+SyncRef0 */
 
209
#define HDSP_RPM_Inp34_Line_n6dB  0x10000  /* SyncRef0 */
 
210
 
 
211
#define HDSP_RPM_Bypass           0x01000
 
212
 
 
213
#define HDSP_RPM_Disconnect       0x00001
 
214
 
194
215
#define HDSP_ADGainMask       (HDSP_ADGain0|HDSP_ADGain1)
195
216
#define HDSP_ADGainMinus10dBV  HDSP_ADGainMask
196
217
#define HDSP_ADGainPlus4dBu   (HDSP_ADGain0)
450
471
        u32                   creg_spdif;
451
472
        u32                   creg_spdif_stream;
452
473
        int                   clock_source_locked;
453
 
        char                 *card_name;             /* digiface/multiface */
 
474
        char                 *card_name;         /* digiface/multiface/rpm */
454
475
        enum HDSP_IO_Type     io_type;               /* ditto, but for code use */
455
476
        unsigned short        firmware_rev;
456
477
        unsigned short        state;                 /* stores state bits */
612
633
        switch (hdsp->io_type) {
613
634
        case Multiface:
614
635
        case Digiface:
 
636
        case RPM:
615
637
        default:
616
638
                if (hdsp->firmware_rev == 0xa)
617
639
                        return (64 * out) + (32 + (in));
629
651
        switch (hdsp->io_type) {
630
652
        case Multiface:
631
653
        case Digiface:
 
654
        case RPM:
632
655
        default:
633
656
                if (hdsp->firmware_rev == 0xa)
634
657
                        return (64 * out) + in;
655
678
{
656
679
        if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return 0;
657
680
        if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_ConfigError) {
658
 
                snd_printk ("Hammerfall-DSP: no Digiface or Multiface connected!\n");
 
681
                snd_printk("Hammerfall-DSP: no IO box connected!\n");
659
682
                hdsp->state &= ~HDSP_FirmwareLoaded;
660
683
                return -EIO;
661
684
        }
680
703
                }
681
704
        }
682
705
 
683
 
        snd_printk("Hammerfall-DSP: no Digiface or Multiface connected!\n");
 
706
        snd_printk("Hammerfall-DSP: no IO box connected!\n");
684
707
        hdsp->state &= ~HDSP_FirmwareLoaded;
685
708
        return -EIO;
686
709
}
752
775
                hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD);
753
776
                hdsp_write (hdsp, HDSP_fifoData, 0);
754
777
 
755
 
                if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT)) {
756
 
                        hdsp->io_type = Multiface;
757
 
                        hdsp_write (hdsp, HDSP_control2Reg, HDSP_VERSION_BIT);
758
 
                        hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD);
759
 
                        hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT);
 
778
                if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT)) {
 
779
                        hdsp_write(hdsp, HDSP_control2Reg, HDSP_VERSION_BIT);
 
780
                        hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD);
 
781
                        if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT))
 
782
                                hdsp->io_type = RPM;
 
783
                        else
 
784
                                hdsp->io_type = Multiface;
760
785
                } else {
761
786
                        hdsp->io_type = Digiface;
762
787
                }
763
788
        } else {
764
789
                /* firmware was already loaded, get iobox type */
765
 
                if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1)
 
790
                if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version2)
 
791
                        hdsp->io_type = RPM;
 
792
                else if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1)
766
793
                        hdsp->io_type = Multiface;
767
794
                else
768
795
                        hdsp->io_type = Digiface;
1184
1211
                        hdsp->channel_map = channel_map_ds;
1185
1212
        } else {
1186
1213
                switch (hdsp->io_type) {
 
1214
                case RPM:
1187
1215
                case Multiface:
1188
1216
                        hdsp->channel_map = channel_map_mf_ss;
1189
1217
                        break;
3231
3259
HDSP_USE_MIDI_TASKLET("Use Midi Tasklet", 0),
3232
3260
};
3233
3261
 
 
3262
 
 
3263
static int hdsp_rpm_input12(struct hdsp *hdsp)
 
3264
{
 
3265
        switch (hdsp->control_register & HDSP_RPM_Inp12) {
 
3266
        case HDSP_RPM_Inp12_Phon_6dB:
 
3267
                return 0;
 
3268
        case HDSP_RPM_Inp12_Phon_n6dB:
 
3269
                return 2;
 
3270
        case HDSP_RPM_Inp12_Line_0dB:
 
3271
                return 3;
 
3272
        case HDSP_RPM_Inp12_Line_n6dB:
 
3273
                return 4;
 
3274
        }
 
3275
        return 1;
 
3276
}
 
3277
 
 
3278
 
 
3279
static int snd_hdsp_get_rpm_input12(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 
3280
{
 
3281
        struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
 
3282
 
 
3283
        ucontrol->value.enumerated.item[0] = hdsp_rpm_input12(hdsp);
 
3284
        return 0;
 
3285
}
 
3286
 
 
3287
 
 
3288
static int hdsp_set_rpm_input12(struct hdsp *hdsp, int mode)
 
3289
{
 
3290
        hdsp->control_register &= ~HDSP_RPM_Inp12;
 
3291
        switch (mode) {
 
3292
        case 0:
 
3293
                hdsp->control_register |= HDSP_RPM_Inp12_Phon_6dB;
 
3294
                break;
 
3295
        case 1:
 
3296
                break;
 
3297
        case 2:
 
3298
                hdsp->control_register |= HDSP_RPM_Inp12_Phon_n6dB;
 
3299
                break;
 
3300
        case 3:
 
3301
                hdsp->control_register |= HDSP_RPM_Inp12_Line_0dB;
 
3302
                break;
 
3303
        case 4:
 
3304
                hdsp->control_register |= HDSP_RPM_Inp12_Line_n6dB;
 
3305
                break;
 
3306
        default:
 
3307
                return -1;
 
3308
        }
 
3309
 
 
3310
        hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
 
3311
        return 0;
 
3312
}
 
3313
 
 
3314
 
 
3315
static int snd_hdsp_put_rpm_input12(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 
3316
{
 
3317
        struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
 
3318
        int change;
 
3319
        int val;
 
3320
 
 
3321
        if (!snd_hdsp_use_is_exclusive(hdsp))
 
3322
                return -EBUSY;
 
3323
        val = ucontrol->value.enumerated.item[0];
 
3324
        if (val < 0)
 
3325
                val = 0;
 
3326
        if (val > 4)
 
3327
                val = 4;
 
3328
        spin_lock_irq(&hdsp->lock);
 
3329
        if (val != hdsp_rpm_input12(hdsp))
 
3330
                change = (hdsp_set_rpm_input12(hdsp, val) == 0) ? 1 : 0;
 
3331
        else
 
3332
                change = 0;
 
3333
        spin_unlock_irq(&hdsp->lock);
 
3334
        return change;
 
3335
}
 
3336
 
 
3337
 
 
3338
static int snd_hdsp_info_rpm_input(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 
3339
{
 
3340
        static char *texts[] = {"Phono +6dB", "Phono 0dB", "Phono -6dB", "Line 0dB", "Line -6dB"};
 
3341
 
 
3342
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
 
3343
        uinfo->count = 1;
 
3344
        uinfo->value.enumerated.items = 5;
 
3345
        if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
 
3346
                uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
 
3347
        strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
 
3348
        return 0;
 
3349
}
 
3350
 
 
3351
 
 
3352
static int hdsp_rpm_input34(struct hdsp *hdsp)
 
3353
{
 
3354
        switch (hdsp->control_register & HDSP_RPM_Inp34) {
 
3355
        case HDSP_RPM_Inp34_Phon_6dB:
 
3356
                return 0;
 
3357
        case HDSP_RPM_Inp34_Phon_n6dB:
 
3358
                return 2;
 
3359
        case HDSP_RPM_Inp34_Line_0dB:
 
3360
                return 3;
 
3361
        case HDSP_RPM_Inp34_Line_n6dB:
 
3362
                return 4;
 
3363
        }
 
3364
        return 1;
 
3365
}
 
3366
 
 
3367
 
 
3368
static int snd_hdsp_get_rpm_input34(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 
3369
{
 
3370
        struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
 
3371
 
 
3372
        ucontrol->value.enumerated.item[0] = hdsp_rpm_input34(hdsp);
 
3373
        return 0;
 
3374
}
 
3375
 
 
3376
 
 
3377
static int hdsp_set_rpm_input34(struct hdsp *hdsp, int mode)
 
3378
{
 
3379
        hdsp->control_register &= ~HDSP_RPM_Inp34;
 
3380
        switch (mode) {
 
3381
        case 0:
 
3382
                hdsp->control_register |= HDSP_RPM_Inp34_Phon_6dB;
 
3383
                break;
 
3384
        case 1:
 
3385
                break;
 
3386
        case 2:
 
3387
                hdsp->control_register |= HDSP_RPM_Inp34_Phon_n6dB;
 
3388
                break;
 
3389
        case 3:
 
3390
                hdsp->control_register |= HDSP_RPM_Inp34_Line_0dB;
 
3391
                break;
 
3392
        case 4:
 
3393
                hdsp->control_register |= HDSP_RPM_Inp34_Line_n6dB;
 
3394
                break;
 
3395
        default:
 
3396
                return -1;
 
3397
        }
 
3398
 
 
3399
        hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
 
3400
        return 0;
 
3401
}
 
3402
 
 
3403
 
 
3404
static int snd_hdsp_put_rpm_input34(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 
3405
{
 
3406
        struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
 
3407
        int change;
 
3408
        int val;
 
3409
 
 
3410
        if (!snd_hdsp_use_is_exclusive(hdsp))
 
3411
                return -EBUSY;
 
3412
        val = ucontrol->value.enumerated.item[0];
 
3413
        if (val < 0)
 
3414
                val = 0;
 
3415
        if (val > 4)
 
3416
                val = 4;
 
3417
        spin_lock_irq(&hdsp->lock);
 
3418
        if (val != hdsp_rpm_input34(hdsp))
 
3419
                change = (hdsp_set_rpm_input34(hdsp, val) == 0) ? 1 : 0;
 
3420
        else
 
3421
                change = 0;
 
3422
        spin_unlock_irq(&hdsp->lock);
 
3423
        return change;
 
3424
}
 
3425
 
 
3426
 
 
3427
/* RPM Bypass switch */
 
3428
static int hdsp_rpm_bypass(struct hdsp *hdsp)
 
3429
{
 
3430
        return (hdsp->control_register & HDSP_RPM_Bypass) ? 1 : 0;
 
3431
}
 
3432
 
 
3433
 
 
3434
static int snd_hdsp_get_rpm_bypass(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 
3435
{
 
3436
        struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
 
3437
 
 
3438
        ucontrol->value.integer.value[0] = hdsp_rpm_bypass(hdsp);
 
3439
        return 0;
 
3440
}
 
3441
 
 
3442
 
 
3443
static int hdsp_set_rpm_bypass(struct hdsp *hdsp, int on)
 
3444
{
 
3445
        if (on)
 
3446
                hdsp->control_register |= HDSP_RPM_Bypass;
 
3447
        else
 
3448
                hdsp->control_register &= ~HDSP_RPM_Bypass;
 
3449
        hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
 
3450
        return 0;
 
3451
}
 
3452
 
 
3453
 
 
3454
static int snd_hdsp_put_rpm_bypass(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 
3455
{
 
3456
        struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
 
3457
        int change;
 
3458
        unsigned int val;
 
3459
 
 
3460
        if (!snd_hdsp_use_is_exclusive(hdsp))
 
3461
                return -EBUSY;
 
3462
        val = ucontrol->value.integer.value[0] & 1;
 
3463
        spin_lock_irq(&hdsp->lock);
 
3464
        change = (int)val != hdsp_rpm_bypass(hdsp);
 
3465
        hdsp_set_rpm_bypass(hdsp, val);
 
3466
        spin_unlock_irq(&hdsp->lock);
 
3467
        return change;
 
3468
}
 
3469
 
 
3470
 
 
3471
static int snd_hdsp_info_rpm_bypass(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 
3472
{
 
3473
        static char *texts[] = {"On", "Off"};
 
3474
 
 
3475
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
 
3476
        uinfo->count = 1;
 
3477
        uinfo->value.enumerated.items = 2;
 
3478
        if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
 
3479
                uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
 
3480
        strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
 
3481
        return 0;
 
3482
}
 
3483
 
 
3484
 
 
3485
/* RPM Disconnect switch */
 
3486
static int hdsp_rpm_disconnect(struct hdsp *hdsp)
 
3487
{
 
3488
        return (hdsp->control_register & HDSP_RPM_Disconnect) ? 1 : 0;
 
3489
}
 
3490
 
 
3491
 
 
3492
static int snd_hdsp_get_rpm_disconnect(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 
3493
{
 
3494
        struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
 
3495
 
 
3496
        ucontrol->value.integer.value[0] = hdsp_rpm_disconnect(hdsp);
 
3497
        return 0;
 
3498
}
 
3499
 
 
3500
 
 
3501
static int hdsp_set_rpm_disconnect(struct hdsp *hdsp, int on)
 
3502
{
 
3503
        if (on)
 
3504
                hdsp->control_register |= HDSP_RPM_Disconnect;
 
3505
        else
 
3506
                hdsp->control_register &= ~HDSP_RPM_Disconnect;
 
3507
        hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
 
3508
        return 0;
 
3509
}
 
3510
 
 
3511
 
 
3512
static int snd_hdsp_put_rpm_disconnect(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 
3513
{
 
3514
        struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
 
3515
        int change;
 
3516
        unsigned int val;
 
3517
 
 
3518
        if (!snd_hdsp_use_is_exclusive(hdsp))
 
3519
                return -EBUSY;
 
3520
        val = ucontrol->value.integer.value[0] & 1;
 
3521
        spin_lock_irq(&hdsp->lock);
 
3522
        change = (int)val != hdsp_rpm_disconnect(hdsp);
 
3523
        hdsp_set_rpm_disconnect(hdsp, val);
 
3524
        spin_unlock_irq(&hdsp->lock);
 
3525
        return change;
 
3526
}
 
3527
 
 
3528
static int snd_hdsp_info_rpm_disconnect(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 
3529
{
 
3530
        static char *texts[] = {"On", "Off"};
 
3531
 
 
3532
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
 
3533
        uinfo->count = 1;
 
3534
        uinfo->value.enumerated.items = 2;
 
3535
        if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
 
3536
                uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
 
3537
        strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
 
3538
        return 0;
 
3539
}
 
3540
 
 
3541
static struct snd_kcontrol_new snd_hdsp_rpm_controls[] = {
 
3542
        {
 
3543
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 
3544
                .name = "RPM Bypass",
 
3545
                .get = snd_hdsp_get_rpm_bypass,
 
3546
                .put = snd_hdsp_put_rpm_bypass,
 
3547
                .info = snd_hdsp_info_rpm_bypass
 
3548
        },
 
3549
        {
 
3550
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 
3551
                .name = "RPM Disconnect",
 
3552
                .get = snd_hdsp_get_rpm_disconnect,
 
3553
                .put = snd_hdsp_put_rpm_disconnect,
 
3554
                .info = snd_hdsp_info_rpm_disconnect
 
3555
        },
 
3556
        {
 
3557
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 
3558
                .name = "Input 1/2",
 
3559
                .get = snd_hdsp_get_rpm_input12,
 
3560
                .put = snd_hdsp_put_rpm_input12,
 
3561
                .info = snd_hdsp_info_rpm_input
 
3562
        },
 
3563
        {
 
3564
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 
3565
                .name = "Input 3/4",
 
3566
                .get = snd_hdsp_get_rpm_input34,
 
3567
                .put = snd_hdsp_put_rpm_input34,
 
3568
                .info = snd_hdsp_info_rpm_input
 
3569
        },
 
3570
        HDSP_SYSTEM_SAMPLE_RATE("System Sample Rate", 0),
 
3571
        HDSP_MIXER("Mixer", 0)
 
3572
};
 
3573
 
3234
3574
static struct snd_kcontrol_new snd_hdsp_96xx_aeb = HDSP_AEB("Analog Extension Board", 0);
3235
3575
static struct snd_kcontrol_new snd_hdsp_adat_sync_check = HDSP_ADAT_SYNC_CHECK;
3236
3576
 
3240
3580
        int err;
3241
3581
        struct snd_kcontrol *kctl;
3242
3582
 
 
3583
        if (hdsp->io_type == RPM) {
 
3584
                /* RPM Bypass, Disconnect and Input switches */
 
3585
                for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_rpm_controls); idx++) {
 
3586
                        err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_rpm_controls[idx], hdsp));
 
3587
                        if (err < 0)
 
3588
                                return err;
 
3589
                }
 
3590
                return 0;
 
3591
        }
 
3592
 
3243
3593
        for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_controls); idx++) {
3244
3594
                if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp))) < 0)
3245
3595
                        return err;
3284
3634
static void
3285
3635
snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3286
3636
{
3287
 
        struct hdsp *hdsp = (struct hdsp *) entry->private_data;
 
3637
        struct hdsp *hdsp = entry->private_data;
3288
3638
        unsigned int status;
3289
3639
        unsigned int status2;
3290
3640
        char *pref_sync_ref;
3459
3809
 
3460
3810
        snd_iprintf(buffer, "\n");
3461
3811
 
3462
 
        switch (hdsp_spdif_in(hdsp)) {
3463
 
        case HDSP_SPDIFIN_OPTICAL:
3464
 
                snd_iprintf(buffer, "IEC958 input: Optical\n");
3465
 
                break;
3466
 
        case HDSP_SPDIFIN_COAXIAL:
3467
 
                snd_iprintf(buffer, "IEC958 input: Coaxial\n");
3468
 
                break;
3469
 
        case HDSP_SPDIFIN_INTERNAL:
3470
 
                snd_iprintf(buffer, "IEC958 input: Internal\n");
3471
 
                break;
3472
 
        case HDSP_SPDIFIN_AES:
3473
 
                snd_iprintf(buffer, "IEC958 input: AES\n");
3474
 
                break;
3475
 
        default:
3476
 
                snd_iprintf(buffer, "IEC958 input: ???\n");
3477
 
                break;
3478
 
        }
3479
 
 
3480
 
        if (hdsp->control_register & HDSP_SPDIFOpticalOut)
3481
 
                snd_iprintf(buffer, "IEC958 output: Coaxial & ADAT1\n");
3482
 
        else
3483
 
                snd_iprintf(buffer, "IEC958 output: Coaxial only\n");
3484
 
 
3485
 
        if (hdsp->control_register & HDSP_SPDIFProfessional)
3486
 
                snd_iprintf(buffer, "IEC958 quality: Professional\n");
3487
 
        else
3488
 
                snd_iprintf(buffer, "IEC958 quality: Consumer\n");
3489
 
 
3490
 
        if (hdsp->control_register & HDSP_SPDIFEmphasis)
3491
 
                snd_iprintf(buffer, "IEC958 emphasis: on\n");
3492
 
        else
3493
 
                snd_iprintf(buffer, "IEC958 emphasis: off\n");
3494
 
 
3495
 
        if (hdsp->control_register & HDSP_SPDIFNonAudio)
3496
 
                snd_iprintf(buffer, "IEC958 NonAudio: on\n");
3497
 
        else
3498
 
                snd_iprintf(buffer, "IEC958 NonAudio: off\n");
3499
 
        if ((x = hdsp_spdif_sample_rate (hdsp)) != 0)
3500
 
                snd_iprintf (buffer, "IEC958 sample rate: %d\n", x);
3501
 
        else
3502
 
                snd_iprintf (buffer, "IEC958 sample rate: Error flag set\n");
3503
 
 
 
3812
        if (hdsp->io_type != RPM) {
 
3813
                switch (hdsp_spdif_in(hdsp)) {
 
3814
                case HDSP_SPDIFIN_OPTICAL:
 
3815
                        snd_iprintf(buffer, "IEC958 input: Optical\n");
 
3816
                        break;
 
3817
                case HDSP_SPDIFIN_COAXIAL:
 
3818
                        snd_iprintf(buffer, "IEC958 input: Coaxial\n");
 
3819
                        break;
 
3820
                case HDSP_SPDIFIN_INTERNAL:
 
3821
                        snd_iprintf(buffer, "IEC958 input: Internal\n");
 
3822
                        break;
 
3823
                case HDSP_SPDIFIN_AES:
 
3824
                        snd_iprintf(buffer, "IEC958 input: AES\n");
 
3825
                        break;
 
3826
                default:
 
3827
                        snd_iprintf(buffer, "IEC958 input: ???\n");
 
3828
                        break;
 
3829
                }
 
3830
        }
 
3831
 
 
3832
        if (RPM == hdsp->io_type) {
 
3833
                if (hdsp->control_register & HDSP_RPM_Bypass)
 
3834
                        snd_iprintf(buffer, "RPM Bypass: disabled\n");
 
3835
                else
 
3836
                        snd_iprintf(buffer, "RPM Bypass: enabled\n");
 
3837
                if (hdsp->control_register & HDSP_RPM_Disconnect)
 
3838
                        snd_iprintf(buffer, "RPM disconnected\n");
 
3839
                else
 
3840
                        snd_iprintf(buffer, "RPM connected\n");
 
3841
 
 
3842
                switch (hdsp->control_register & HDSP_RPM_Inp12) {
 
3843
                case HDSP_RPM_Inp12_Phon_6dB:
 
3844
                        snd_iprintf(buffer, "Input 1/2: Phono, 6dB\n");
 
3845
                        break;
 
3846
                case HDSP_RPM_Inp12_Phon_0dB:
 
3847
                        snd_iprintf(buffer, "Input 1/2: Phono, 0dB\n");
 
3848
                        break;
 
3849
                case HDSP_RPM_Inp12_Phon_n6dB:
 
3850
                        snd_iprintf(buffer, "Input 1/2: Phono, -6dB\n");
 
3851
                        break;
 
3852
                case HDSP_RPM_Inp12_Line_0dB:
 
3853
                        snd_iprintf(buffer, "Input 1/2: Line, 0dB\n");
 
3854
                        break;
 
3855
                case HDSP_RPM_Inp12_Line_n6dB:
 
3856
                        snd_iprintf(buffer, "Input 1/2: Line, -6dB\n");
 
3857
                        break;
 
3858
                default:
 
3859
                        snd_iprintf(buffer, "Input 1/2: ???\n");
 
3860
                }
 
3861
 
 
3862
                switch (hdsp->control_register & HDSP_RPM_Inp34) {
 
3863
                case HDSP_RPM_Inp34_Phon_6dB:
 
3864
                        snd_iprintf(buffer, "Input 3/4: Phono, 6dB\n");
 
3865
                        break;
 
3866
                case HDSP_RPM_Inp34_Phon_0dB:
 
3867
                        snd_iprintf(buffer, "Input 3/4: Phono, 0dB\n");
 
3868
                        break;
 
3869
                case HDSP_RPM_Inp34_Phon_n6dB:
 
3870
                        snd_iprintf(buffer, "Input 3/4: Phono, -6dB\n");
 
3871
                        break;
 
3872
                case HDSP_RPM_Inp34_Line_0dB:
 
3873
                        snd_iprintf(buffer, "Input 3/4: Line, 0dB\n");
 
3874
                        break;
 
3875
                case HDSP_RPM_Inp34_Line_n6dB:
 
3876
                        snd_iprintf(buffer, "Input 3/4: Line, -6dB\n");
 
3877
                        break;
 
3878
                default:
 
3879
                        snd_iprintf(buffer, "Input 3/4: ???\n");
 
3880
                }
 
3881
 
 
3882
        } else {
 
3883
                if (hdsp->control_register & HDSP_SPDIFOpticalOut)
 
3884
                        snd_iprintf(buffer, "IEC958 output: Coaxial & ADAT1\n");
 
3885
                else
 
3886
                        snd_iprintf(buffer, "IEC958 output: Coaxial only\n");
 
3887
 
 
3888
                if (hdsp->control_register & HDSP_SPDIFProfessional)
 
3889
                        snd_iprintf(buffer, "IEC958 quality: Professional\n");
 
3890
                else
 
3891
                        snd_iprintf(buffer, "IEC958 quality: Consumer\n");
 
3892
 
 
3893
                if (hdsp->control_register & HDSP_SPDIFEmphasis)
 
3894
                        snd_iprintf(buffer, "IEC958 emphasis: on\n");
 
3895
                else
 
3896
                        snd_iprintf(buffer, "IEC958 emphasis: off\n");
 
3897
 
 
3898
                if (hdsp->control_register & HDSP_SPDIFNonAudio)
 
3899
                        snd_iprintf(buffer, "IEC958 NonAudio: on\n");
 
3900
                else
 
3901
                        snd_iprintf(buffer, "IEC958 NonAudio: off\n");
 
3902
                x = hdsp_spdif_sample_rate(hdsp);
 
3903
                if (x != 0)
 
3904
                        snd_iprintf(buffer, "IEC958 sample rate: %d\n", x);
 
3905
                else
 
3906
                        snd_iprintf(buffer, "IEC958 sample rate: Error flag set\n");
 
3907
        }
3504
3908
        snd_iprintf(buffer, "\n");
3505
3909
 
3506
3910
        /* Sync Check */
3765
4169
                        snd_hdsp_midi_input_read (&hdsp->midi[0]);
3766
4170
                }
3767
4171
        }
3768
 
        if (hdsp->io_type != Multiface && hdsp->io_type != H9632 && midi1 && midi1status) {
 
4172
        if (hdsp->io_type != Multiface && hdsp->io_type != RPM && hdsp->io_type != H9632 && midi1 && midi1status) {
3769
4173
                if (hdsp->use_midi_tasklet) {
3770
4174
                        /* we disable interrupts for this input until processing is done */
3771
4175
                        hdsp->control_register &= ~HDSP_Midi1InterruptEnable;
4093
4497
                                 SNDRV_PCM_RATE_96000),
4094
4498
        .rate_min =             32000,
4095
4499
        .rate_max =             96000,
4096
 
        .channels_min =         14,
 
4500
        .channels_min =         6,
4097
4501
        .channels_max =         HDSP_MAX_CHANNELS,
4098
4502
        .buffer_bytes_max =     HDSP_CHANNEL_BUFFER_BYTES * HDSP_MAX_CHANNELS,
4099
4503
        .period_bytes_min =     (64 * 4) * 10,
4122
4526
                                 SNDRV_PCM_RATE_96000),
4123
4527
        .rate_min =             32000,
4124
4528
        .rate_max =             96000,
4125
 
        .channels_min =         14,
 
4529
        .channels_min =         5,
4126
4530
        .channels_max =         HDSP_MAX_CHANNELS,
4127
4531
        .buffer_bytes_max =     HDSP_CHANNEL_BUFFER_BYTES * HDSP_MAX_CHANNELS,
4128
4532
        .period_bytes_min =     (64 * 4) * 10,
4357
4761
                             snd_hdsp_hw_rule_rate_out_channels, hdsp,
4358
4762
                             SNDRV_PCM_HW_PARAM_CHANNELS, -1);
4359
4763
 
4360
 
        hdsp->creg_spdif_stream = hdsp->creg_spdif;
4361
 
        hdsp->spdif_ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
4362
 
        snd_ctl_notify(hdsp->card, SNDRV_CTL_EVENT_MASK_VALUE |
4363
 
                       SNDRV_CTL_EVENT_MASK_INFO, &hdsp->spdif_ctl->id);
 
4764
        if (RPM != hdsp->io_type) {
 
4765
                hdsp->creg_spdif_stream = hdsp->creg_spdif;
 
4766
                hdsp->spdif_ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
 
4767
                snd_ctl_notify(hdsp->card, SNDRV_CTL_EVENT_MASK_VALUE |
 
4768
                        SNDRV_CTL_EVENT_MASK_INFO, &hdsp->spdif_ctl->id);
 
4769
        }
4364
4770
        return 0;
4365
4771
}
4366
4772
 
4375
4781
 
4376
4782
        spin_unlock_irq(&hdsp->lock);
4377
4783
 
4378
 
        hdsp->spdif_ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
4379
 
        snd_ctl_notify(hdsp->card, SNDRV_CTL_EVENT_MASK_VALUE |
4380
 
                       SNDRV_CTL_EVENT_MASK_INFO, &hdsp->spdif_ctl->id);
 
4784
        if (RPM != hdsp->io_type) {
 
4785
                hdsp->spdif_ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
 
4786
                snd_ctl_notify(hdsp->card, SNDRV_CTL_EVENT_MASK_VALUE |
 
4787
                        SNDRV_CTL_EVENT_MASK_INFO, &hdsp->spdif_ctl->id);
 
4788
        }
4381
4789
        return 0;
4382
4790
}
4383
4791
 
4566
4974
 
4567
4975
static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigned int cmd, unsigned long arg)
4568
4976
{
4569
 
        struct hdsp *hdsp = (struct hdsp *)hw->private_data;
 
4977
        struct hdsp *hdsp = hw->private_data;
4570
4978
        void __user *argp = (void __user *)arg;
4571
4979
        int err;
4572
4980
 
4609
5017
                if (err < 0)
4610
5018
                        return err;
4611
5019
 
 
5020
                memset(&info, 0, sizeof(info));
4612
5021
                spin_lock_irqsave(&hdsp->lock, flags);
4613
5022
                info.pref_sync_ref = (unsigned char)hdsp_pref_sync_ref(hdsp);
4614
5023
                info.wordclock_sync_check = (unsigned char)hdsp_wc_sync_check(hdsp);
4615
5024
                if (hdsp->io_type != H9632)
4616
5025
                    info.adatsync_sync_check = (unsigned char)hdsp_adatsync_sync_check(hdsp);
4617
5026
                info.spdif_sync_check = (unsigned char)hdsp_spdif_sync_check(hdsp);
4618
 
                for (i = 0; i < ((hdsp->io_type != Multiface && hdsp->io_type != H9632) ? 3 : 1); ++i)
 
5027
                for (i = 0; i < ((hdsp->io_type != Multiface && hdsp->io_type != RPM && hdsp->io_type != H9632) ? 3 : 1); ++i)
4619
5028
                        info.adat_sync_check[i] = (unsigned char)hdsp_adat_sync_check(hdsp, i);
4620
5029
                info.spdif_in = (unsigned char)hdsp_spdif_in(hdsp);
4621
5030
                info.spdif_out = (unsigned char)hdsp_spdif_out(hdsp);
4635
5044
                        info.phone_gain = (unsigned char)hdsp_phone_gain(hdsp);
4636
5045
                        info.xlr_breakout_cable = (unsigned char)hdsp_xlr_breakout_cable(hdsp);
4637
5046
 
 
5047
                } else if (hdsp->io_type == RPM) {
 
5048
                        info.da_gain = (unsigned char) hdsp_rpm_input12(hdsp);
 
5049
                        info.ad_gain = (unsigned char) hdsp_rpm_input34(hdsp);
4638
5050
                }
4639
5051
                if (hdsp->io_type == H9632 || hdsp->io_type == H9652)
4640
5052
                        info.analog_extension_board = (unsigned char)hdsp_aeb(hdsp);
4843
5255
                hdsp->ds_in_channels = hdsp->ds_out_channels = MULTIFACE_DS_CHANNELS;
4844
5256
                break;
4845
5257
 
 
5258
        case RPM:
 
5259
                hdsp->card_name = "RME Hammerfall DSP + RPM";
 
5260
                hdsp->ss_in_channels = RPM_CHANNELS-1;
 
5261
                hdsp->ss_out_channels = RPM_CHANNELS;
 
5262
                hdsp->ds_in_channels = RPM_CHANNELS-1;
 
5263
                hdsp->ds_out_channels = RPM_CHANNELS;
 
5264
                break;
 
5265
 
4846
5266
        default:
4847
5267
                /* should never get here */
4848
5268
                break;
4929
5349
 
4930
5350
        /* caution: max length of firmware filename is 30! */
4931
5351
        switch (hdsp->io_type) {
 
5352
        case RPM:
 
5353
                fwfile = "rpm_firmware.bin";
 
5354
                break;
4932
5355
        case Multiface:
4933
5356
                if (hdsp->firmware_rev == 0xa)
4934
5357
                        fwfile = "multiface_firmware.bin";
5099
5522
                        return 0;
5100
5523
                } else {
5101
5524
                        snd_printk(KERN_INFO "Hammerfall-DSP: Firmware already present, initializing card.\n");
5102
 
                        if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1)
 
5525
                        if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version2)
 
5526
                                hdsp->io_type = RPM;
 
5527
                        else if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1)
5103
5528
                                hdsp->io_type = Multiface;
5104
5529
                        else
5105
5530
                                hdsp->io_type = Digiface;
5155
5580
 
5156
5581
static void snd_hdsp_card_free(struct snd_card *card)
5157
5582
{
5158
 
        struct hdsp *hdsp = (struct hdsp *) card->private_data;
 
5583
        struct hdsp *hdsp = card->private_data;
5159
5584
 
5160
5585
        if (hdsp)
5161
5586
                snd_hdsp_free(hdsp);
5181
5606
        if (err < 0)
5182
5607
                return err;
5183
5608
 
5184
 
        hdsp = (struct hdsp *) card->private_data;
 
5609
        hdsp = card->private_data;
5185
5610
        card->private_free = snd_hdsp_card_free;
5186
5611
        hdsp->dev = dev;
5187
5612
        hdsp->pci = pci;