summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Muellner <christoph.muellner@theobroma-systems.com>2019-10-09 16:10:09 +0200
committerChristoph Muellner <christoph.muellner@theobroma-systems.com>2019-10-09 16:25:50 +0200
commit8f8268807163d0f44a96681f708baeccaca0b4d1 (patch)
treed6e6421a7fcc8d49cb5899460706ae14e444221a
parent0d5509902d9fad2a415d42ce556b2bccb5ade9e2 (diff)
gt9xx: Allow DTS to reverse x/y coordinates.
This patch adds two flags "reverse-x" and "reverse-y", which can be used to reverse the X or Y coordinates reported by the gt9xx. Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
-rw-r--r--drivers/input/touchscreen/gt9xx/gt9xx.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/input/touchscreen/gt9xx/gt9xx.c b/drivers/input/touchscreen/gt9xx/gt9xx.c
index 6db7e395f82b..302efa6a5389 100644
--- a/drivers/input/touchscreen/gt9xx/gt9xx.c
+++ b/drivers/input/touchscreen/gt9xx/gt9xx.c
@@ -2591,6 +2591,7 @@ static int goodix_ts_probe(struct i2c_client *client, const struct i2c_device_id
struct device_node *np = client->dev.of_node;
enum of_gpio_flags rst_flags, pwr_flags;
+ bool reverse_x, reverse_y;
u32 val;
printk("%s() start\n", __func__);
@@ -2626,37 +2627,40 @@ static int goodix_ts_probe(struct i2c_client *client, const struct i2c_device_id
return -EINVAL;
}
+ reverse_x = of_property_read_bool(np, "reverse-x");
+ reverse_y = of_property_read_bool(np, "reverse-y");
+
if (val == 89) {
m89or101 = TRUE;
gtp_change_x2y = TRUE;
- gtp_x_reverse = FALSE;
- gtp_y_reverse = TRUE;
+ gtp_x_reverse = reverse_x ? TRUE : FALSE;
+ gtp_y_reverse = reverse_y ? FALSE: TRUE;
} else if (val == 101) {
m89or101 = FALSE;
gtp_change_x2y = TRUE;
- gtp_x_reverse = TRUE;
- gtp_y_reverse = FALSE;
+ gtp_x_reverse = reverse_x ? FALSE : TRUE;
+ gtp_y_reverse = reverse_y ? TRUE : FALSE;
} else if (val == 911) {
m89or101 = FALSE;
bgt911 = TRUE;
gtp_change_x2y = TRUE;
- gtp_x_reverse = FALSE;
- gtp_y_reverse = TRUE;
+ gtp_x_reverse = reverse_x ? TRUE : FALSE;
+ gtp_y_reverse = reverse_y ? FALSE : TRUE;
} else if (val == 970) {
m89or101 = FALSE;
bgt911 = FALSE;
bgt970 = TRUE;
gtp_change_x2y = FALSE;
- gtp_x_reverse = FALSE;
- gtp_y_reverse = TRUE;
+ gtp_x_reverse = reverse_x ? TRUE : FALSE;
+ gtp_y_reverse = reverse_y ? FALSE : TRUE;
} else if (val == 910) {
m89or101 = FALSE;
bgt911 = FALSE;
bgt970 = FALSE;
bgt910 = TRUE;
gtp_change_x2y = TRUE;
- gtp_x_reverse = FALSE;
- gtp_y_reverse = TRUE;
+ gtp_x_reverse = reverse_x ? TRUE : FALSE;
+ gtp_y_reverse = reverse_y ? FALSE : TRUE;
}
ts->tp_regulator = devm_regulator_get(&client->dev, "tp");