Disable debugging log for power consumption

1. Consider the battery is absent if battery temperature
is lower than -30 degree C.

2. Disable bq27426 register dump for debugging in heartbeat
work.

3. Change the heartbeat work interval to 60s.

Change-Id: I043c6a28f998668a0dad7f39b75f21fb1b3c6f1f
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2253210
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
yanyh2 2022-04-26 17:14:04 +08:00 • committed by Yonghua Yan
commit c7135bc1e5

View file

@ -107,11 +107,12 @@ enum print_reason {
PR_MOTO = BIT(7),
};
static int __debug_mask = 0xFF;
static int __debug_mask = 0;
module_param_named(
debug_mask, __debug_mask, int, S_IRUSR | S_IWUSR
);
#define FG_HEARTBEAT_RATE 60000
#define MONITOR_ALARM_CHECK_NS 5000000000
#define INVALID_REG_ADDR 0xFF
#define BQFS_UPDATE_KEY 0x8F91
@ -1025,19 +1026,25 @@ static int fg_read_fw_version(struct bq_fg_chip *bq)
return version;
}
#define BPD_TEMP_THRE (-300)
static int fg_read_temperature(struct bq_fg_chip *bq);
static int fg_read_status(struct bq_fg_chip *bq)
{
int ret;
u16 flags;
int batt_temp;
ret = fg_read_word(bq, bq->regs[BQ_FG_REG_FLAGS], &flags);
if (ret < 0) {
return ret;
}
batt_temp = fg_read_temperature(bq) - 2730;
mutex_lock(&bq->data_lock);
bq->batt_present = !!(flags & FG_FLAGS_BAT_DET);
if (batt_temp > BPD_TEMP_THRE)
bq->batt_present = !!(flags & FG_FLAGS_BAT_DET);
else
bq->batt_present = false;
bq->batt_ot = !!(flags & FG_FLAGS_OT);
bq->batt_ut = !!(flags & FG_FLAGS_UT);
bq->batt_fc = !!(flags & FG_FLAGS_FC);
@ -2418,7 +2425,7 @@ static void bq_heartbeat_work(struct work_struct *work)
debug_fg_dump_registers(chip);
queue_delayed_work(chip->heartbeat_wq,
&chip->heartbeat_work,
msecs_to_jiffies(1000));
msecs_to_jiffies(FG_HEARTBEAT_RATE));
}
static int bq_fg_probe(struct i2c_client *client,