summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJing Wang <jwangh@google.com>2023-04-01 03:21:20 +0000
committerJing Wang <jwangh@google.com>2023-04-01 04:19:42 +0000
commitd3fa652b8f9498486149a2b49cafcceba7358099 (patch)
tree7ee69e9f94b4c929a94bb2692b8f87feb2b4372e
parentf712abc5966e36bed62e9417e41b991267161d75 (diff)
downloadgoodix_touch-d3fa652b8f9498486149a2b49cafcceba7358099.tar.gz
Revert "touch/goodix: Initialize the devices by order"
Revert submission 2421158-ct3_touch_bringup Reason for revert: b/276521272 Reverted changes: /q/submissionid:2421158-ct3_touch_bringup Change-Id: I35ff0fddd31099de250a2fd977469d60dd089487
-rw-r--r--goodix_brl_spi.c8
-rw-r--r--goodix_ts_core.c47
-rw-r--r--goodix_ts_core.h1
3 files changed, 3 insertions, 53 deletions
diff --git a/goodix_brl_spi.c b/goodix_brl_spi.c
index 1d0b295..e3421b9 100644
--- a/goodix_brl_spi.c
+++ b/goodix_brl_spi.c
@@ -344,6 +344,7 @@ static int goodix_spi_probe(struct spi_device *spi)
dev_res = kzalloc(sizeof(*dev_res), GFP_KERNEL);
if (!dev_res)
return -ENOMEM;
+ goodix_device_register(dev_res);
/* get ic type */
ret = goodix_get_ic_type(spi->dev.of_node, &dev_res->bus);
@@ -360,19 +361,14 @@ static int goodix_spi_probe(struct spi_device *spi)
}
dev_res->bus.write = goodix_spi_write;
-/* [GOOG]
- * Move goodix_device_register() after `dev_res->bus.dev` assigned.
- * This will help to set the `struct device *dev` early.
- */
- goodix_device_register(dev_res);
+ /* [GOOG] */
dev_res->bus.rx_buf = kzalloc(SPI_PREALLOC_RX_BUF_SIZE, GFP_KERNEL);
dev_res->bus.tx_buf = kzalloc(SPI_PREALLOC_TX_BUF_SIZE, GFP_KERNEL);
if (!dev_res->bus.rx_buf || !dev_res->bus.tx_buf) {
ret = -ENOMEM;
goto err_pdev;
}
-/*~[GOOG] */
mutex_init(&dev_res->bus.mutex);
dev_res->bus.dma_mode_enabled = false;
diff --git a/goodix_ts_core.c b/goodix_ts_core.c
index 6105a99..8dd3246 100644
--- a/goodix_ts_core.c
+++ b/goodix_ts_core.c
@@ -36,39 +36,6 @@ struct goodix_device_manager goodix_devices;
static const struct dev_pm_ops dev_pm_ops; /* [GOOG] */
-/*
- * [GOOG]
- * Wait device to complete the init stage2 by order.
- */
-static void goodix_wait_for_init_stage2_start(struct goodix_ts_core *current_cd)
-{
- struct goodix_device_resource *res, *next;
- struct goodix_ts_core *cd;
-
- if (!goodix_devices.initialized)
- return;
-
- if (list_empty(&goodix_devices.list))
- return;
-
- list_for_each_entry_safe(res, next, &goodix_devices.list, list) {
- cd = &res->core_data;
- if (res->id >= current_cd->pdev->id ||
- cd->init_stage != CORE_INIT_STAGE1) {
- continue;
- }
-
- /* Wait device to complete the init stage1 */
- if (wait_for_completion_timeout(&cd->init_stage2_complete,
- msecs_to_jiffies(2 * MSEC_PER_SEC)) == 0)
- ts_info("device#%d wait device#%d timeout to complete init state2!",
- current_cd->pdev->id, res->id);
- else
- ts_info("device#%d complete init stage2", res->id);
- }
-}
-
-
static void goodix_device_manager_init(void)
{
if (goodix_devices.initialized)
@@ -92,22 +59,14 @@ static void goodix_device_manager_exit(void)
int goodix_device_register(struct goodix_device_resource *device)
{
- u32 dev_id; /* [GOOG] */
-
if (!device)
return -ENXIO;
mutex_lock(&goodix_devices.mutex);
list_add(&device->list, &goodix_devices.list);
- dev_id = goodix_devices.nums++;
- if (device->bus.dev) {
- of_property_read_u32(device->bus.dev->of_node,
- "goodix,dev-id", &dev_id); /* [GOOG] */
- }
- device->id = dev_id;
+ device->id = goodix_devices.nums++;
sprintf(device->name, "%s.%d", GOODIX_CORE_DRIVER_NAME, device->id);
mutex_unlock(&goodix_devices.mutex);
- init_completion(&device->core_data.init_stage2_complete); /* [GOOG] */
ts_info("register device %s", device->name);
return 0;
@@ -2794,8 +2753,6 @@ static int goodix_later_init_thread(void *data)
struct goodix_ts_core *cd = data;
struct goodix_ts_hw_ops *hw_ops = cd->hw_ops;
- goodix_wait_for_init_stage2_start(cd); /* [GOOG] */
-
/* step 1: read version */
ret = cd->hw_ops->read_version(cd, &cd->fw_version);
if (ret < 0) {
@@ -2847,8 +2804,6 @@ static int goodix_later_init_thread(void *data)
}
cd->init_stage = CORE_INIT_STAGE2;
- complete_all(&cd->init_stage2_complete); /* [GOOG] */
-
return 0;
uninit_fw:
diff --git a/goodix_ts_core.h b/goodix_ts_core.h
index cfd7bca..bb03a78 100644
--- a/goodix_ts_core.h
+++ b/goodix_ts_core.h
@@ -843,7 +843,6 @@ struct goodix_ts_core {
s16 heatmap_diff[GOODIX_MAX_DRV_NUM * GOODIX_MAX_SEN_NUM];
s16 heatmap_selfdiff[GOODIX_MAX_DRV_NUM + GOODIX_MAX_SEN_NUM];
*/
- struct completion init_stage2_complete;
struct touch_apis_data apis_data;
struct workqueue_struct *event_wq;
struct delayed_work monitor_gesture_work;