annotate src/cs/drivers/drv_app/fchg/fchg_ffs_init.c @ 624:012028896cfb

FFS dev.c, Leonardo target: Fujitsu MB84VF5F5F4J2 #if 0'ed out The FFS code we got from TI/Openmoko had a stanza for "Fujitsu MB84VF5F5F4J2 stacked device", using a fake device ID code that would need to be patched manually into cfgffs.c (suppressing and overriding autodetection) and using an FFS base address in the nCS2 bank, indicating that this FFS config was probably meant for the MCP version of Leonardo which allows for 16 MiB flash with a second bank on nCS2. We previously had this FFS config stanza conditionalized under CONFIG_TARGET_LEONARDO because the base address contained therein is invalid for other targets, but now that we actually have a Leonardo build target in FC Magnetite, I realize that the better approach is to #if 0 out this stanza altogether: it is already non-functional because it uses a fake device ID code, thus it is does not add support for more Leonardo board variants, instead it is just noise.
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 22 Dec 2019 21:24:29 +0000
parents 562fa85c8963
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
325
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * In this module we implement the loading of the charging config
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * and the battery table from FFS.
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include "fchg/fchg_env.h"
326
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
7 #include "fchg/fchg_func_i.h"
325
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include "rv/rv_general.h"
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include "rvf/rvf_api.h"
331
8166b0afcf8c FCHG: main ADC process implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 326
diff changeset
10 #include "rvm/rvm_use_id_list.h"
325
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include "ffs/ffs_api.h"
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 void pwr_load_ffs_charging_config(void)
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 {
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 int rc;
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 rc = ffs_file_read("/etc/charging", &pwr_ctrl->config,
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 sizeof(struct charging_config));
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 if (rc == sizeof(struct charging_config)) {
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 pwr_ctrl->config_present = TRUE;
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 rvf_send_trace(
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 "FCHG: read charging config from FFS, charging enabled", 53,
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 NULL_PARAM, RV_TRACE_LEVEL_DEBUG_HIGH,
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 FCHG_USE_ID);
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 } else {
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 pwr_ctrl->config_present = FALSE;
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 rvf_send_trace(
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 "FCHG: no charging config in FFS, will not charge", 48,
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 NULL_PARAM, RV_TRACE_LEVEL_WARNING,
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 FCHG_USE_ID);
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 }
ab47ade99fa9 FCHG: reading of charging config from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 }
326
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
33
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
34 void pwr_load_ffs_batt_table(void)
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
35 {
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
36 int rc;
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
37
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
38 rc = ffs_file_read("/etc/batterytab", pwr_ctrl->batt_thresholds,
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
39 sizeof(pwr_ctrl->batt_thresholds));
344
562fa85c8963 FCHG battery table loading: comparison signedness issue
Mychaela Falconia <falcon@freecalypso.org>
parents: 331
diff changeset
40 if (rc >= (int)sizeof(T_PWR_THRESHOLDS)) {
326
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
41 pwr_ctrl->nb_thresholds = rc / sizeof(T_PWR_THRESHOLDS);
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
42 rvf_send_trace("FCHG: battery table loaded from FFS", 35,
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
43 NULL_PARAM, RV_TRACE_LEVEL_DEBUG_HIGH,
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
44 FCHG_USE_ID);
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
45 } else {
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
46 pwr_set_default_batt_table();
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
47 rvf_send_trace("FCHG: using compiled-in default battery table",
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
48 45, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_HIGH,
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
49 FCHG_USE_ID);
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
50 }
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 325
diff changeset
51 }