diff --git a/drivers/input/touchscreen/nova_0flash_mmi/Android.mk b/drivers/input/touchscreen/nova_0flash_mmi/Android.mk index 4eb482c2b541..b3ca01349708 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/Android.mk +++ b/drivers/input/touchscreen/nova_0flash_mmi/Android.mk @@ -79,6 +79,10 @@ ifeq ($(GTP_ENABLE_DDA_STYLUS),true) KBUILD_OPTIONS += CONFIG_GTP_DDA_STYLUS=y endif +ifeq ($(NVT_SPI_TIMING_CTRL),true) + KBUILD_OPTIONS += CONFIG_SPI_SM8450=y +endif + include $(CLEAR_VARS) ifneq ($(BOARD_USES_DOUBLE_TAP),) LOCAL_ADDITIONAL_DEPENDENCIES += $(KERNEL_MODULES_OUT)/sensors_class.ko diff --git a/drivers/input/touchscreen/nova_0flash_mmi/Kbuild b/drivers/input/touchscreen/nova_0flash_mmi/Kbuild index 5f75220945c0..f51b69cd4bdb 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/Kbuild +++ b/drivers/input/touchscreen/nova_0flash_mmi/Kbuild @@ -60,6 +60,10 @@ ifneq ($(filter m y, $(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)),) EXTRA_CFLAGS += -DCONFIG_BOARD_USES_DOUBLE_TAP_CTRL endif +ifneq ($(filter m y, $(CONFIG_SPI_SM8450)),) + EXTRA_CFLAGS += -DCONFIG_SPI_SM8450 +endif + nova_0flash_mmi-objs += nt36xxx.o nova_0flash_mmi-objs += nt36xxx_ext_proc.o nova_0flash_mmi-objs += nt36xxx_fw_update.o diff --git a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c index 7227f45c179d..db568c60c033 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c +++ b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c @@ -26,6 +26,7 @@ #include #include #include +#include #ifndef CONFIG_INPUT_TOUCHSCREEN_MMI #if ((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) || defined(NVT_CONFIG_DRM_PANEL)) @@ -2752,6 +2753,7 @@ return: static int32_t nvt_ts_probe(struct spi_device *client) { int32_t ret = 0; + struct spi_geni_qcom_ctrl_data *spi_param = NULL; #if ((TOUCH_KEY_NUM > 0) || WAKEUP_GESTURE) int32_t retry = 0; #endif @@ -2797,6 +2799,13 @@ static int32_t nvt_ts_probe(struct spi_device *client) goto err_malloc_rbuf; } + spi_param = devm_kzalloc(&client->dev, sizeof(spi_param), GFP_KERNEL); + if(spi_param == NULL) { + NVT_ERR("devm_kzalloc for spi_param failed!\n"); + ret = -ENOMEM; + goto err_malloc_spi_param; + } + ts->client = client; spi_set_drvdata(client, ts); @@ -2828,6 +2837,12 @@ static int32_t nvt_ts_probe(struct spi_device *client) ts->client->controller_data = (void *)&ts->spi_ctrl; #endif +#ifdef CONFIG_SPI_SM8450 + /* Initialize the driver data */ + spi_param->spi_cs_clk_delay = 2; + client->controller_data = spi_param; +#endif + NVT_LOG("mode=%d, max_speed_hz=%d\n", ts->client->mode, ts->client->max_speed_hz); //---parse dts--- @@ -3289,6 +3304,11 @@ err_gpio_config_failed: err_spi_setup: err_ckeck_full_duplex: spi_set_drvdata(client, NULL); + if (spi_param) { + devm_kfree(&client->dev ,spi_param); + spi_param = NULL; + } +err_malloc_spi_param: if (ts->rbuf) { kfree(ts->rbuf); ts->rbuf = NULL;