diff --git a/drivers/misc/aw9610x/Android.mk b/drivers/misc/aw9610x/Android.mk index f10972226216..f420be375df1 100644 --- a/drivers/misc/aw9610x/Android.mk +++ b/drivers/misc/aw9610x/Android.mk @@ -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 diff --git a/drivers/misc/aw9610x/Kbuild b/drivers/misc/aw9610x/Kbuild index 2493e45af5ff..e1ad7ee0d2cf 100644 --- a/drivers/misc/aw9610x/Kbuild +++ b/drivers/misc/aw9610x/Kbuild @@ -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)) diff --git a/drivers/misc/aw9610x/aw9610x_sar.c b/drivers/misc/aw9610x/aw9610x_sar.c index f4129f5d7c3a..121762044caf 100644 --- a/drivers/misc/aw9610x/aw9610x_sar.c +++ b/drivers/misc/aw9610x/aw9610x_sar.c @@ -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!"); diff --git a/include/linux/input/aw9610x.h b/include/linux/input/aw9610x.h index 3afac62f1c5f..12c751a5b2c1 100644 --- a/include/linux/input/aw9610x.h +++ b/include/linux/input/aw9610x.h @@ -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;