diff options
author | Wendly Li <wendlyli@google.com> | 2022-05-16 12:41:11 +0000 |
---|---|---|
committer | Wendly Li <wendlyli@google.com> | 2022-05-24 13:08:48 +0000 |
commit | aac08b5bc1260df075c1e5e177b5ea41d406ea6b (patch) | |
tree | d5109901e432d66596e195ee51a90eb337fe1236 /goodix_ts_utils.c | |
parent | 2066943eca0910f544389120ff8c4e503f2ccbc6 (diff) | |
download | goodix_touch-aac08b5bc1260df075c1e5e177b5ea41d406ea6b.tar.gz |
goodix: Support reading mutual and self sensing data
Bug: 214118837
Test: Check driver can read mutual and self sensing data
Change-Id: Id4afa4c902dc0bc3310467387fc6f7f4f2af4498
Signed-off-by: Wendly Li <wendlyli@google.com>
Diffstat (limited to 'goodix_ts_utils.c')
-rw-r--r-- | goodix_ts_utils.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/goodix_ts_utils.c b/goodix_ts_utils.c index 1d24cea..7649759 100644 --- a/goodix_ts_utils.c +++ b/goodix_ts_utils.c @@ -124,30 +124,34 @@ u32 goodix_get_file_config_id(u8 *ic_config) } /* matrix transpose */ -void goodix_rotate_abcd2cbad(int tx, int rx, s16 *data) +void goodix_rotate_abcd2cbad(int tx, int rx, s16 *src, s16 *dest) { - s16 *temp_buf = NULL; + s16 *temp_buf = dest; int size = tx * rx; - int i; - int j; - int col; - - temp_buf = kcalloc(size, sizeof(s16), GFP_KERNEL); - if (!temp_buf) { - ts_err("malloc failed"); - return; + int x; + s16 *curr; + int index_org = 0; + + if (dest == NULL) { + temp_buf = kcalloc(size, sizeof(s16), GFP_KERNEL); + if (!temp_buf) { + ts_err("malloc failed"); + return; + } } - for (i = 0, j = 0, col = 0; i < size; i++) { - temp_buf[i] = data[j++ * rx + col]; - if (j == tx) { - j = 0; - col++; + curr = temp_buf; + for (x = 0; x < rx; x++) { + for (index_org = x; index_org < size; index_org += rx) { + *curr = src[index_org]; + curr++; } } - memcpy(data, temp_buf, size * sizeof(s16)); - kfree(temp_buf); + if (dest == NULL) { + memcpy(src, temp_buf, size * sizeof(s16)); + kfree(temp_buf); + } } /* get ic type */ |