Skip to contentSkip to conversation

cs46xx DAC volume's mechanism rewrite, minor bugfixes

PATCH Applied Benny Sjostrand 4 participants 6 messages Nov 10, 2002 – Nov 16, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cs46xx DAC volume's mechanism rewrite, minor bugfixes

Hi!

This patch changes the way the DAC volume are set on DSP SCB tasks. I would like to know if maybe this fixes the "bass" problem that some users have experienced with the cs46xx driver.

Still some more attempts to have AC3 through IEC958, but no success yet ...

Summary:
- DAC volume mechanism rewrite (added cs46xx_dsp_set_dac_volume (...) in dsp_spos.c)
- IEC958 input volume mechanism rewrite (added cs46xx_dsp_set_iec958_volume (...) in dsp_spos.c)
- Enable IEC958 hw if not done in cs46xx_iec958_pre_open (...)
- Added "AC3 Mode Switch" in mixer, when enabled appropiate status
bit's (non-audio, profesional) are set in IEC958 stream and PCM channel is locked to 48Khz
- Typo fix in constant name DSP_SDPIF... -> DSP_SPDIF...
- Some code cleanups

/Benny

cvs/alsa-kernel/include/cs46xx_dsp_spos.h renamed from include/cs46xx_dsp_spos.h +8 -5
diff --exclude=Makefile --exclude=CVS -Naur alsa-kernel/include/cs46xx_dsp_spos.h ../cvs/alsa-kernel/include/cs46xx_dsp_spos.h
@@ -60,9 +60,10 @@
 #define DSP_PCM_LFE_CHANNEL     4
 #define DSP_IEC958_CHANNEL      5
 
-#define DSP_SDPIF_STATUS_OUTPUT_ENABLED 1
-#define DSP_SDPIF_STATUS_PLAYBACK_OPEN  2
-#define DSP_SDPIF_STATUS_HW_ENABLED     4
+#define DSP_SPDIF_STATUS_OUTPUT_ENABLED 1
+#define DSP_SPDIF_STATUS_PLAYBACK_OPEN  2
+#define DSP_SPDIF_STATUS_HW_ENABLED     4
+#define DSP_SPDIF_STATUS_AC3_MODE       8
 
 struct _dsp_module_desc_t;
 
@@ -155,6 +156,8 @@
 
 	/* Main PCM playback mixer */
 	dsp_scb_descriptor_t * master_mix_scb;
+	u16 dac_volume_right;
+	u16 dac_volume_left;
 
 	/* Rear PCM playback mixer */
 	dsp_scb_descriptor_t * rear_mix_scb;
@@ -191,7 +194,8 @@
 	/* SPDIF status */
 	int spdif_status_out;
 	int spdif_status_in;
-	u32 spdif_input_volume;
+	u16 spdif_input_volume_right;
+	u16 spdif_input_volume_left;
 
 	/* SPDIF input sample rate converter */
 	dsp_scb_descriptor_t * spdif_in_src;
@@ -221,4 +225,3 @@
 } dsp_spos_instance_t;
 
 #endif /* __DSP_SPOS_H__ */
-
cvs/alsa-kernel/pci/cs46xx/cs46xx_lib.c renamed from pci/cs46xx/cs46xx_lib.c +142 -50

298 lines not on this page · raw message

cvs/alsa-kernel/pci/cs46xx/cs46xx_lib.h renamed from pci/cs46xx/cs46xx_lib.h +2 -0
diff --exclude=Makefile --exclude=CVS -Naur alsa-kernel/pci/cs46xx/cs46xx_lib.h ../cvs/alsa-kernel/pci/cs46xx/cs46xx_lib.h
@@ -217,4 +217,6 @@
 							       int period_size);
 int                        cs46xx_dsp_pcm_ostream_set_period (cs46xx_t * chip,
 							      int period_size);
+int                        cs46xx_dsp_set_dac_volume (cs46xx_t * chip,u16 right,u16 left);
+int                        cs46xx_dsp_set_iec958_volume (cs46xx_t * chip,u16 right,u16 left);
 #endif /* __CS46XX_LIB_H__ */
cvs/alsa-kernel/pci/cs46xx/dsp_spos.c renamed from pci/cs46xx/dsp_spos.c +47 -4

75 lines not on this page · raw message

cvs/alsa-kernel/pci/cs46xx/dsp_spos.h renamed from pci/cs46xx/dsp_spos.h +10 -0
diff --exclude=Makefile --exclude=CVS -Naur alsa-kernel/pci/cs46xx/dsp_spos.h ../cvs/alsa-kernel/pci/cs46xx/dsp_spos.h
@@ -76,6 +76,7 @@
 #define MIX_SAMPLE_BUF2          0x2D00
 #define MIX_SAMPLE_BUF3          0x2E00
 #define MIX_SAMPLE_BUF4          0x2F00
+#define MIX_SAMPLE_BUF5          0x3000
 
 /* Task stack address */
 #define HFG_STACK                0x066A
@@ -127,6 +128,7 @@
 #define SCBfuncEntryPtr      0xA
 #define SRCCorPerGof         0x2
 #define SRCPhiIncr6Int26Frac 0xd
+#define SCBVolumeCtrl        0xe
 
 /* conf */
 #define UseASER1Input 1
@@ -190,6 +192,14 @@
 			(scb->address + SCBsubListPtr) << 2,
 			(scb->sub_list_ptr->address << 0x10) |
 			(scb->next_scb_ptr->address));	
+}
+
+static inline void cs46xx_dsp_scb_set_volume (cs46xx_t * chip,dsp_scb_descriptor_t * scb,
+					      u16 right,u16 left) {
+	unsigned int val = ((0xffff - right) << 16 | (0xffff - left));	
+
+	snd_cs46xx_poke(chip, (scb->address + SCBVolumeCtrl) << 2, val);
+	snd_cs46xx_poke(chip, (scb->address + SCBVolumeCtrl + 1) << 2, val);
 }
 
 #endif /* __DSP_SPOS_H__ */
cvs/alsa-kernel/pci/cs46xx/dsp_spos_scb_lib.c renamed from pci/cs46xx/dsp_spos_scb_lib.c +42 -24

187 lines not on this page · raw message

#1 lore raw
Quoted 9 lines · Benny Sjostrand

Hi!

This patch changes the way the DAC volume are set on DSP SCB tasks. I would like to know
if maybe this fixes the "bass" problem that some users have experienced with the cs46xx driver.

Still some more attempts to have AC3 through IEC958, but no success yet ...

Quoted 11 lines

Summary:
- DAC volume mechanism rewrite (added cs46xx_dsp_set_dac_volume (...) in dsp_spos.c)
- IEC958 input volume mechanism rewrite (added cs46xx_dsp_set_iec958_volume (...) in dsp_spos.c)
- Enable IEC958 hw if not done in cs46xx_iec958_pre_open (...)
- Added "AC3 Mode Switch" in mixer, when enabled appropiate status bit's (non-audio, profesional) are set in IEC958 stream and PCM channel is locked to 48Khz
- Typo fix in constant name DSP_SDPIF... -> DSP_SPDIF...
- Some code cleanups

Applied. Thanks.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#2 lore raw
In reply to Benny Sjostrand
Quoted 21 lines · Benny Sjostrand

Hi!

This patch changes the way the DAC volume are set on DSP SCB tasks. I would like to know
if maybe this fixes the "bass" problem that some users have experienced with the cs46xx driver.

Still some more attempts to have AC3 through IEC958, but no success yet ...

Summary:
- DAC volume mechanism rewrite (added cs46xx_dsp_set_dac_volume (...) in dsp_spos.c)
- IEC958 input volume mechanism rewrite (added cs46xx_dsp_set_iec958_volume (...) in dsp_spos.c)
- Enable IEC958 hw if not done in cs46xx_iec958_pre_open (...)
- Added "AC3 Mode Switch" in mixer, when enabled appropiate status bit's (non-audio, profesional) are set in IEC958 stream and PCM channel is locked to 48Khz
- Typo fix in constant name DSP_SDPIF... -> DSP_SPDIF...
- Some code cleanups

Quoted 1 line

/Benny

Thanks for working on this issue Benny. I tried out the code but the bass issues still persists. As before, unbalancing the left and right channels brings the bass back. Thanks

Weijia

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#3 lore raw
Quoted 5 lines · Weijia Yang

Thanks for working on this issue Benny. I tried out the code but the bass issues still persists. As before, unbalancing the left and right channels brings the bass back. Thanks

Are you suggesting that one of the channels might phase reversed? Do you have any idea if the bass attuniation is stronger at a specific frequency?

Frank

Signature · 11 lines
+---- --- -- -  -   -    - 
| Frank van de Pol                  -o)    A-L-S-A
| [email protected]                    /\\  Sounds good!
| http://www.alsa-project.org      _\_v
| Linux - Why use Windows if we have doors available?


-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing 
your web site with SSL, click here to get a FREE TRIAL of a Thawte 
Server Certificate: http://www.gothawte.com/rd524.html
#4 lore raw
Quoted 9 lines · Frank van de Pol
Quoted 5 lines · Weijia Yang

Thanks for working on this issue Benny. I tried out the code but the bass issues still persists. As before, unbalancing the left and right channels brings the bass back. Thanks

Are you suggesting that one of the channels might phase reversed? Do you have any idea if the bass attuniation is stronger at a specific frequency?

I just had a thought after sending previous message.

can you phase reverse one of the channels and let us know the way your behaviour changes?

eg. pressing phase-reverse switch on on of the channel strips on your mixing desk, or changing polarity at one of the speaker cables.

Does the 'lack of bass' phenomena exists for data played through the pcm (wav, mp3 etc.) or also for analog sources (eg. CDROM audio, line input)?

Frank.

Signature · 11 lines
+---- --- -- -  -   -    - 
| Frank van de Pol                  -o)    A-L-S-A
| [email protected]                    /\\  Sounds good!
| http://www.alsa-project.org      _\_v
| Linux - Why use Windows if we have doors available?


-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing 
your web site with SSL, click here to get a FREE TRIAL of a Thawte 
Server Certificate: http://www.gothawte.com/rd524.html
#5 lore raw
Quoted 15 lines · Frank van de Pol
Quoted 8 lines · Frank van de Pol
Quoted 3 lines · Weijia Yang

Thanks for working on this issue Benny. I tried out the code but the bass issues still persists. As before, unbalancing the left and right channels brings the bass back. Thanks

Are you suggesting that one of the channels might phase reversed? Do you have any idea if the bass attuniation is stronger at a specific frequency?

I just had a thought after sending previous message.

can you phase reverse one of the channels and let us know the way your behaviour changes?

Quoted 7 lines

eg. pressing phase-reverse switch on on of the channel strips on your mixing desk, or changing polarity at one of the speaker cables.

Does the 'lack of bass' phenomena exists for data played through the pcm (wav, mp3 etc.) or also for analog sources (eg. CDROM audio, line input)?

Frank.

Hmm...I'd like to check this out, but my experience w/ sound apps is very lacking. What program can I use to do what you are talking about? Thanks

Weijia

-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing your web site with SSL, click here to get a FREE TRIAL of a Thawte Server Certificate: http://www.gothawte.com/rd524.html