Erik,
One thing got left out in your revised patch: Not only is the range
0-100, but the "sense" of the numbers are reversed.
..if you check the ak4535 spec again, you'll see that low input values
give high gain and high input values give low gain. This little patch just
helps hide that fact and make it look more standard from user space (i.e.
you move the mixer slider bar up high to increase volume...
The patch really should be something like this: [ Note (100-val) instead
of val ]
Index: ak4535.c
===================================================================
RCS file: /cvs/linux/kernel/drivers/sound/ak4535.c,v
retrieving revision 1.20
diff -u -r1.20 ak4535.c
--- ak4535.c 31 Jan 2005 14:05:41 -0000 1.20
+++ ak4535.c 23 Feb 2005 20:09:11 -0000
@@ -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;
@@ -464,9 +464,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,255] */
val = gain.left;
- val = 63 * val / 100;
+ val = 255 * (100-val) / 100;
ak4535_update(clnt, I2C_SET_LINE_GAIN, &val);
break;
Jim
Erik Hovland wrote:
>
> On Wed, Feb 23, 2005 at 02:11:50PM -0500, Jim Kaba wrote:
> > 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.
>
> Is this against current code? A patch to clear/set these bits was
> checked in on 2005-01-31.
>
> > 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.
>
> Good catch! I am attaching a patch against current cvs that just
> includes this change.
>
> E
>
> --
> Erik Hovland
> mail: erik AT hovland DOT org
> web: http://hovland.org/
> PGP/GPG public key available on request
>
> ---------------------------------------------------------------------------
>
> fix-range-checking-of-line-gain.patchName: fix-range-checking-of-line-gain.patch
> Type: Plain Text (text/plain)
>
> ---------------------------------------------------------------------------
> _______________________________________________
> H5400-port mailing list
> H5400-port_at_handhelds.org
> https://www.handhelds.org/mailman/listinfo/h5400-port
-- ---------------------------------------------------------------------- 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 Fri Feb 25 2005 - 12:14:51 EST
This archive was generated by hypermail 2.2.0 : Mon Jul 25 2005 - 17:20:11 EDT