752
775
hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD);
753
776
hdsp_write (hdsp, HDSP_fifoData, 0);
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))
784
hdsp->io_type = Multiface;
761
786
hdsp->io_type = Digiface;
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)
792
else if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1)
766
793
hdsp->io_type = Multiface;
768
795
hdsp->io_type = Digiface;
3231
3259
HDSP_USE_MIDI_TASKLET("Use Midi Tasklet", 0),
3263
static int hdsp_rpm_input12(struct hdsp *hdsp)
3265
switch (hdsp->control_register & HDSP_RPM_Inp12) {
3266
case HDSP_RPM_Inp12_Phon_6dB:
3268
case HDSP_RPM_Inp12_Phon_n6dB:
3270
case HDSP_RPM_Inp12_Line_0dB:
3272
case HDSP_RPM_Inp12_Line_n6dB:
3279
static int snd_hdsp_get_rpm_input12(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
3281
struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
3283
ucontrol->value.enumerated.item[0] = hdsp_rpm_input12(hdsp);
3288
static int hdsp_set_rpm_input12(struct hdsp *hdsp, int mode)
3290
hdsp->control_register &= ~HDSP_RPM_Inp12;
3293
hdsp->control_register |= HDSP_RPM_Inp12_Phon_6dB;
3298
hdsp->control_register |= HDSP_RPM_Inp12_Phon_n6dB;
3301
hdsp->control_register |= HDSP_RPM_Inp12_Line_0dB;
3304
hdsp->control_register |= HDSP_RPM_Inp12_Line_n6dB;
3310
hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
3315
static int snd_hdsp_put_rpm_input12(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
3317
struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
3321
if (!snd_hdsp_use_is_exclusive(hdsp))
3323
val = ucontrol->value.enumerated.item[0];
3328
spin_lock_irq(&hdsp->lock);
3329
if (val != hdsp_rpm_input12(hdsp))
3330
change = (hdsp_set_rpm_input12(hdsp, val) == 0) ? 1 : 0;
3333
spin_unlock_irq(&hdsp->lock);
3338
static int snd_hdsp_info_rpm_input(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
3340
static char *texts[] = {"Phono +6dB", "Phono 0dB", "Phono -6dB", "Line 0dB", "Line -6dB"};
3342
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
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]);
3352
static int hdsp_rpm_input34(struct hdsp *hdsp)
3354
switch (hdsp->control_register & HDSP_RPM_Inp34) {
3355
case HDSP_RPM_Inp34_Phon_6dB:
3357
case HDSP_RPM_Inp34_Phon_n6dB:
3359
case HDSP_RPM_Inp34_Line_0dB:
3361
case HDSP_RPM_Inp34_Line_n6dB:
3368
static int snd_hdsp_get_rpm_input34(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
3370
struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
3372
ucontrol->value.enumerated.item[0] = hdsp_rpm_input34(hdsp);
3377
static int hdsp_set_rpm_input34(struct hdsp *hdsp, int mode)
3379
hdsp->control_register &= ~HDSP_RPM_Inp34;
3382
hdsp->control_register |= HDSP_RPM_Inp34_Phon_6dB;
3387
hdsp->control_register |= HDSP_RPM_Inp34_Phon_n6dB;
3390
hdsp->control_register |= HDSP_RPM_Inp34_Line_0dB;
3393
hdsp->control_register |= HDSP_RPM_Inp34_Line_n6dB;
3399
hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
3404
static int snd_hdsp_put_rpm_input34(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
3406
struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
3410
if (!snd_hdsp_use_is_exclusive(hdsp))
3412
val = ucontrol->value.enumerated.item[0];
3417
spin_lock_irq(&hdsp->lock);
3418
if (val != hdsp_rpm_input34(hdsp))
3419
change = (hdsp_set_rpm_input34(hdsp, val) == 0) ? 1 : 0;
3422
spin_unlock_irq(&hdsp->lock);
3427
/* RPM Bypass switch */
3428
static int hdsp_rpm_bypass(struct hdsp *hdsp)
3430
return (hdsp->control_register & HDSP_RPM_Bypass) ? 1 : 0;
3434
static int snd_hdsp_get_rpm_bypass(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
3436
struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
3438
ucontrol->value.integer.value[0] = hdsp_rpm_bypass(hdsp);
3443
static int hdsp_set_rpm_bypass(struct hdsp *hdsp, int on)
3446
hdsp->control_register |= HDSP_RPM_Bypass;
3448
hdsp->control_register &= ~HDSP_RPM_Bypass;
3449
hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
3454
static int snd_hdsp_put_rpm_bypass(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
3456
struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
3460
if (!snd_hdsp_use_is_exclusive(hdsp))
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);
3471
static int snd_hdsp_info_rpm_bypass(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
3473
static char *texts[] = {"On", "Off"};
3475
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
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]);
3485
/* RPM Disconnect switch */
3486
static int hdsp_rpm_disconnect(struct hdsp *hdsp)
3488
return (hdsp->control_register & HDSP_RPM_Disconnect) ? 1 : 0;
3492
static int snd_hdsp_get_rpm_disconnect(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
3494
struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
3496
ucontrol->value.integer.value[0] = hdsp_rpm_disconnect(hdsp);
3501
static int hdsp_set_rpm_disconnect(struct hdsp *hdsp, int on)
3504
hdsp->control_register |= HDSP_RPM_Disconnect;
3506
hdsp->control_register &= ~HDSP_RPM_Disconnect;
3507
hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
3512
static int snd_hdsp_put_rpm_disconnect(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
3514
struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
3518
if (!snd_hdsp_use_is_exclusive(hdsp))
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);
3528
static int snd_hdsp_info_rpm_disconnect(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
3530
static char *texts[] = {"On", "Off"};
3532
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
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]);
3541
static struct snd_kcontrol_new snd_hdsp_rpm_controls[] = {
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
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
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
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
3570
HDSP_SYSTEM_SAMPLE_RATE("System Sample Rate", 0),
3571
HDSP_MIXER("Mixer", 0)
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;
3460
3810
snd_iprintf(buffer, "\n");
3462
switch (hdsp_spdif_in(hdsp)) {
3463
case HDSP_SPDIFIN_OPTICAL:
3464
snd_iprintf(buffer, "IEC958 input: Optical\n");
3466
case HDSP_SPDIFIN_COAXIAL:
3467
snd_iprintf(buffer, "IEC958 input: Coaxial\n");
3469
case HDSP_SPDIFIN_INTERNAL:
3470
snd_iprintf(buffer, "IEC958 input: Internal\n");
3472
case HDSP_SPDIFIN_AES:
3473
snd_iprintf(buffer, "IEC958 input: AES\n");
3476
snd_iprintf(buffer, "IEC958 input: ???\n");
3480
if (hdsp->control_register & HDSP_SPDIFOpticalOut)
3481
snd_iprintf(buffer, "IEC958 output: Coaxial & ADAT1\n");
3483
snd_iprintf(buffer, "IEC958 output: Coaxial only\n");
3485
if (hdsp->control_register & HDSP_SPDIFProfessional)
3486
snd_iprintf(buffer, "IEC958 quality: Professional\n");
3488
snd_iprintf(buffer, "IEC958 quality: Consumer\n");
3490
if (hdsp->control_register & HDSP_SPDIFEmphasis)
3491
snd_iprintf(buffer, "IEC958 emphasis: on\n");
3493
snd_iprintf(buffer, "IEC958 emphasis: off\n");
3495
if (hdsp->control_register & HDSP_SPDIFNonAudio)
3496
snd_iprintf(buffer, "IEC958 NonAudio: on\n");
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);
3502
snd_iprintf (buffer, "IEC958 sample rate: Error flag set\n");
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");
3817
case HDSP_SPDIFIN_COAXIAL:
3818
snd_iprintf(buffer, "IEC958 input: Coaxial\n");
3820
case HDSP_SPDIFIN_INTERNAL:
3821
snd_iprintf(buffer, "IEC958 input: Internal\n");
3823
case HDSP_SPDIFIN_AES:
3824
snd_iprintf(buffer, "IEC958 input: AES\n");
3827
snd_iprintf(buffer, "IEC958 input: ???\n");
3832
if (RPM == hdsp->io_type) {
3833
if (hdsp->control_register & HDSP_RPM_Bypass)
3834
snd_iprintf(buffer, "RPM Bypass: disabled\n");
3836
snd_iprintf(buffer, "RPM Bypass: enabled\n");
3837
if (hdsp->control_register & HDSP_RPM_Disconnect)
3838
snd_iprintf(buffer, "RPM disconnected\n");
3840
snd_iprintf(buffer, "RPM connected\n");
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");
3846
case HDSP_RPM_Inp12_Phon_0dB:
3847
snd_iprintf(buffer, "Input 1/2: Phono, 0dB\n");
3849
case HDSP_RPM_Inp12_Phon_n6dB:
3850
snd_iprintf(buffer, "Input 1/2: Phono, -6dB\n");
3852
case HDSP_RPM_Inp12_Line_0dB:
3853
snd_iprintf(buffer, "Input 1/2: Line, 0dB\n");
3855
case HDSP_RPM_Inp12_Line_n6dB:
3856
snd_iprintf(buffer, "Input 1/2: Line, -6dB\n");
3859
snd_iprintf(buffer, "Input 1/2: ???\n");
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");
3866
case HDSP_RPM_Inp34_Phon_0dB:
3867
snd_iprintf(buffer, "Input 3/4: Phono, 0dB\n");
3869
case HDSP_RPM_Inp34_Phon_n6dB:
3870
snd_iprintf(buffer, "Input 3/4: Phono, -6dB\n");
3872
case HDSP_RPM_Inp34_Line_0dB:
3873
snd_iprintf(buffer, "Input 3/4: Line, 0dB\n");
3875
case HDSP_RPM_Inp34_Line_n6dB:
3876
snd_iprintf(buffer, "Input 3/4: Line, -6dB\n");
3879
snd_iprintf(buffer, "Input 3/4: ???\n");
3883
if (hdsp->control_register & HDSP_SPDIFOpticalOut)
3884
snd_iprintf(buffer, "IEC958 output: Coaxial & ADAT1\n");
3886
snd_iprintf(buffer, "IEC958 output: Coaxial only\n");
3888
if (hdsp->control_register & HDSP_SPDIFProfessional)
3889
snd_iprintf(buffer, "IEC958 quality: Professional\n");
3891
snd_iprintf(buffer, "IEC958 quality: Consumer\n");
3893
if (hdsp->control_register & HDSP_SPDIFEmphasis)
3894
snd_iprintf(buffer, "IEC958 emphasis: on\n");
3896
snd_iprintf(buffer, "IEC958 emphasis: off\n");
3898
if (hdsp->control_register & HDSP_SPDIFNonAudio)
3899
snd_iprintf(buffer, "IEC958 NonAudio: on\n");
3901
snd_iprintf(buffer, "IEC958 NonAudio: off\n");
3902
x = hdsp_spdif_sample_rate(hdsp);
3904
snd_iprintf(buffer, "IEC958 sample rate: %d\n", x);
3906
snd_iprintf(buffer, "IEC958 sample rate: Error flag set\n");
3504
3908
snd_iprintf(buffer, "\n");
3506
3910
/* Sync Check */