diff options
author | Wendly Li <wendlyli@google.com> | 2023-03-21 04:22:44 +0000 |
---|---|---|
committer | Wendly Li <wendlyli@google.com> | 2023-03-21 09:50:38 +0000 |
commit | caacac38ecf3a00b7715817444a6cc490867413f (patch) | |
tree | 4454a4f0692e63327d46f2f3ae5f5b9a0bb68963 | |
parent | ae89c6f045b0c9d0482ed0315241bd5027b33fff (diff) | |
download | common-caacac38ecf3a00b7715817444a6cc490867413f.tar.gz |
touch/common: add TBN mock mode
Bug: 266093523
Test: Check mock mode works properly
Change-Id: I2ae3ba4a91882d93f8f657f483b7829310ef12a3
Signed-off-by: Wendly Li <wendlyli@google.com>
-rw-r--r-- | touch_bus_negotiator.c | 10 | ||||
-rw-r--r-- | touch_bus_negotiator.h | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/touch_bus_negotiator.c b/touch_bus_negotiator.c index f1361d8..51898a0 100644 --- a/touch_bus_negotiator.c +++ b/touch_bus_negotiator.c @@ -209,12 +209,12 @@ int tbn_handshaking(struct tbn_context *tbn, enum TbnOperation operation) return -EINVAL; } - reinit_completion(wait_for_completion); - if (tbn->mode == TBN_MODE_GPIO) { int ap2aoc_val_org = gpio_get_value(tbn->ap2aoc_gpio); int aoc2ap_val_org = gpio_get_value(tbn->aoc2ap_gpio); + reinit_completion(wait_for_completion); + irq_set_irq_type(tbn->aoc2ap_irq, irq_type); enable_irq(tbn->aoc2ap_irq); gpio_direction_output(tbn->ap2aoc_gpio, bus_owner); @@ -240,6 +240,8 @@ int tbn_handshaking(struct tbn_context *tbn, enum TbnOperation operation) tbn->event_resp.lptw_triggered = false; tbn->event_resp.err = 0; + reinit_completion(wait_for_completion); + send_tbn_event(tbn, operation); if (wait_for_completion_timeout(wait_for_completion, msecs_to_jiffies(timeout)) == 0) { @@ -255,6 +257,8 @@ int tbn_handshaking(struct tbn_context *tbn, enum TbnOperation operation) } } #endif + } else if (tbn->mode == TBN_MODE_MOCK) { + dev_info(tbn->dev, "AP %s bus ... SUCCESS!\n", msg); } else { ret = -EINVAL; } @@ -476,6 +480,8 @@ static int tbn_probe(struct platform_device *pdev) goto failed; } #endif + } else if (tbn->mode == TBN_MODE_MOCK) { + err = 0; } else { dev_err(tbn->dev, "bus negotiator: invalid mode: %d\n", tbn->mode); err = -EINVAL; diff --git a/touch_bus_negotiator.h b/touch_bus_negotiator.h index a7c971f..5697489 100644 --- a/touch_bus_negotiator.h +++ b/touch_bus_negotiator.h @@ -19,6 +19,7 @@ enum tbn_mode { TBN_MODE_DISABLED = 0, TBN_MODE_GPIO, TBN_MODE_AOC_CHANNEL, + TBN_MODE_MOCK, }; enum tbn_bus_owner { |