388 |
hwwrite(vortex->mmio, 0x2b440, 0xf000); |
hwwrite(vortex->mmio, 0x2b440, 0xf000); |
389 |
} |
} |
390 |
|
|
391 |
|
/* Reset (zero) buffers */ |
392 |
void vortex_EqHw_ZeroIO(vortex_t *vortex) { |
void vortex_EqHw_ZeroIO(vortex_t *vortex) { |
393 |
int i; |
int i; |
394 |
for (i=0; i<0x8; i++) |
for (i=0; i<0x8; i++) |
395 |
hwwrite(vortex->mmio, 0x2b410 + (i<<2), 0x0); |
hwwrite(vortex->mmio, 0x2b410 + (i<<2), 0x0); |
396 |
for (i=0; i<0x4; i++) |
for (i=0; i<0x4; i++) |
397 |
hwwrite(vortex->mmio, 0x2b430 + (i<<2), 0x0); |
hwwrite(vortex->mmio, 0x2b430 + (i<<2), 0x0); |
|
|
|
398 |
} |
} |
399 |
|
|
400 |
void vortex_EqHw_ZeroA3DIO(vortex_t *vortex) { |
void vortex_EqHw_ZeroA3DIO(vortex_t *vortex) { |
426 |
vortex_EqHw_SetLevels(vortex, (u16*)eq_levels); |
vortex_EqHw_SetLevels(vortex, (u16*)eq_levels); |
427 |
} |
} |
428 |
|
|
429 |
|
/* Program coeficients as pass through */ |
430 |
void vortex_EqHw_ProgramPipe(vortex_t *vortex) { |
void vortex_EqHw_ProgramPipe(vortex_t *vortex) { |
431 |
vortex_EqHw_SetTimeConsts(vortex, 0, 0); |
vortex_EqHw_SetTimeConsts(vortex, 0, 0); |
432 |
|
|
438 |
vortex_EqHw_SetLeftGainsTarget(vortex, eq_gains_current); |
vortex_EqHw_SetLeftGainsTarget(vortex, eq_gains_current); |
439 |
vortex_EqHw_SetRightGainsTarget(vortex, eq_gains_current); |
vortex_EqHw_SetRightGainsTarget(vortex, eq_gains_current); |
440 |
} |
} |
441 |
|
/* Program EQ block as 10 band Equalizer */ |
442 |
void vortex_EqHw_Program10Band(vortex_t *vortex, auxxEqCoeffSet_t *coefset) { |
void vortex_EqHw_Program10Band(vortex_t *vortex, auxxEqCoeffSet_t *coefset) { |
443 |
|
|
444 |
vortex_EqHw_SetTimeConsts(vortex, 0xc, 0x7fe0); |
vortex_EqHw_SetTimeConsts(vortex, 0xc, 0x7fe0); |
455 |
} |
} |
456 |
|
|
457 |
|
|
458 |
|
void vortex_EqHw_GetTenBandLevels(vortex_t *vortex, u16 peaks[]) { |
459 |
|
eqhw_t *eqhw = &(vortex->eq.this04); |
460 |
|
int i; |
461 |
|
|
462 |
|
if (eqhw->this04 > 0) |
463 |
|
return; |
464 |
|
|
465 |
|
for (i=0; i<eqhw->this04; i++) |
466 |
|
peaks[i] = hwread(vortex->mmio, 0x2B024 + i*0x30); |
467 |
|
for (i=0; i<eqhw->this04; i++) |
468 |
|
peaks[i+eqhw->this04] = hwread(vortex->mmio, 0x2B204 + i*0x30); |
469 |
|
} |
470 |
/* CEqlzr.s */ |
/* CEqlzr.s */ |
471 |
|
|
472 |
int vortex_Eqlzr_GetLeftGain(vortex_t *vortex, u16 index, u16 *gain) { |
int vortex_Eqlzr_GetLeftGain(vortex_t *vortex, u16 index, u16 *gain) { |
515 |
vortex_EqHw_SetRightGainsSingleTarget(vortex, index, gain); |
vortex_EqHw_SetRightGainsSingleTarget(vortex, index, gain); |
516 |
} |
} |
517 |
|
|
|
|
|
518 |
int vortex_Eqlzr_GetAllBands(vortex_t *vortex, u16 *gains, unsigned long *cnt) { |
int vortex_Eqlzr_GetAllBands(vortex_t *vortex, u16 *gains, unsigned long *cnt) { |
519 |
eqlzr_t *eq = &(vortex->eq); |
eqlzr_t *eq = &(vortex->eq); |
520 |
int si=0; |
int si=0; |
599 |
#if 0 |
#if 0 |
600 |
void vortex_Eqlzr_vortex_SetA3dBypassVolume() |
void vortex_Eqlzr_vortex_SetA3dBypassVolume() |
601 |
void vortex_Eqlzr_ShutDownA3d() |
void vortex_Eqlzr_ShutDownA3d() |
602 |
int vortex_Eqlzr_GetAllPeaks(vortex_t *vortex, u16 *levels, unsigned long *count) { |
#endif |
603 |
|
|
604 |
|
int vortex_Eqlzr_GetAllPeaks(vortex_t *vortex, u16 *peaks, int *count) { |
605 |
eqlzr_t *eq = &(vortex->eq); |
eqlzr_t *eq = &(vortex->eq); |
606 |
|
|
607 |
if (eq->this10 == 0) |
if (eq->this10 == 0) |
608 |
return 1; |
return 1; |
609 |
*count = eq->this10 * 2; |
*count = eq->this10 * 2; |
610 |
vortex_EqHw_GetTenBandLevels(vortex, levels); |
vortex_EqHw_GetTenBandLevels(vortex, peaks); |
611 |
|
return 0; |
612 |
} |
} |
613 |
|
|
|
#endif |
|
|
|
|
614 |
auxxEqCoeffSet_t *vortex_Eqlzr_GetActiveCoefSet(vortex_t *vortex) { |
auxxEqCoeffSet_t *vortex_Eqlzr_GetActiveCoefSet(vortex_t *vortex) { |
615 |
eqlzr_t *eq = &(vortex->eq); |
eqlzr_t *eq = &(vortex->eq); |
616 |
|
|
650 |
/* ALSA interface */ |
/* ALSA interface */ |
651 |
|
|
652 |
/* Control interface */ |
/* Control interface */ |
|
static int snd_vortex_eq_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 = 0x0000; |
|
|
uinfo->value.integer.max = 0x7fff; |
|
|
return 0; |
|
|
} |
|
|
|
|
|
static int snd_vortex_eq_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) { |
|
|
vortex_t *vortex = snd_kcontrol_chip(kcontrol); |
|
|
int i = kcontrol->private_value; |
|
|
u16 gainL, gainR; |
|
|
|
|
|
vortex_Eqlzr_GetLeftGain(vortex, i, &gainL); |
|
|
vortex_Eqlzr_GetRightGain(vortex, i, &gainR); |
|
|
ucontrol->value.integer.value[0] = gainL; |
|
|
ucontrol->value.integer.value[1] = gainR; |
|
|
return 0; |
|
|
} |
|
|
|
|
|
static int snd_vortex_eq_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) { |
|
|
vortex_t *vortex = snd_kcontrol_chip(kcontrol); |
|
|
int changed = 0, i = kcontrol->private_value; |
|
|
u16 gainL, gainR; |
|
|
|
|
|
vortex_Eqlzr_GetLeftGain(vortex, i, &gainL); |
|
|
vortex_Eqlzr_GetRightGain(vortex, i, &gainR); |
|
|
|
|
|
if (gainL != ucontrol->value.integer.value[0]) { |
|
|
vortex_Eqlzr_SetLeftGain(vortex, i, ucontrol->value.integer.value[0]); |
|
|
changed = 1; |
|
|
} |
|
|
if (gainR != ucontrol->value.integer.value[1]) { |
|
|
vortex_Eqlzr_SetRightGain(vortex, i, ucontrol->value.integer.value[1]); |
|
|
changed = 1; |
|
|
} |
|
|
return changed; |
|
|
} |
|
|
|
|
653 |
static int snd_vortex_eqtoggle_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) { |
static int snd_vortex_eqtoggle_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) { |
654 |
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
655 |
uinfo->count = 1; |
uinfo->count = 1; |
690 |
.put = snd_vortex_eqtoggle_put |
.put = snd_vortex_eqtoggle_put |
691 |
}; |
}; |
692 |
|
|
693 |
|
static int snd_vortex_eq_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) { |
694 |
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
695 |
|
uinfo->count = 2; |
696 |
|
uinfo->value.integer.min = 0x0000; |
697 |
|
uinfo->value.integer.max = 0x7fff; |
698 |
|
return 0; |
699 |
|
} |
700 |
|
|
701 |
|
static int snd_vortex_eq_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) { |
702 |
|
vortex_t *vortex = snd_kcontrol_chip(kcontrol); |
703 |
|
int i = kcontrol->private_value; |
704 |
|
u16 gainL, gainR; |
705 |
|
|
706 |
|
vortex_Eqlzr_GetLeftGain(vortex, i, &gainL); |
707 |
|
vortex_Eqlzr_GetRightGain(vortex, i, &gainR); |
708 |
|
ucontrol->value.integer.value[0] = gainL; |
709 |
|
ucontrol->value.integer.value[1] = gainR; |
710 |
|
return 0; |
711 |
|
} |
712 |
|
|
713 |
|
static int snd_vortex_eq_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) { |
714 |
|
vortex_t *vortex = snd_kcontrol_chip(kcontrol); |
715 |
|
int changed = 0, i = kcontrol->private_value; |
716 |
|
u16 gainL, gainR; |
717 |
|
|
718 |
|
vortex_Eqlzr_GetLeftGain(vortex, i, &gainL); |
719 |
|
vortex_Eqlzr_GetRightGain(vortex, i, &gainR); |
720 |
|
|
721 |
|
if (gainL != ucontrol->value.integer.value[0]) { |
722 |
|
vortex_Eqlzr_SetLeftGain(vortex, i, ucontrol->value.integer.value[0]); |
723 |
|
changed = 1; |
724 |
|
} |
725 |
|
if (gainR != ucontrol->value.integer.value[1]) { |
726 |
|
vortex_Eqlzr_SetRightGain(vortex, i, ucontrol->value.integer.value[1]); |
727 |
|
changed = 1; |
728 |
|
} |
729 |
|
return changed; |
730 |
|
} |
731 |
|
|
732 |
static snd_kcontrol_new_t vortex_eq_kcontrol __devinitdata = { |
static snd_kcontrol_new_t vortex_eq_kcontrol __devinitdata = { |
733 |
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
734 |
.name = " .", |
.name = " .", |
740 |
.put = snd_vortex_eq_put |
.put = snd_vortex_eq_put |
741 |
}; |
}; |
742 |
|
|
743 |
|
static int snd_vortex_peaks_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) { |
744 |
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
745 |
|
uinfo->count = 20; |
746 |
|
uinfo->value.integer.min = 0x0000; |
747 |
|
uinfo->value.integer.max = 0xffff; |
748 |
|
return 0; |
749 |
|
} |
750 |
|
|
751 |
|
static int snd_vortex_peaks_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) { |
752 |
|
vortex_t *vortex = snd_kcontrol_chip(kcontrol); |
753 |
|
int i, count; |
754 |
|
u16 peaks[20]; |
755 |
|
|
756 |
|
vortex_Eqlzr_GetAllPeaks(vortex, peaks, &count); |
757 |
|
if (count != 20) { |
758 |
|
printk("vortex: peak count error 20 != %d \n", count); |
759 |
|
return -1; |
760 |
|
} |
761 |
|
for (i=0; i<20; i++) |
762 |
|
ucontrol->value.integer.value[i] = peaks[i]; |
763 |
|
|
764 |
|
return 0; |
765 |
|
} |
766 |
|
|
767 |
|
static snd_kcontrol_new_t vortex_levels_kcontrol __devinitdata = { |
768 |
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
769 |
|
.name = "EQ Peaks", |
770 |
|
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, |
771 |
|
.info = snd_vortex_peaks_info, |
772 |
|
.get = snd_vortex_peaks_get, |
773 |
|
}; |
774 |
|
|
775 |
/* EQ band gain labels. */ |
/* EQ band gain labels. */ |
776 |
static char *EqBandLabels[10] __devinitdata = { |
static char *EqBandLabels[10] __devinitdata = { |
777 |
"EQ0 31Hz\0", |
"EQ0 31Hz\0", |
807 |
kcontrol->private_value = i; |
kcontrol->private_value = i; |
808 |
if ((err = snd_ctl_add(vortex->card, kcontrol)) < 0) |
if ((err = snd_ctl_add(vortex->card, kcontrol)) < 0) |
809 |
return err; |
return err; |
810 |
vortex->eqctrl[i] = kcontrol; |
//vortex->eqctrl[i] = kcontrol; |
811 |
} |
} |
812 |
|
/* EQ band levels */ |
813 |
|
if ((kcontrol = snd_ctl_new1(&vortex_levels_kcontrol, vortex)) == NULL) |
814 |
|
return -ENOMEM; |
815 |
|
if ((err = snd_ctl_add(vortex->card, kcontrol)) < 0) |
816 |
|
return err; |
817 |
|
|
818 |
return 0; |
return 0; |
819 |
} |
} |
820 |
|
|