FreeCalypso > hg > fc-tourmaline
annotate src/cs/drivers/drv_app/fchg/fchg_convert_mA.c @ 274:fa22012c4a39
CST: remove AT%Nxxxx old AEC control
This crude method of enabling and configuring AEC is not compatible
with L1_NEW_AEC, and even for the old AEC it did not support every
possible combination. It is time for this hack to go. The new and
proper way of enabling and configuring AEC is via RiViera Audio Service
audio mode facility, either audio mode files or full access write,
most directly accessible via fc-tmsh auw 12 for free experimentation.
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Thu, 29 Jul 2021 18:57:36 +0000 |
| parents | 09ea37852fd6 |
| children |
| 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 } |
