mirror of https://github.com/hak5/openwrt.git
80 lines
2.8 KiB
Diff
80 lines
2.8 KiB
Diff
From 2e2493cd07405dfa88e53199b47bdbbb5336fdce Mon Sep 17 00:00:00 2001
|
|
From: Hans de Goede <hdegoede@redhat.com>
|
|
Date: Mon, 16 Jun 2014 20:01:12 +0200
|
|
Subject: [PATCH] touchscreen: sun4i-ts: A10 (sun4i) has a different
|
|
temperature curve
|
|
|
|
Testing has revealed that the temperature in the rtp controller of the A10
|
|
(sun4i) SoC has a different curve then on the A13 (sun5i) and later models.
|
|
|
|
Add a new sun5i-a13-ts compatible to differentiate the newer models and
|
|
set the curve based on the compatible string.
|
|
|
|
This fixes the temperature reported on the A10 being much higher then
|
|
expected.
|
|
|
|
Note the new curve is still not ideal on all A10-s, that seems to have to
|
|
do with there being a large spread between different A10-s out there.
|
|
|
|
Reported-by: Tong Zhang <lovewilliam@gmail.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
---
|
|
.../devicetree/bindings/input/touchscreen/sun4i.txt | 2 +-
|
|
drivers/input/touchscreen/sun4i-ts.c | 13 ++++++++++++-
|
|
2 files changed, 13 insertions(+), 2 deletions(-)
|
|
|
|
--- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
|
|
+++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
|
|
@@ -2,7 +2,7 @@ sun4i resistive touchscreen controller
|
|
--------------------------------------
|
|
|
|
Required properties:
|
|
- - compatible: "allwinner,sun4i-a10-ts"
|
|
+ - compatible: "allwinner,sun4i-a10-ts" or "allwinner,sun5i-a13-ts"
|
|
- reg: mmio address range of the chip
|
|
- interrupts: interrupt to which the chip is connected
|
|
|
|
--- a/drivers/input/touchscreen/sun4i-ts.c
|
|
+++ b/drivers/input/touchscreen/sun4i-ts.c
|
|
@@ -111,6 +111,8 @@ struct sun4i_ts_data {
|
|
unsigned int irq;
|
|
bool ignore_fifo_data;
|
|
int temp_data;
|
|
+ int temp_offset;
|
|
+ int temp_step;
|
|
};
|
|
|
|
static void sun4i_ts_irq_handle_input(struct sun4i_ts_data *ts, u32 reg_val)
|
|
@@ -189,7 +191,8 @@ static ssize_t show_temp(struct device *
|
|
if (ts->temp_data == -1)
|
|
return -EAGAIN;
|
|
|
|
- return sprintf(buf, "%d\n", (ts->temp_data - 1447) * 100);
|
|
+ return sprintf(buf, "%d\n",
|
|
+ (ts->temp_data - ts->temp_offset) * ts->temp_step);
|
|
}
|
|
|
|
static ssize_t show_temp_label(struct device *dev,
|
|
@@ -224,6 +227,13 @@ static int sun4i_ts_probe(struct platfor
|
|
ts->dev = dev;
|
|
ts->ignore_fifo_data = true;
|
|
ts->temp_data = -1;
|
|
+ if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts")) {
|
|
+ ts->temp_offset = 1900;
|
|
+ ts->temp_step = 100;
|
|
+ } else {
|
|
+ ts->temp_offset = 1447;
|
|
+ ts->temp_step = 100;
|
|
+ }
|
|
|
|
ts_attached = of_property_read_bool(np, "allwinner,ts-attached");
|
|
if (ts_attached) {
|
|
@@ -318,6 +328,7 @@ static int sun4i_ts_remove(struct platfo
|
|
|
|
static const struct of_device_id sun4i_ts_of_match[] = {
|
|
{ .compatible = "allwinner,sun4i-a10-ts", },
|
|
+ { .compatible = "allwinner,sun5i-a13-ts", },
|
|
{ /* sentinel */ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, sun4i_ts_of_match);
|