[Gta04-owner] Reliable headset detection with raw values

NeilBrown neilb at suse.de
Sun May 25 00:49:38 CEST 2014


On Sat, 24 May 2014 14:14:21 +0200 Paul Kocialkowski <contact at paulk.fr> wrote:

> > > This doesn't make much sense to me.
> > > Rather than guessing I looked at the code, and the effect of setting 'raw'
> > > is to bypass
> > > 
> > > 			buf[i] = (buf[i] * 3 * 1000 *
> > > 				 twl4030_divider_ratios[i].denominator)
> > > 				/ (2 * 1023 *
> > > 				twl4030_divider_ratios[i].numerator);
> > > 
> > > where 'i' is 7, and twl4030_divider_ratios[7] is
> > > 
> > > 	{6, 10},	/* CHANNEL 7 */
> > > 
> > > So this becomes
> > >    buf[i] * 30000 / 12276
> > > 
> > > so it rough multiplies the numbers be 2.5.  That shouldn't affect stability
> > > at all.
> > 
> > Yes, you're perfectly right, I didn't read twl4030_madc_read_channels
> > completely and just assumed it was changing the range of values in a
> > dynamic way (for instance, using calibration), but obviously, I was
> > wrong. It really did seem like it was improving stability (for instance,
> > I had values that drastically changed from one reboot to the other, like
> > 800 to 400, without raw), but then it was late when I did this and I
> > jumped to conclusions too fast, without learning about the details.
> > 
> > I'll revert the change in the Replicant 4.2 tree and use thresholds
> > based on the non-raw values.
> 
> Turns out I wasn't so crazy after all! My patch did introduce better
> stability because the raw element of the request structure wasn't
> initialized previously, which lead to randomly either raw or processed
> values, hence the different ranges of values depending on the day, the
> device, etc.

Ahhh... makes lots of sense now.  Thanks :-)

NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: not available
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20140525/921e34a4/attachment.asc>


More information about the Gta04-owner mailing list