Hi,
Here is a patch that enables the use of the external headphones on the
h5xxx iPAQs. The REG_SEL2_HPL/R bits had to be set/cleared along with the
REG_PWR2_PMHPL/R bits. As per the existing code, external mic/headphones
are enabled/disabled together.
I also took the liberty of fixing the gain associated with headphones:
allowable range is 0-255, not 0-63, and the controls were inverted (i.e.
low mixer settings = loud volumes) -- now the volume will be maxed when
mixer GUI slider bars are maxed.
Enjoy,
Jim
--- linux/kernel/drivers/sound/ak4535.c 2004-09-15 09:14:42.000000000 -0400
+++ linux_jtk/kernel/drivers/sound/ak4535.c 2005-02-23
13:14:14.000000000 -0
500
@@ -302,9 +302,9 @@
case I2C_SET_LINE_GAIN:
newregnum = REG_LATT;
- if (val > 63) {
- printk("line_gain=%d must be in range [0,63]",
val);
- val = 63;
+ if (val > 255) {
+ printk("line_gain=%d must be in range [0,255]",
val);
+ val = 255;
}
akm->regs[REG_LATT] = (unsigned char)val;
altregnum = REG_RATT;
@@ -325,10 +325,14 @@
newregnum = REG_PWR2;
akm->regs[REG_PWR2] |=
(REG_PWR2_PMHPR|REG_PWR2_PMHPL);
akm->regs[REG_PWR2] &= ~REG_PWR2_PMSPK;
+ altregnum = REG_SEL2;
+ akm->regs[REG_SEL2] &=
~(REG_SEL2_HPR|REG_SEL2_HPL); // clear these bits to enable headphones
} else {
newregnum = REG_PWR2;
akm->regs[REG_PWR2] &=
~(REG_PWR2_PMHPR|REG_PWR2_PMHPL);
akm->regs[REG_PWR2] |= REG_PWR2_PMSPK;
+ altregnum = REG_SEL2;
+ akm->regs[REG_SEL2] |= (REG_SEL2_HPR|REG_SEL2_HPL);
// set these bits to disable headphones
}
break;
case I2C_SET_AGC:
@@ -453,9 +457,9 @@
case SOUND_MIXER_LINE:
akm->line = val;
akm->mod_cnt++;
- /* input value [0,100], ak4535 uses [0,63] */
+ /* input value [0,100], ak4535 uses [0,FF]
0=loudest, FF=lowest*/
val = gain.left;
- val = 63 * val / 100;
+ val = 255 * (100-val) / 100;
ak4535_update(clnt, I2C_SET_LINE_GAIN, &val);
break;
-- ---------------------------------------------------------------------- James T. Kaba Sarnoff Corporation There are 10 kinds of people in the world: jkaba_at_sarnoff.com those who understand binary, and those who don't. 609-734-2246Received on Wed Feb 23 2005 - 14:15:12 EST
This archive was generated by hypermail 2.2.0 : Mon Jul 25 2005 - 17:20:11 EDT