From e5de27e68ea57f7a06c736cbd066f30ff397c802 Mon Sep 17 00:00:00 2001 From: Rafael Ortolan Date: Wed, 7 Jun 2023 13:36:58 -0300 Subject: [PATCH] nova_0flash_mmi: conditionally enable spi CS delay feature Following changes are made to fix Devon build issue: - conditionally enable spi CS Hold Time feature based on product flag - include proper spi header file depending on kernel version For details please refer to: https://gerrit.mot.com/2630767 Change-Id: I7d1e6e55ccde912442f11c71f1f92e5302318315 Reviewed-on: https://gerrit.mot.com/2637062 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Bruno Oliveira Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c index db568c60c033..eaa94a0f9d20 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c +++ b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c @@ -26,7 +26,14 @@ #include #include #include + +#ifdef CONFIG_SPI_SM8450 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) #include +#else +#include +#endif +#endif #ifndef CONFIG_INPUT_TOUCHSCREEN_MMI #if ((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) || defined(NVT_CONFIG_DRM_PANEL)) @@ -2753,7 +2760,9 @@ return: static int32_t nvt_ts_probe(struct spi_device *client) { int32_t ret = 0; +#ifdef CONFIG_SPI_SM8450 struct spi_geni_qcom_ctrl_data *spi_param = NULL; +#endif #if ((TOUCH_KEY_NUM > 0) || WAKEUP_GESTURE) int32_t retry = 0; #endif @@ -2799,12 +2808,14 @@ static int32_t nvt_ts_probe(struct spi_device *client) goto err_malloc_rbuf; } +#ifdef CONFIG_SPI_SM8450 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; } +#endif ts->client = client; spi_set_drvdata(client, ts); @@ -3304,11 +3315,13 @@ err_gpio_config_failed: err_spi_setup: err_ckeck_full_duplex: spi_set_drvdata(client, NULL); +#ifdef CONFIG_SPI_SM8450 if (spi_param) { devm_kfree(&client->dev ,spi_param); spi_param = NULL; } err_malloc_spi_param: +#endif if (ts->rbuf) { kfree(ts->rbuf); ts->rbuf = NULL;