annotate src/cs/drivers/drv_app/fchg/fchg_convert_mA.c @ 273:5caa86ee2cfa

enable L1_NEW_AEC in l1_confg.h (bold change) The AEC function implemented in DSP ROM 3606 on the Calypso silicon we work with is the one that corresponds to L1_NEW_AEC; the same holds for DSP 34 and even for DSP 33 with more recent patch versions. However, TI shipped their TCS211 reference fw with L1_NEW_AEC set to 0, thus driving AEC the old way if anyone tried to enable it, either via AT%Nxxxx or via the audio mode facility. As a result, the fw would try to control features which no longer exist in the DSP (long vs short echo and the old echo suppression level bits), while providing no way to tune the 8 new parameter words added to the DSP's NDB page. The only sensible solution is to bite the bullet and enable L1_NEW_AEC in L1 config, with fallout propagating into RiViera Audio Service T_AUDIO_AEC_CFG structure and into /aud/*.cfg binary file format. The latter fallout will be addressed in further code changes.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 29 Jul 2021 18:32:40 +0000
parents 09ea37852fd6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
225
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module implements the fchg_convert_ichg_to_mA() function,
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * converting charging current (Ichg) measurements from ADC units
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * to human-friendly mA numbers. In the phone hardware this current
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * measurement is made with the aid of a current measurement resistor
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * placed in the charging current path (the Iota chip's MADC actually
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 * measures the voltage across this resistor, between VCCS and VBATS
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 * terminals), and it just so happens that different phone designers
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 * have chosen different values for this current measurement resistor:
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 * Pirelli DP-L10 uses 0.20R, following TI's canon, whereas Mot C1xx
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 * phones use 0.15R. Because of these different resistor values,
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 * the formula for converting ADC units to mA becomes target-dependent.
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 */
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #include "fchg/fchg_api.h"
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #include "fc-target.h"
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 UINT16 fchg_convert_ichg_to_mA(UINT16 ichg)
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 {
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 #ifdef CONFIG_TARGET_COMPAL
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 /* formula for 0.15R */
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 return (ichg * 875 / 768);
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 #else
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 /* formula for 0.20R */
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 return (ichg * 875 / 1024);
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 #endif
09ea37852fd6 add function to convert Ichg ADC readings to mA
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 }