power: max17xxx: Fix Initialization

The Initialization of some undocuemnted registers is wrong.

Fix this so that the correct encoding and conversions are used.
The latest maxim supplied spec sheets state that 0x46 should be 0xC80
and that 0x45 should be 1/16th of FullCapNom.  Also it seems that
it should be 1/16th of the Register FullCapNom not the actual mAh.
To do this the Rsense conversion will be applied prior to writing.

Change-Id: Ica801e4f57e7070c4b56b87cd45f607b40ea5530
Signed-off-by: Kenny Kessler <kenny.kessler@motorola.com>
Reviewed-on: https://gerrit.mot.com/1322357
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Ryan Lattrel <ryanl@motorola.com>
Reviewed-by: Ling Jin <lingjin@motorola.com>
Reviewed-by: Kenneth Kessler <kennykessler@motorola.com>
Reviewed-by: Curtis Porter <porterc@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Kenny Kessler 2019-03-18 19:09:02 -05:00 • committed by Kenneth Kessler
commit e7232435be

View file

@ -72,9 +72,8 @@
#define MODEL_LOCK1 0X0000
#define MODEL_LOCK2 0X0000
#define dQ_ACC_DIV 0x4
#define dP_ACC_100 0x1900
#define dP_ACC_200 0x3200
#define dQ_ACC_DIV 16
#define dP_ACC_200 0xC80
#define MAX17050_CFG_REV_REG MAX17042_ManName
#define MAX17050_CFG_REV_MASK 0x0007
@ -900,7 +899,8 @@ static void max17042_load_new_capacity_params(struct max17042_chip *chip)
max17042_write_verify_reg(map, MAX17042_RepCap, rep_cap);
/* Write dQ_acc to 200% of Capacity and dP_acc to 200% */
dq_acc = config->fullcap / dQ_ACC_DIV;
dq_acc = CHRG_CONV_WR(chip->fctr_uah_bit,
config->fullcapnom) / dQ_ACC_DIV;
max17042_write_verify_reg(map, MAX17042_dQacc, dq_acc);
max17042_write_verify_reg(map, MAX17042_dPacc, dP_ACC_200);