annotate src/cs/drivers/drv_app/fchg/fchg_api.c @ 662:8cd8fd15a095

SIM speed enhancement re-enabled and made configurable TI's original code supported SIM speed enhancement, but Openmoko had it disabled, and OM's disabling of speed enhancement somehow caused certain SIM cards to start working which didn't work before (OM's bug #666). Because our FC community is much smaller in year 2020 than OM's community was in their day, we are not able to find one of those #666-affected SIMs, thus the real issue they had encountered remains elusive. Thus our solution is to re-enable SIM speed enhancement and simply wait for if and when someone runs into a #666-affected SIM once again. We provide a SIM_allow_speed_enhancement global variable that allows SIM speed enhancement to be enabled or disabled per session, and an /etc/SIM_spenh file in FFS that allows it to enabled or disabled on a non-volatile basis. SIM speed enhancement is now enabled by default.
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 24 May 2020 05:02:28 +0000
parents 3a7810ca74e2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
336
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * The implementation of our external API functions lives here.
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include "fchg/fchg_api.h"
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include "fchg/fchg_env.h"
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include "fchg/fchg_messages.h"
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include "rv/rv_general.h"
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include "rvf/rvf_api.h"
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "rvm/rvm_use_id_list.h"
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 T_RV_RET fchg_get_current_state(struct fchg_user_state *rstruct)
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 {
345
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
14 if (!pwr_ctrl)
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
15 return RV_NOT_READY;
336
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 rstruct->chg_state = pwr_ctrl->state;
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 rstruct->batt_mv = pwr_ctrl->batt_mv;
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 rstruct->batt_percent =
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 pwr_ctrl->batt_thresholds[pwr_ctrl->curr_disch_thresh].remain_capa;
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 return RV_OK;
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 }
345
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
22
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
23 T_RV_RET fchg_user_charge_control(enum fchg_user_charge_ctrl arg)
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
24 {
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
25 enum pwr_msg_id msg_id;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
26 struct pwr_req_s *msg;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
27
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
28 if (!pwr_ctrl)
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
29 return RV_NOT_READY;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
30 switch (arg) {
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
31 case FCHG_CHARGE_START:
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
32 if (!pwr_ctrl->config_present)
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
33 return RV_NOT_READY;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
34 msg_id = USER_START_CHARGE_REQ;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
35 break;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
36 case FCHG_CHARGE_STOP:
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
37 msg_id = USER_STOP_CHARGE_REQ;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
38 break;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
39 default:
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
40 return RV_INVALID_PARAMETER;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
41 }
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
42 if (rvf_get_buf(pwr_ctrl->prim_id, sizeof(struct pwr_req_s),
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
43 (T_RVF_BUFFER **)&msg) == RVF_RED) {
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
44 rvf_send_trace(
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
45 "rvf_get_buf() failed in fchg_user_charge_control()",
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
46 50, NULL_PARAM, RV_TRACE_LEVEL_ERROR, FCHG_USE_ID);
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
47 return RV_MEMORY_ERR;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
48 }
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
49 msg->header.msg_id = msg_id;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
50 msg->header.src_addr_id = pwr_ctrl->addr_id;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
51 msg->header.dest_addr_id = pwr_ctrl->addr_id;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
52 msg->header.callback_func = NULL;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
53 if (rvf_send_msg(pwr_ctrl->addr_id, msg) != RV_OK) {
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
54 rvf_send_trace("fchg_user_charge_control(): Send failed!", 40,
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
55 NULL_PARAM, RV_TRACE_LEVEL_ERROR, FCHG_USE_ID);
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
56 rvf_free_buf(msg);
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
57 return RV_INTERNAL_ERR;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
58 }
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
59 return RV_OK;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
60 }