mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 05:39:54 -04:00
Adjust bq27426 fg module to support Android S
Adjust bq27426 fg module to support Android S and different HW design. Change-Id: I90e0c6e49a47ca148e519564cc1a448deeb29177 Signed-off-by: yanyh2 <yanyh2@motorola.com> Reviewed-on: https://gerrit.mot.com/2152626 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:
parent
c2086f49d3
commit
64bca136c8
5 changed files with 1021 additions and 22 deletions
|
|
@ -7,18 +7,27 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
ifeq ($(ATL_4000MAH_8A_BATTERY_PROFILE),true)
|
||||
KERNEL_CFLAGS += CONFIG_ATL_4000MAH_8A_BATTERY_PROFILE=y
|
||||
KBUILD_OPTIONS += CONFIG_ATL_4000MAH_8A_BATTERY_PROFILE=y
|
||||
endif
|
||||
|
||||
ifeq ($(SCUD_4000MAH_8A_BATTERY_PROFILE),true)
|
||||
KERNEL_CFLAGS += CONFIG_SCUD_4000MAH_8A_BATTERY_PROFILE=y
|
||||
KBUILD_OPTIONS += CONFIG_SCUD_4000MAH_8A_BATTERY_PROFILE=y
|
||||
endif
|
||||
|
||||
ifeq ($(ATL_LS40_1545MAH_BATTERY_PROFILE),true)
|
||||
KERNEL_CFLAGS += CONFIG_ATL_LS40_1545MAH_BATTERY_PROFILE=y
|
||||
KBUILD_OPTIONS += CONFIG_ATL_LS40_1545MAH_BATTERY_PROFILE=y
|
||||
endif
|
||||
|
||||
ifeq ($(ATL_LS30_1255MAH_BATTERY_PROFILE),true)
|
||||
KERNEL_CFLAGS += CONFIG_ATL_LS30_1255MAH_BATTERY_PROFILE=y
|
||||
KBUILD_OPTIONS += CONFIG_ATL_LS30_1255MAH_BATTERY_PROFILE=y
|
||||
endif
|
||||
|
||||
ifeq ($(ATL_NM40_712MAH_BATTERY_PROFILE),true)
|
||||
KERNEL_CFLAGS += CONFIG_ATL_NM40_712MAH_BATTERY_PROFILE=y
|
||||
KBUILD_OPTIONS += CONFIG_ATL_NM40_712MAH_BATTERY_PROFILE=y
|
||||
endif
|
||||
|
||||
ifeq ($(DLKM_INSTALL_TO_VENDOR_OUT),true)
|
||||
|
|
@ -27,4 +36,5 @@ else
|
|||
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
|
||||
endif
|
||||
|
||||
KBUILD_OPTIONS_GKI += GKI_OBJ_MODULE_DIR=gki
|
||||
include $(DLKM_DIR)/AndroidKernelModule.mk
|
||||
|
|
|
|||
|
|
@ -19,4 +19,8 @@ ifneq ($(filter m y,$(CONFIG_ATL_LS30_1255MAH_BATTERY_PROFILE)),)
|
|||
EXTRA_CFLAGS += -DATL_LS30_1255MAH_BATTERY_PROFILE
|
||||
endif
|
||||
|
||||
ifneq ($(filter m y,$(CONFIG_ATL_NM40_712MAH_BATTERY_PROFILE)),)
|
||||
EXTRA_CFLAGS += -DATL_NM40_712MAH_BATTERY_PROFILE
|
||||
endif
|
||||
|
||||
obj-m += bq27426_fg_mmi.o
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
|
||||
all: modules
|
||||
|
||||
all:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(shell pwd) modules $(KBUILD_OPTIONS)
|
||||
modules:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS)
|
||||
|
||||
modules_install:
|
||||
$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(shell pwd) modules_install
|
||||
$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(M) modules_install
|
||||
|
||||
%:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(M) $@ $(KBUILD_OPTIONS)
|
||||
|
||||
clean:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
|
||||
|
||||
rm -f *.o *.ko *.mod.c *.mod.o *~ .*.cmd Module.symvers
|
||||
rm -rf .tmp_versions
|
||||
|
|
|
|||
|
|
@ -0,0 +1,946 @@
|
|||
/*****************************************************************************
|
||||
* Copyright 2010 Texas Instruments Corporation, All Rights Reserved.
|
||||
* TI makes NO WARRANTY as to software products, which are supplied "AS-IS"
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* This code is automatically generated from bqfs/dffs file. *
|
||||
* DO NOT MODIFY THIS FILE DIRECTLY *
|
||||
*****************************************************************************/
|
||||
|
||||
//this file is generated from 0426_2_02-bq27426G1-Smith-flip-config.gm.fs at Thu Aug 27 17:04:58 2020
|
||||
|
||||
#ifndef __FLIP_BQFS_FILE__
|
||||
#define __FLIP_BQFS_FILE__
|
||||
|
||||
#include "bqfs_cmd_type.h"
|
||||
|
||||
const bqfs_cmd_t li_alt_flip_bqfs_image[] = {
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x00,
|
||||
.data = {.bytes = {0x01, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x00,
|
||||
.data = {.bytes = {0x26, 0x04}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x00,
|
||||
.data = {.bytes = {0x02, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x00,
|
||||
.data = {.bytes = {0x02, 0x02}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x00,
|
||||
.data = {.bytes = {0x13, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 1100},
|
||||
},
|
||||
// chemid start
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x53, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x27, 0x66, 0x11, 0x59, 0xE2, 0xE1, 0xE4, 0xE3, 0xE0, 0xE1, 0xDF, 0xE1, 0xE1, 0xE2, 0xE2, 0xE4, 0xE4, 0xE6, 0xE7, 0xE6, 0xE7, 0xE2, 0xE3, 0xEF, 0xEF, 0xF3, 0xF4, 0xF6, 0xF6, 0xFA, 0xF8, 0xFD}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x91}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x53, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x91}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x53, 0x01}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0xF9, 0xF6, 0xF5, 0xF3, 0xF0, 0xEE, 0xF3, 0xFE, 0xFC, 0xE0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xFD}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x53, 0x01}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xFD}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x54, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0xFF, 0x4D, 0x03, 0xEA, 0x00, 0xFD, 0x00, 0x05, 0x00, 0x05, 0xFF, 0x01, 0x03, 0x01, 0x05, 0x0A, 0x0E, 0x13, 0x02, 0xFA, 0x07, 0x00, 0x09, 0x0C, 0x03, 0xF7, 0x00, 0x01, 0xF3, 0xEF, 0x9D, 0xBB}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x3E}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x54, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x3E}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x54, 0x01}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0xBB, 0xF2, 0x27, 0x10, 0xD3, 0x59, 0x00, 0xE2, 0x8D, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xFF}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x54, 0x01}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xFF}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x55, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0xFF, 0x71, 0x02, 0x01, 0x01, 0xFF, 0xFD, 0x08, 0x01, 0x00, 0x01, 0x01, 0xFF, 0x01, 0x0F, 0x61, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x02}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x55, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x02}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x6C, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0xFE, 0xCE, 0x02, 0x03, 0x04, 0x00, 0x12, 0xF0, 0x07, 0xEC, 0x00, 0x00, 0x00, 0xFA, 0xE7, 0xB6, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xA7}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x6C, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xA7}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x59, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x00, 0x22, 0x00, 0x22, 0x00, 0x25, 0x00, 0x2D, 0x00, 0x38, 0x00, 0x23, 0x00, 0x2B, 0x00, 0x23, 0x00, 0x23, 0x00, 0x23, 0x00, 0x26, 0x00, 0x27, 0x00, 0x2E, 0x00, 0x42, 0x00, 0xA0, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x1D}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x59, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x1D}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x6D, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x06, 0x3E, 0x0E, 0xE3, 0x0E, 0xBD, 0x11, 0x59, 0x11, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x5D}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x6D, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x5D}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 1100},
|
||||
},
|
||||
// end chemid
|
||||
// start main config
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x02, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x02, 0x26, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xA5}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x02, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xA5}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x24, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x00, 0x19, 0x28, 0x63, 0x5F, 0xFF, 0x62, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x69}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x24, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x69}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x31, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x0A, 0x0F, 0x02, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xDF}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x31, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xDF}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x40, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x64, 0x79, 0x0F, 0x9F, 0x23, 0x05, 0x00, 0x14, 0x04, 0x00, 0x09, 0x04, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x01}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x40, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x01}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x44, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x00, 0x32, 0x01, 0xC2, 0x30, 0x00, 0x03, 0x08, 0x98, 0x01, 0x00, 0x3C, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xF9}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x44, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xF9}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x50, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x01, 0xF4, 0x00, 0x1E, 0xC8, 0x14, 0x08, 0x00, 0x3C, 0x0E, 0x10, 0x00, 0x0A, 0x46, 0x05, 0x14, 0x05, 0x0F, 0x03, 0x20, 0x7F, 0xFF, 0x00, 0xF0, 0x46, 0x50, 0x18, 0x01, 0x90, 0x00, 0x64, 0x19}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xE4}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x50, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xE4}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x50, 0x01}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0xDC, 0x5C, 0x60, 0x00, 0x7D, 0x00, 0x04, 0x03, 0x19, 0x25, 0x0F, 0x14, 0x0A, 0x78, 0x60, 0x28, 0x01, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x43, 0x80, 0x04, 0x01, 0x14, 0x00, 0x08, 0x0B, 0xB8, 0x01}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xDB}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x50, 0x01}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xDB}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x50, 0x02}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x2C, 0x0A, 0x01, 0x0A, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x64, 0x02, 0x00, 0x00, 0x00, 0x00, 0x07, 0xD0, 0x01, 0x03, 0x5A, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x59}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x50, 0x02}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x59}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x51, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x00, 0xC1, 0x00, 0x7D, 0x01, 0x35, 0x00, 0x3C, 0x3C, 0x01, 0xB3, 0xB3, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x1B}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x51, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x1B}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x52, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x41, 0x53, 0x00, 0x00, 0x00, 0x81, 0x06, 0x09, 0x17, 0x5B, 0x0B, 0xB8, 0x00, 0xC8, 0x00, 0x32, 0x00, 0x14, 0x03, 0xE8, 0x01, 0x00, 0x6E, 0x00, 0x0A, 0xFF, 0xCD, 0xFF, 0xCE, 0x00, 0x01, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x9A}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x52, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x9A}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x59, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x00, 0x30, 0x00, 0x30, 0x00, 0x31, 0x00, 0x38, 0x00, 0x45, 0x00, 0x2E, 0x00, 0x3C, 0x00, 0x34, 0x00, 0x36, 0x00, 0x3A, 0x00, 0x3D, 0x00, 0x3C, 0x00, 0x46, 0x00, 0x6B, 0x00, 0xFC, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xBD}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x59, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xBD}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x6D, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x06, 0x3E, 0x0E, 0xE3, 0x0E, 0xBD, 0x11, 0x59, 0x11, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x5D}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x6D, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0x5D}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x70, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xFF}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x70, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xFF}},
|
||||
.data_len = 1,
|
||||
},
|
||||
// end main config
|
||||
// start cc_gain
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x69, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x40,
|
||||
.data = {.bytes = {0x00, 0x00, 0x0B, 0xD6, 0x7F, 0x73, 0xB6, 0x46, 0x93, 0x0A, 0xA5, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
.data_len = 32,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xCC}},
|
||||
.data_len = 1,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 10},
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x3E,
|
||||
.data = {.bytes = {0x69, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_C,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x60,
|
||||
.data = {.bytes = {0xCC}},
|
||||
.data_len = 1,
|
||||
},
|
||||
// end cc_gain
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x00,
|
||||
.data = {.bytes = {0x00, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_W,
|
||||
.addr = 0xAA,
|
||||
.reg = 0x00,
|
||||
.data = {.bytes = {0x42, 0x00}},
|
||||
.data_len = 2,
|
||||
},
|
||||
{
|
||||
.cmd_type = CMD_X,
|
||||
.data = {.delay = 2000},
|
||||
},
|
||||
};
|
||||
//end of const bqfs_cmd_t li_alt_flip_bqfs_image[]
|
||||
#endif
|
||||
|
|
@ -71,6 +71,10 @@
|
|||
#include "battery_profile/imported/smith_battery_flip_LS40_0826-bq27426G1-2766.gm.fs.h"
|
||||
#endif
|
||||
|
||||
#ifdef ATL_NM40_712MAH_BATTERY_PROFILE
|
||||
#include "battery_profile/imported/alt_nm40_712mah_bq27426g1.gm.fs.h"
|
||||
#endif
|
||||
|
||||
#undef pr_debug
|
||||
#define pr_debug pr_err
|
||||
#undef pr_info
|
||||
|
|
@ -197,6 +201,12 @@ static struct batt_chem_id batt_chem_id_arr[] = {
|
|||
{3142, FG_SUBCMD_CHEM_C},
|
||||
};
|
||||
|
||||
enum temp_source {
|
||||
TEMP_SOURCE_INTERNAL = 0,
|
||||
TEMP_SOURCE_EXTERNAL,
|
||||
TEMP_SOURCE_HOST,
|
||||
};
|
||||
|
||||
static const struct fg_batt_profile bqfs_image[] = {
|
||||
|
||||
#ifdef ATL_4000MAH_8A_BATTERY_PROFILE
|
||||
|
|
@ -215,6 +225,10 @@ static const struct fg_batt_profile bqfs_image[] = {
|
|||
{.batt_type_str = "LS40_ATL_1545MAH", .bqfs_image = smith_flip_bqfs_image, .array_size = ARRAY_SIZE(smith_flip_bqfs_image), .chem_id = 0x2766, .dm_ver = 5},
|
||||
#endif
|
||||
|
||||
#ifdef ATL_NM40_712MAH_BATTERY_PROFILE
|
||||
{.batt_type_str = "NM40_ATL_712MAH", .bqfs_image = li_alt_flip_bqfs_image, .array_size = ARRAY_SIZE(li_alt_flip_bqfs_image), .chem_id = 0x2766, .dm_ver = 5},
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
const unsigned char *device2str[] = {
|
||||
|
|
@ -308,6 +322,7 @@ struct bq_fg_chip {
|
|||
unsigned long last_update;
|
||||
const char *batt_profile_name;
|
||||
const char *batt_name;
|
||||
u32 temp_source;
|
||||
|
||||
/* debug */
|
||||
int skip_reads;
|
||||
|
|
@ -671,7 +686,7 @@ static int fg_unseal(struct bq_fg_chip *bq, u32 key)
|
|||
}
|
||||
|
||||
|
||||
static int fg_unseal_fa(struct bq_fg_chip *bq, u32 key)
|
||||
int fg_unseal_fa(struct bq_fg_chip *bq, u32 key)
|
||||
{
|
||||
int ret;
|
||||
int retry = 0;
|
||||
|
|
@ -790,7 +805,7 @@ static int fg_read_dm_version(struct bq_fg_chip* bq, u8 *ver)
|
|||
}
|
||||
|
||||
#define CFG_UPDATE_POLLING_RETRY_LIMIT 50
|
||||
static int fg_dm_pre_access(struct bq_fg_chip *bq)
|
||||
int fg_dm_pre_access(struct bq_fg_chip *bq)
|
||||
{
|
||||
int ret;
|
||||
int i = 0;
|
||||
|
|
@ -822,7 +837,7 @@ static int fg_dm_pre_access(struct bq_fg_chip *bq)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(fg_dm_pre_access);
|
||||
|
||||
static int fg_dm_post_access(struct bq_fg_chip *bq)
|
||||
int fg_dm_post_access(struct bq_fg_chip *bq)
|
||||
{
|
||||
int ret;
|
||||
int i = 0;
|
||||
|
|
@ -856,7 +871,7 @@ static int fg_dm_enter_cfg_mode(struct bq_fg_chip *bq)
|
|||
return fg_dm_pre_access(bq);
|
||||
}
|
||||
|
||||
static int fg_dm_exit_cfg_mode(struct bq_fg_chip *bq)
|
||||
int fg_dm_exit_cfg_mode(struct bq_fg_chip *bq)
|
||||
{
|
||||
int ret;
|
||||
int i = 0;
|
||||
|
|
@ -894,7 +909,7 @@ EXPORT_SYMBOL_GPL(fg_dm_exit_cfg_mode);
|
|||
#define DM_ACCESS_BLOCK_DATA 0x40
|
||||
|
||||
|
||||
static int fg_dm_read_block(struct bq_fg_chip *bq, u8 classid,
|
||||
int fg_dm_read_block(struct bq_fg_chip *bq, u8 classid,
|
||||
u8 offset, u8 *buf)
|
||||
{
|
||||
int ret;
|
||||
|
|
@ -931,7 +946,7 @@ static int fg_dm_read_block(struct bq_fg_chip *bq, u8 classid,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(fg_dm_read_block);
|
||||
|
||||
static int fg_dm_write_block(struct bq_fg_chip *bq, u8 classid,
|
||||
int fg_dm_write_block(struct bq_fg_chip *bq, u8 classid,
|
||||
u8 offset, u8 *data)
|
||||
{
|
||||
int ret;
|
||||
|
|
@ -1563,7 +1578,7 @@ static int fg_read_chem_id(struct bq_fg_chip *bq, u16 *chem_id)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int fg_change_chem_id(struct bq_fg_chip *bq, u16 new_id)
|
||||
int fg_change_chem_id(struct bq_fg_chip *bq, u16 new_id)
|
||||
{
|
||||
int ret;
|
||||
u16 old_id;
|
||||
|
|
@ -1662,7 +1677,7 @@ static int fg_check_update_necessary(struct bq_fg_chip *bq)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool fg_update_bqfs_execute_cmd(struct bq_fg_chip *bq,
|
||||
bool fg_update_bqfs_execute_cmd(struct bq_fg_chip *bq,
|
||||
const bqfs_cmd_t *cmd)
|
||||
{
|
||||
int ret;
|
||||
|
|
@ -1710,7 +1725,7 @@ static bool fg_update_bqfs_execute_cmd(struct bq_fg_chip *bq,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(fg_update_bqfs_execute_cmd);
|
||||
|
||||
static void fg_update_bqfs(struct bq_fg_chip *bq)
|
||||
void fg_update_bqfs(struct bq_fg_chip *bq)
|
||||
{
|
||||
int i;
|
||||
const bqfs_cmd_t *image;
|
||||
|
|
@ -1984,7 +1999,7 @@ static const struct attribute_group fg_attr_group = {
|
|||
.attrs = fg_attributes,
|
||||
};
|
||||
|
||||
static int fg_enable_sleep(struct bq_fg_chip *bq, bool enable)
|
||||
int fg_enable_sleep(struct bq_fg_chip *bq, bool enable)
|
||||
{
|
||||
|
||||
int ret;
|
||||
|
|
@ -2021,7 +2036,7 @@ static int fg_enable_sleep(struct bq_fg_chip *bq, bool enable)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(fg_enable_sleep);
|
||||
|
||||
static int fg_set_term_voltage(struct bq_fg_chip *bq, int volt)
|
||||
int fg_set_term_voltage(struct bq_fg_chip *bq, int volt)
|
||||
{
|
||||
int ret;
|
||||
u8 rd_buf[64];
|
||||
|
|
@ -2054,7 +2069,7 @@ static int fg_set_term_voltage(struct bq_fg_chip *bq, int volt)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(fg_set_term_voltage);
|
||||
|
||||
static int fg_set_term_curr(struct bq_fg_chip *bq, int val)
|
||||
int fg_set_term_curr(struct bq_fg_chip *bq, int val)
|
||||
{
|
||||
int ret = -1, curr = 0;
|
||||
u8 rd_buf[64];
|
||||
|
|
@ -2105,7 +2120,8 @@ static int fg_set_term_curr(struct bq_fg_chip *bq, int val)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(fg_set_term_curr);
|
||||
|
||||
static int fg_select_external_temp(struct bq_fg_chip *bq)
|
||||
#define TEMP_SOURCE_MASK 0x03
|
||||
int fg_select_external_temp(struct bq_fg_chip *bq)
|
||||
{
|
||||
int ret;
|
||||
u8 rd_buf[64];
|
||||
|
|
@ -2125,7 +2141,8 @@ static int fg_select_external_temp(struct bq_fg_chip *bq)
|
|||
return ret;
|
||||
}
|
||||
|
||||
rd_buf[1] |=0x01; // set external temp source
|
||||
rd_buf[1] &= ~TEMP_SOURCE_MASK;
|
||||
rd_buf[1] |= (bq->temp_source & TEMP_SOURCE_MASK);
|
||||
|
||||
ret = fg_dm_write_block(bq, 64, 0, rd_buf);
|
||||
|
||||
|
|
@ -2136,7 +2153,7 @@ static int fg_select_external_temp(struct bq_fg_chip *bq)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(fg_select_external_temp);
|
||||
|
||||
static int fg_dodateoc_delta_t(struct bq_fg_chip *bq)
|
||||
int fg_dodateoc_delta_t(struct bq_fg_chip *bq)
|
||||
{
|
||||
int ret;
|
||||
u8 rd_buf[64];
|
||||
|
|
@ -2344,6 +2361,10 @@ static int bq_parse_dt(struct bq_fg_chip *bq)
|
|||
if (rc < 0)
|
||||
bq->batt_dc_conf = 0;;
|
||||
|
||||
rc = of_property_read_u32(node, "mmi,temp-source", &bq->temp_source);
|
||||
if (rc < 0)
|
||||
bq->temp_source = TEMP_SOURCE_EXTERNAL;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -2439,7 +2460,7 @@ static int bq_fg_probe(struct i2c_client *client,
|
|||
bq->resume_completed = true;
|
||||
bq->irq_waiting = false;
|
||||
|
||||
bq->regmap = regmap_init_i2c(client, &bq27426_regmap_config);
|
||||
bq->regmap = devm_regmap_init_i2c(client, &bq27426_regmap_config);
|
||||
if (IS_ERR(bq->regmap)) {
|
||||
pr_err("Couldn't initialize register regmap rc = %ld\n",
|
||||
PTR_ERR(bq->regmap));
|
||||
|
|
@ -2453,6 +2474,15 @@ static int bq_fg_probe(struct i2c_client *client,
|
|||
goto free_mem;
|
||||
}
|
||||
|
||||
bq->vdd_i2c_vreg = devm_regulator_get_optional(&client->dev, "vdd-i2c");
|
||||
if (IS_ERR_OR_NULL(bq->vdd_i2c_vreg)) {
|
||||
dev_err(&client->dev, "Could not get vdd-i2c power regulator\n");
|
||||
} else {
|
||||
ret = regulator_enable(bq->vdd_i2c_vreg);
|
||||
if (ret)
|
||||
dev_err(&client->dev, "Could not enable vdd-i2c power regulator\n");
|
||||
}
|
||||
|
||||
ret = fg_read_fw_version(bq);
|
||||
if (ret < 0) {
|
||||
mmi_fg_err(bq, "could not read fg version (maybe no fg connected?) ret = %d\n", ret);
|
||||
|
|
@ -2576,6 +2606,12 @@ static int bq_fg_remove(struct i2c_client *client)
|
|||
debugfs_remove_recursive(bq->debug_root);
|
||||
sysfs_remove_group(&bq->dev->kobj, &fg_attr_group);
|
||||
|
||||
if (!IS_ERR_OR_NULL(bq->vdd_i2c_vreg)) {
|
||||
if (regulator_is_enabled(bq->vdd_i2c_vreg))
|
||||
regulator_disable(bq->vdd_i2c_vreg);
|
||||
devm_regulator_put(bq->vdd_i2c_vreg);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue