Dear TI support members.
Is the source file in the following URL really for the bq27426?
http://www.ti.com/tool/bq27426sw-linux
http://www.ti.com/tool/bq27426sw-linux
If yes, please confirm following question.
(1)Before and after updating CHEMID, the CHEMID set in the device is read.
However, it may not be possible to correctly recognize CHEMID without converting the blue part below.
――――――――――――――――――――
static int fg_change_chem_id(struct bq_fg_chip *bq, u16 new_id)
{
int ret;
u16 old_id;
int i;
ret = fg_write_word(bq, bq->regs[BQ_FG_REG_CTRL], FG_SUBCMD_CHEM_ID);
if (ret < 0) {
pr_err("Failed to write chemid subcmd, ret = %d\n", ret);
return ret;
}
msleep(5);
ret = fg_read_word(bq, bq->regs[BQ_FG_REG_CTRL], &old_id);
if (ret < 0) {
pr_err("Failed to read control status, ret = %d\n", ret);
return ret;
}
old_id_dec = ((old_id & 0xf000) >> 12)*1000 + ((old_id & 0x0f00) >> 8)*100 \
+ ((old_id & 0x00f0) >> 4)*10 + (old_id & 0x000f);
if (new_id == old_id) {
pr_info("new chemid is same as old one, skip change\n");
return 0;
}
――――――――――――――――――――
However, it may not be possible to correctly recognize CHEMID without converting the blue part below.
――――――――――――――――――――
static int fg_change_chem_id(struct bq_fg_chip *bq, u16 new_id)
{
int ret;
u16 old_id;
int i;
ret = fg_write_word(bq, bq->regs[BQ_FG_REG_CTRL], FG_SUBCMD_CHEM_ID);
if (ret < 0) {
pr_err("Failed to write chemid subcmd, ret = %d\n", ret);
return ret;
}
msleep(5);
ret = fg_read_word(bq, bq->regs[BQ_FG_REG_CTRL], &old_id);
if (ret < 0) {
pr_err("Failed to read control status, ret = %d\n", ret);
return ret;
}
old_id_dec = ((old_id & 0xf000) >> 12)*1000 + ((old_id & 0x0f00) >> 8)*100 \
+ ((old_id & 0x00f0) >> 4)*10 + (old_id & 0x000f);
if (new_id == old_id) {
pr_info("new chemid is same as old one, skip change\n");
return 0;
}
――――――――――――――――――――
(2) There are some points where the waiting time seems to be abnormally long.
For example, the blue part below will wait up to 200 seconds.
Do you really have to wait so long?
――――――――――――――――――――
static int fg_seal(struct bq_fg_chip *bq)
{
int ret;
int retry = 0;
fg_get_seal_state(bq);
if (bq->seal_state == SEAL_STATE_SEALED)
return 0;
msleep(5);
ret = fg_write_word(bq, bq->regs[BQ_FG_REG_CTRL], FG_SUBCMD_SEAL);
if (ret < 0) {
pr_err("Failed to send seal command\n");
return ret;
}
while (retry++ < 1000) {
fg_get_seal_state(bq);
if (bq->seal_state == SEAL_STATE_SEALED)
return 0;
msleep(200);
}
return -1;
}
――――――――――――――――――――
For example, the blue part below will wait up to 200 seconds.
Do you really have to wait so long?
――――――――――――――――――――
static int fg_seal(struct bq_fg_chip *bq)
{
int ret;
int retry = 0;
fg_get_seal_state(bq);
if (bq->seal_state == SEAL_STATE_SEALED)
return 0;
msleep(5);
ret = fg_write_word(bq, bq->regs[BQ_FG_REG_CTRL], FG_SUBCMD_SEAL);
if (ret < 0) {
pr_err("Failed to send seal command\n");
return ret;
}
while (retry++ < 1000) {
fg_get_seal_state(bq);
if (bq->seal_state == SEAL_STATE_SEALED)
return 0;
msleep(200);
}
return -1;
}
――――――――――――――――――――
Regards,
Chiaki Endo
Chiaki Endo