|
Hans de Goede |
56753f |
From e27e5ceeee3d8cb55ba0749446b49ccc6ec5b96d Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
56753f |
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@gmail.com>
|
|
Hans de Goede |
56753f |
Date: Tue, 17 Apr 2012 14:32:37 +0200
|
|
Hans de Goede |
56753f |
Subject: [PATCH 503/509] hw/ac97: remove USE_MIXER code
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
That code doesn't compile. The interesting bits for volume control are
|
|
Hans de Goede |
56753f |
going to be rewritten in the following patch.
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
|
|
Hans de Goede |
56753f |
Signed-off-by: malc <av1474@comtv.ru>
|
|
Hans de Goede |
56753f |
---
|
|
Hans de Goede |
56753f |
hw/ac97.c | 121 -------------------------------------------------------------
|
|
Hans de Goede |
56753f |
1 file changed, 121 deletions(-)
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
diff --git a/hw/ac97.c b/hw/ac97.c
|
|
Hans de Goede |
56753f |
index 0dbba3b..cd893c3 100644
|
|
Hans de Goede |
56753f |
--- a/hw/ac97.c
|
|
Hans de Goede |
56753f |
+++ b/hw/ac97.c
|
|
Hans de Goede |
56753f |
@@ -434,99 +434,6 @@ static void reset_voices (AC97LinkState *s, uint8_t active[LAST_INDEX])
|
|
Hans de Goede |
56753f |
AUD_set_active_in (s->voice_mc, active[MC_INDEX]);
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
-#ifdef USE_MIXER
|
|
Hans de Goede |
56753f |
-static void set_volume (AC97LinkState *s, int index,
|
|
Hans de Goede |
56753f |
- audmixerctl_t mt, uint32_t val)
|
|
Hans de Goede |
56753f |
-{
|
|
Hans de Goede |
56753f |
- int mute = (val >> MUTE_SHIFT) & 1;
|
|
Hans de Goede |
56753f |
- uint8_t rvol = VOL_MASK - (val & VOL_MASK);
|
|
Hans de Goede |
56753f |
- uint8_t lvol = VOL_MASK - ((val >> 8) & VOL_MASK);
|
|
Hans de Goede |
56753f |
- rvol = 255 * rvol / VOL_MASK;
|
|
Hans de Goede |
56753f |
- lvol = 255 * lvol / VOL_MASK;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
-#ifdef SOFT_VOLUME
|
|
Hans de Goede |
56753f |
- if (index == AC97_Master_Volume_Mute) {
|
|
Hans de Goede |
56753f |
- AUD_set_volume_out (s->voice_po, mute, lvol, rvol);
|
|
Hans de Goede |
56753f |
- }
|
|
Hans de Goede |
56753f |
- else {
|
|
Hans de Goede |
56753f |
- AUD_set_volume (mt, &mute, &lvol, &rvol);
|
|
Hans de Goede |
56753f |
- }
|
|
Hans de Goede |
56753f |
-#else
|
|
Hans de Goede |
56753f |
- AUD_set_volume (mt, &mute, &lvol, &rvol);
|
|
Hans de Goede |
56753f |
-#endif
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- rvol = VOL_MASK - ((VOL_MASK * rvol) / 255);
|
|
Hans de Goede |
56753f |
- lvol = VOL_MASK - ((VOL_MASK * lvol) / 255);
|
|
Hans de Goede |
56753f |
- mixer_store (s, index, val);
|
|
Hans de Goede |
56753f |
-}
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
-static audrecsource_t ac97_to_aud_record_source (uint8_t i)
|
|
Hans de Goede |
56753f |
-{
|
|
Hans de Goede |
56753f |
- switch (i) {
|
|
Hans de Goede |
56753f |
- case REC_MIC:
|
|
Hans de Goede |
56753f |
- return AUD_REC_MIC;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- case REC_CD:
|
|
Hans de Goede |
56753f |
- return AUD_REC_CD;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- case REC_VIDEO:
|
|
Hans de Goede |
56753f |
- return AUD_REC_VIDEO;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- case REC_AUX:
|
|
Hans de Goede |
56753f |
- return AUD_REC_AUX;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- case REC_LINE_IN:
|
|
Hans de Goede |
56753f |
- return AUD_REC_LINE_IN;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- case REC_PHONE:
|
|
Hans de Goede |
56753f |
- return AUD_REC_PHONE;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- default:
|
|
Hans de Goede |
56753f |
- dolog ("Unknown record source %d, using MIC\n", i);
|
|
Hans de Goede |
56753f |
- return AUD_REC_MIC;
|
|
Hans de Goede |
56753f |
- }
|
|
Hans de Goede |
56753f |
-}
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
-static uint8_t aud_to_ac97_record_source (audrecsource_t rs)
|
|
Hans de Goede |
56753f |
-{
|
|
Hans de Goede |
56753f |
- switch (rs) {
|
|
Hans de Goede |
56753f |
- case AUD_REC_MIC:
|
|
Hans de Goede |
56753f |
- return REC_MIC;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- case AUD_REC_CD:
|
|
Hans de Goede |
56753f |
- return REC_CD;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- case AUD_REC_VIDEO:
|
|
Hans de Goede |
56753f |
- return REC_VIDEO;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- case AUD_REC_AUX:
|
|
Hans de Goede |
56753f |
- return REC_AUX;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- case AUD_REC_LINE_IN:
|
|
Hans de Goede |
56753f |
- return REC_LINE_IN;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- case AUD_REC_PHONE:
|
|
Hans de Goede |
56753f |
- return REC_PHONE;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- default:
|
|
Hans de Goede |
56753f |
- dolog ("Unknown audio recording source %d using MIC\n", rs);
|
|
Hans de Goede |
56753f |
- return REC_MIC;
|
|
Hans de Goede |
56753f |
- }
|
|
Hans de Goede |
56753f |
-}
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
-static void record_select (AC97LinkState *s, uint32_t val)
|
|
Hans de Goede |
56753f |
-{
|
|
Hans de Goede |
56753f |
- uint8_t rs = val & REC_MASK;
|
|
Hans de Goede |
56753f |
- uint8_t ls = (val >> 8) & REC_MASK;
|
|
Hans de Goede |
56753f |
- audrecsource_t ars = ac97_to_aud_record_source (rs);
|
|
Hans de Goede |
56753f |
- audrecsource_t als = ac97_to_aud_record_source (ls);
|
|
Hans de Goede |
56753f |
- AUD_set_record_source (&als, &ars;;
|
|
Hans de Goede |
56753f |
- rs = aud_to_ac97_record_source (ars);
|
|
Hans de Goede |
56753f |
- ls = aud_to_ac97_record_source (als);
|
|
Hans de Goede |
56753f |
- mixer_store (s, AC97_Record_Select, rs | (ls << 8));
|
|
Hans de Goede |
56753f |
-}
|
|
Hans de Goede |
56753f |
-#endif
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
static void mixer_reset (AC97LinkState *s)
|
|
Hans de Goede |
56753f |
{
|
|
Hans de Goede |
56753f |
uint8_t active[LAST_INDEX];
|
|
Hans de Goede |
56753f |
@@ -561,12 +468,6 @@ static void mixer_reset (AC97LinkState *s)
|
|
Hans de Goede |
56753f |
mixer_store (s, AC97_PCM_LR_ADC_Rate , 0xbb80);
|
|
Hans de Goede |
56753f |
mixer_store (s, AC97_MIC_ADC_Rate , 0xbb80);
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
-#ifdef USE_MIXER
|
|
Hans de Goede |
56753f |
- record_select (s, 0);
|
|
Hans de Goede |
56753f |
- set_volume (s, AC97_Master_Volume_Mute, AUD_MIXER_VOLUME , 0x8000);
|
|
Hans de Goede |
56753f |
- set_volume (s, AC97_PCM_Out_Volume_Mute, AUD_MIXER_PCM , 0x8808);
|
|
Hans de Goede |
56753f |
- set_volume (s, AC97_Line_In_Volume_Mute, AUD_MIXER_LINE_IN, 0x8808);
|
|
Hans de Goede |
56753f |
-#endif
|
|
Hans de Goede |
56753f |
reset_voices (s, active);
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
@@ -625,20 +526,6 @@ static void nam_writew (void *opaque, uint32_t addr, uint32_t val)
|
|
Hans de Goede |
56753f |
val |= mixer_load (s, index) & 0xf;
|
|
Hans de Goede |
56753f |
mixer_store (s, index, val);
|
|
Hans de Goede |
56753f |
break;
|
|
Hans de Goede |
56753f |
-#ifdef USE_MIXER
|
|
Hans de Goede |
56753f |
- case AC97_Master_Volume_Mute:
|
|
Hans de Goede |
56753f |
- set_volume (s, index, AUD_MIXER_VOLUME, val);
|
|
Hans de Goede |
56753f |
- break;
|
|
Hans de Goede |
56753f |
- case AC97_PCM_Out_Volume_Mute:
|
|
Hans de Goede |
56753f |
- set_volume (s, index, AUD_MIXER_PCM, val);
|
|
Hans de Goede |
56753f |
- break;
|
|
Hans de Goede |
56753f |
- case AC97_Line_In_Volume_Mute:
|
|
Hans de Goede |
56753f |
- set_volume (s, index, AUD_MIXER_LINE_IN, val);
|
|
Hans de Goede |
56753f |
- break;
|
|
Hans de Goede |
56753f |
- case AC97_Record_Select:
|
|
Hans de Goede |
56753f |
- record_select (s, val);
|
|
Hans de Goede |
56753f |
- break;
|
|
Hans de Goede |
56753f |
-#endif
|
|
Hans de Goede |
56753f |
case AC97_Vendor_ID1:
|
|
Hans de Goede |
56753f |
case AC97_Vendor_ID2:
|
|
Hans de Goede |
56753f |
dolog ("Attempt to write vendor ID to %#x\n", val);
|
|
Hans de Goede |
56753f |
@@ -1191,14 +1078,6 @@ static int ac97_post_load (void *opaque, int version_id)
|
|
Hans de Goede |
56753f |
uint8_t active[LAST_INDEX];
|
|
Hans de Goede |
56753f |
AC97LinkState *s = opaque;
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
-#ifdef USE_MIXER
|
|
Hans de Goede |
56753f |
- record_select (s, mixer_load (s, AC97_Record_Select));
|
|
Hans de Goede |
56753f |
-#define V_(a, b) set_volume (s, a, b, mixer_load (s, a))
|
|
Hans de Goede |
56753f |
- V_ (AC97_Master_Volume_Mute, AUD_MIXER_VOLUME);
|
|
Hans de Goede |
56753f |
- V_ (AC97_PCM_Out_Volume_Mute, AUD_MIXER_PCM);
|
|
Hans de Goede |
56753f |
- V_ (AC97_Line_In_Volume_Mute, AUD_MIXER_LINE_IN);
|
|
Hans de Goede |
56753f |
-#undef V_
|
|
Hans de Goede |
56753f |
-#endif
|
|
Hans de Goede |
56753f |
active[PI_INDEX] = !!(s->bm_regs[PI_INDEX].cr & CR_RPBM);
|
|
Hans de Goede |
56753f |
active[PO_INDEX] = !!(s->bm_regs[PO_INDEX].cr & CR_RPBM);
|
|
Hans de Goede |
56753f |
active[MC_INDEX] = !!(s->bm_regs[MC_INDEX].cr & CR_RPBM);
|
|
Hans de Goede |
56753f |
--
|
|
Hans de Goede |
56753f |
1.7.10
|
|
Hans de Goede |
56753f |
|