Devon:seperated DVT1/DVT2 sar sensor firmware

WHY:sar sensor need seperated firmware
HOW:support multi firmware

Change-Id: I2a77adb3dea88b57f9f4a85ad463f1d992dfdae4
Signed-off-by: wunan3 <wunan3@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2237527
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Hong Zhang <zhangh12@motorola.com>
Reviewed-by: Wang Wang <wangwang1@lenovo.com>
Submit-Approved: Jira Key
This commit is contained in:
wunan3 2022-04-08 21:18:19 +08:00 • committed by Nan Wu
commit 5739c4fae5
4 changed files with 29 additions and 0 deletions

View file

@ -5,6 +5,10 @@ ifeq ($(AW9610X_USB_USE_ONLINE),true)
KBUILD_OPTIONS += CONFIG_AW9610X_POWER_SUPPLY_ONLINE=y
endif
ifeq ($(AW9610X_HARDWARE_VERSION),true)
KBUILD_OPTIONS += CONFIG_AW9610X_HARDWARE_VERSION=y
endif
include $(CLEAR_VARS)
LOCAL_MODULE := aw9610x.ko
LOCAL_MODULE_TAGS := optional

View file

@ -12,6 +12,11 @@ ifneq ($(filter m y,$(CONFIG_AW9610X_POWER_SUPPLY_ONLINE)),)
EXTRA_CFLAGS += -DCONFIG_USE_POWER_SUPPLY_ONLINE
endif
ifneq ($(filter m y,$(CONFIG_AW9610X_HARDWARE_VERSION)),)
EXTRA_CFLAGS += -DCONFIG_USE_HARDWARE_VERSION
endif
ifneq (,$(KERNEL_DIR_PATH))
EXTRA_CFLAGS += -I$(ANDROID_BUILD_TOP)/kernel/$(KERNEL_VERSION_NAME)/drivers/base
else ifneq (,$(KERNEL_PLATFORM_PATH))

View file

@ -702,9 +702,15 @@ static int32_t aw9610x_cfg_update(struct aw9610x *aw9610x)
LOG_DBG("enter");
if (aw9610x->firmware_flag == true) {
#ifdef CONFIG_USE_HARDWARE_VERSION
snprintf(aw9610x->cfg_name, sizeof(aw9610x->cfg_name),
"aw9610x_%d.bin", aw9610x->hw_version);
#else
snprintf(aw9610x->cfg_name, sizeof(aw9610x->cfg_name),
"aw9610x_%d.bin", aw9610x->sar_num);
#endif
LOG_INFO("aw9610x_cfg_update cfg_name = %s", aw9610x->cfg_name);
request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG,
aw9610x->cfg_name,
aw9610x->dev,
@ -1774,6 +1780,17 @@ static int32_t aw9610x_parse_dt(struct device *dev, struct aw9610x *aw9610x,
} else {
LOG_INFO("sar num = %d", aw9610x->sar_num);
}
#ifdef CONFIG_USE_HARDWARE_VERSION
val = of_property_read_u32(np, "hardware_version", &aw9610x->hw_version);
if (val != 0) {
LOG_ERR("hardware_version failed!");
return -AW_MULTIPLE_SAR_FAILED;
} else {
LOG_INFO("hardware version = %d", aw9610x->hw_version);
}
#endif
val = of_property_read_u32(np, "aw9610x,channel_number", &aw9610x->aw_channel_number);
if (val != 0) {
LOG_ERR("aw_channel_number failed!");

View file

@ -198,6 +198,9 @@ struct aw9610x {
int32_t vcc_3v0_Pin;
int32_t pwr_by_gpio;
uint32_t sar_num;
#ifdef CONFIG_USE_HARDWARE_VERSION
uint32_t hw_version;
#endif
int32_t irq_gpio;
int32_t to_irq;
uint32_t irq_status;