patch-2.2.14 linux/drivers/sbus/audio/cs4231.c
Next file: linux/drivers/sbus/audio/dbri.c
Previous file: linux/drivers/sbus/audio/cs4215.h
Back to the patch index
Back to the overall index
- Lines: 39
- Date:
Tue Jan 4 10:12:18 2000
- Orig file:
v2.2.13/linux/drivers/sbus/audio/cs4231.c
- Orig date:
Tue Jan 4 11:10:37 2000
diff -u --recursive --new-file v2.2.13/linux/drivers/sbus/audio/cs4231.c linux/drivers/sbus/audio/cs4231.c
@@ -904,8 +904,9 @@
if (l < 0) l = 0;
}
- l_adj = l * (CS4231_MAX_GAIN + 1) / (AUDIO_MAX_GAIN + 1);
- r_adj = r * (CS4231_MAX_GAIN + 1) / (AUDIO_MAX_GAIN + 1);
+ /* See cs4231_play_gain for why we do things this way. -DaveM */
+ l_adj = ((l * (CS4231_MAX_GAIN + 1)) + AUDIO_MAX_GAIN) / (AUDIO_MAX_GAIN + 1);
+ r_adj = ((r * (CS4231_MAX_GAIN + 1)) + AUDIO_MAX_GAIN) / (AUDIO_MAX_GAIN + 1);
CS4231_WRITE8(cs4231_chip, &(cs4231_chip->regs->iar), 0x0);
old_gain = CS4231_READ8(cs4231_chip, &(cs4231_chip->regs->idr));
@@ -932,7 +933,7 @@
int tmp = 0, r, l, r_adj, l_adj;
unsigned char old_gain;
- tprintk(("in play_gain: %d %c\n", value, balance));
+ tprintk(("in play_gain: %d %x, ", value, balance));
r = l = value;
if (balance < AUDIO_MID_BALANCE) {
r = (int)(value - ((AUDIO_MID_BALANCE - balance) << AUDIO_BALANCE_SHIFT));
@@ -942,11 +943,15 @@
if (l < 0) l = 0;
}
+ /* We have to round up else several OSS programs
+ * get confused because for small increments we
+ * would otherwise not increase the volume ever. -DaveM
+ */
(l == 0) ? (l_adj = CS4231_MAX_DEV_ATEN) : (l_adj = CS4231_MAX_ATEN -
- (l * (CS4231_MAX_ATEN + 1) /
+ (((l * (CS4231_MAX_ATEN + 1)) + AUDIO_MAX_GAIN) /
(AUDIO_MAX_GAIN + 1)));
(r == 0) ? (r_adj = CS4231_MAX_DEV_ATEN) : (r_adj = CS4231_MAX_ATEN -
- (r * (CS4231_MAX_ATEN + 1) /
+ (((r * (CS4231_MAX_ATEN + 1)) + AUDIO_MAX_GAIN) /
(AUDIO_MAX_GAIN + 1)));
CS4231_WRITE8(cs4231_chip, &(cs4231_chip->regs->iar), 0x6);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)