* [PATCH 0/3] touchscreen: sun4i-ts: A10 (sun4i) has a different temperature curve
@ 2015-03-08 20:53 ` Hans de Goede
0 siblings, 0 replies; 18+ messages in thread
From: Hans de Goede @ 2015-03-08 20:53 UTC (permalink / raw)
To: Maxime Ripard, Dmitry Torokhov
Cc: Chen-Yu Tsai, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
Hi Dmitry, Maxime, et al.
Here is a patch-set for the sun4i-ts driver temperature sensor support,
it consists of 2 fixes:
1) Use a better temperature curve for A10 SoCs to avoid reporting a way to
high temperature.
2) Start with reporting an "estimated" temperature of 40 degrees rather then
returning -EAGAIN until we get the first temperature ready interrupt to avoid
the kernel tempzone core logging errors because of our -EAGAIN return.
Dmitry can you please queue up the 2 sun4i-ts patches for 4.1, and Maxime,
can you please queue up the matching dts change ?
Thanks & Regards,
Hans
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/3] touchscreen: sun4i-ts: A10 (sun4i) has a different temperature curve
@ 2015-03-08 20:53 ` Hans de Goede
0 siblings, 0 replies; 18+ messages in thread
From: Hans de Goede @ 2015-03-08 20:53 UTC (permalink / raw)
To: linux-arm-kernel
Hi Dmitry, Maxime, et al.
Here is a patch-set for the sun4i-ts driver temperature sensor support,
it consists of 2 fixes:
1) Use a better temperature curve for A10 SoCs to avoid reporting a way to
high temperature.
2) Start with reporting an "estimated" temperature of 40 degrees rather then
returning -EAGAIN until we get the first temperature ready interrupt to avoid
the kernel tempzone core logging errors because of our -EAGAIN return.
Dmitry can you please queue up the 2 sun4i-ts patches for 4.1, and Maxime,
can you please queue up the matching dts change ?
Thanks & Regards,
Hans
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/3] touchscreen: sun4i-ts: A10 (sun4i) has a different temperature curve
2015-03-08 20:53 ` Hans de Goede
@ 2015-03-08 20:53 ` Hans de Goede
-1 siblings, 0 replies; 18+ messages in thread
From: Hans de Goede @ 2015-03-08 20:53 UTC (permalink / raw)
To: Maxime Ripard, Dmitry Torokhov
Cc: Chen-Yu Tsai, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede,
Tong Zhang, Olliver Schinagl
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.
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,
the new curve us based on callibration results on 4 completely different
models:
raw min raw max temp min temp max stepsize offset
Tong Zhang's hackberry 2402 2680 45.0 80.0 0.125 -255.3
Hansg's Cubieboard 2207 2300 36.0 45.0 0.096 -175.8
Olliver's lime 1 (*): 2258 2537 48.3 87.1 0.139 -265.7
Olliver's lime 2 (*): 2222 2486 46.7 91.7 0.170 -331.0
*) from: http://linux-sunxi.org/Temperature_Calibration
Average all 4: 0.133 -257.0
Average without outliers (middle 2): 0.132 -261.0
Since it is better to slightly overreport the temperature this patch uses
the average of all 4 as curve.
This fixes the temperature reported on the A10 being much higher then
expected.
Cc: Tong Zhang <lovewilliam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Olliver Schinagl <o.schinagl-U3FVU11NWA554TAoqtyWWQ@public.gmane.org>
Reported-by: Tong Zhang <lovewilliam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
.../devicetree/bindings/input/touchscreen/sun4i.txt | 3 ++-
drivers/input/touchscreen/sun4i-ts.c | 16 +++++++++++++---
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
index 433332d..d59d252 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
@@ -2,7 +2,8 @@ sun4i resistive touchscreen controller
--------------------------------------
Required properties:
- - compatible: "allwinner,sun4i-a10-ts" or "allwinner,sun6i-a31-ts"
+ - compatible: "allwinner,sun4i-a10-ts", "allwinner,sun5i-a13-ts" or
+ "allwinner,sun6i-a31-ts"
- reg: mmio address range of the chip
- interrupts: interrupt to which the chip is connected
- #thermal-sensor-cells: shall be 0
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index b93a28b..66ccd5a 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -258,6 +258,15 @@ static int sun4i_ts_probe(struct platform_device *pdev)
/* Allwinner SDK has temperature = -271 + (value / 6) (C) */
ts->temp_offset = 1626;
ts->temp_step = 167;
+ } else if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts")) {
+ /*
+ * The A10 temperature sensor has quite a wide spread, these
+ * parameters are based on the averaging of the calibration
+ * results of 4 completely different boards, with a spread of
+ * temp_step from 96 - 170 and temp_offset from 1758 - 3310.
+ */
+ ts->temp_offset = 2570;
+ ts->temp_step = 133;
} else {
/*
* The user manuals do not contain the formula for calculating
@@ -330,10 +339,10 @@ static int sun4i_ts_probe(struct platform_device *pdev)
* finally enable tp mode.
*/
reg = STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1);
- if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts"))
- reg |= TP_MODE_EN(1);
- else
+ if (of_device_is_compatible(np, "allwinner,sun6i-a31-ts"))
reg |= SUN6I_TP_MODE_EN(1);
+ else
+ reg |= TP_MODE_EN(1);
writel(reg, ts->base + TP_CTRL1);
/*
@@ -383,6 +392,7 @@ static int sun4i_ts_remove(struct platform_device *pdev)
static const struct of_device_id sun4i_ts_of_match[] = {
{ .compatible = "allwinner,sun4i-a10-ts", },
+ { .compatible = "allwinner,sun5i-a13-ts", },
{ .compatible = "allwinner,sun6i-a31-ts", },
{ /* sentinel */ }
};
--
2.3.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 1/3] touchscreen: sun4i-ts: A10 (sun4i) has a different temperature curve
@ 2015-03-08 20:53 ` Hans de Goede
0 siblings, 0 replies; 18+ messages in thread
From: Hans de Goede @ 2015-03-08 20:53 UTC (permalink / raw)
To: linux-arm-kernel
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.
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,
the new curve us based on callibration results on 4 completely different
models:
raw min raw max temp min temp max stepsize offset
Tong Zhang's hackberry 2402 2680 45.0 80.0 0.125 -255.3
Hansg's Cubieboard 2207 2300 36.0 45.0 0.096 -175.8
Olliver's lime 1 (*): 2258 2537 48.3 87.1 0.139 -265.7
Olliver's lime 2 (*): 2222 2486 46.7 91.7 0.170 -331.0
*) from: http://linux-sunxi.org/Temperature_Calibration
Average all 4: 0.133 -257.0
Average without outliers (middle 2): 0.132 -261.0
Since it is better to slightly overreport the temperature this patch uses
the average of all 4 as curve.
This fixes the temperature reported on the A10 being much higher then
expected.
Cc: Tong Zhang <lovewilliam@gmail.com>
Cc: Olliver Schinagl <o.schinagl@ultimaker.com>
Reported-by: Tong Zhang <lovewilliam@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
.../devicetree/bindings/input/touchscreen/sun4i.txt | 3 ++-
drivers/input/touchscreen/sun4i-ts.c | 16 +++++++++++++---
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
index 433332d..d59d252 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
@@ -2,7 +2,8 @@ sun4i resistive touchscreen controller
--------------------------------------
Required properties:
- - compatible: "allwinner,sun4i-a10-ts" or "allwinner,sun6i-a31-ts"
+ - compatible: "allwinner,sun4i-a10-ts", "allwinner,sun5i-a13-ts" or
+ "allwinner,sun6i-a31-ts"
- reg: mmio address range of the chip
- interrupts: interrupt to which the chip is connected
- #thermal-sensor-cells: shall be 0
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index b93a28b..66ccd5a 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -258,6 +258,15 @@ static int sun4i_ts_probe(struct platform_device *pdev)
/* Allwinner SDK has temperature = -271 + (value / 6) (C) */
ts->temp_offset = 1626;
ts->temp_step = 167;
+ } else if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts")) {
+ /*
+ * The A10 temperature sensor has quite a wide spread, these
+ * parameters are based on the averaging of the calibration
+ * results of 4 completely different boards, with a spread of
+ * temp_step from 96 - 170 and temp_offset from 1758 - 3310.
+ */
+ ts->temp_offset = 2570;
+ ts->temp_step = 133;
} else {
/*
* The user manuals do not contain the formula for calculating
@@ -330,10 +339,10 @@ static int sun4i_ts_probe(struct platform_device *pdev)
* finally enable tp mode.
*/
reg = STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1);
- if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts"))
- reg |= TP_MODE_EN(1);
- else
+ if (of_device_is_compatible(np, "allwinner,sun6i-a31-ts"))
reg |= SUN6I_TP_MODE_EN(1);
+ else
+ reg |= TP_MODE_EN(1);
writel(reg, ts->base + TP_CTRL1);
/*
@@ -383,6 +392,7 @@ static int sun4i_ts_remove(struct platform_device *pdev)
static const struct of_device_id sun4i_ts_of_match[] = {
{ .compatible = "allwinner,sun4i-a10-ts", },
+ { .compatible = "allwinner,sun5i-a13-ts", },
{ .compatible = "allwinner,sun6i-a31-ts", },
{ /* sentinel */ }
};
--
2.3.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/3] touchscreen: sun4i-ts: Do not report -EAGAIN from tempzone callback
2015-03-08 20:53 ` Hans de Goede
@ 2015-03-08 20:53 ` Hans de Goede
-1 siblings, 0 replies; 18+ messages in thread
From: Hans de Goede @ 2015-03-08 20:53 UTC (permalink / raw)
To: Maxime Ripard, Dmitry Torokhov
Cc: Chen-Yu Tsai, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
Returning -EAGAIN while waiting for the first temperature ready interrupt,
causes the tempzone core to log the following errors:
[ 1.219353] thermal thermal_zone0: failed to read out thermal zone 0
[ 2.015433] thermal thermal_zone0: failed to read out thermal zone 0
[ 2.416737] thermal thermal_zone0: failed to read out thermal zone 0
So instead of returning -EAGAIN, return an intial temperature estimate of
40 degrees, and a success status.
Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
drivers/input/touchscreen/sun4i-ts.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index 66ccd5a..d641b12 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -189,12 +189,7 @@ static void sun4i_ts_close(struct input_dev *dev)
static int sun4i_get_temp(const struct sun4i_ts_data *ts, long *temp)
{
- /* No temp_data until the first irq */
- if (ts->temp_data == -1)
- return -EAGAIN;
-
*temp = (ts->temp_data - ts->temp_offset) * ts->temp_step;
-
return 0;
}
@@ -212,11 +207,8 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
{
struct sun4i_ts_data *ts = dev_get_drvdata(dev);
long temp;
- int error;
- error = sun4i_get_temp(ts, &temp);
- if (error)
- return error;
+ sun4i_get_temp(ts, &temp);
return sprintf(buf, "%ld\n", temp);
}
@@ -253,7 +245,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)
ts->dev = dev;
ts->ignore_fifo_data = true;
- ts->temp_data = -1;
+
if (of_device_is_compatible(np, "allwinner,sun6i-a31-ts")) {
/* Allwinner SDK has temperature = -271 + (value / 6) (C) */
ts->temp_offset = 1626;
@@ -283,6 +275,13 @@ static int sun4i_ts_probe(struct platform_device *pdev)
ts->temp_step = 100;
}
+ /*
+ * Start by reporting 40 degrees as temperature, this avoids
+ * "thermal_zone: failed to read out thermal zone" errors while
+ * waiting for the first temp ready irq.
+ */
+ ts->temp_data = ts->temp_offset + 40000 / ts->temp_step;
+
ts_attached = of_property_read_bool(np, "allwinner,ts-attached");
if (ts_attached) {
ts->input = devm_input_allocate_device(dev);
--
2.3.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/3] touchscreen: sun4i-ts: Do not report -EAGAIN from tempzone callback
@ 2015-03-08 20:53 ` Hans de Goede
0 siblings, 0 replies; 18+ messages in thread
From: Hans de Goede @ 2015-03-08 20:53 UTC (permalink / raw)
To: linux-arm-kernel
Returning -EAGAIN while waiting for the first temperature ready interrupt,
causes the tempzone core to log the following errors:
[ 1.219353] thermal thermal_zone0: failed to read out thermal zone 0
[ 2.015433] thermal thermal_zone0: failed to read out thermal zone 0
[ 2.416737] thermal thermal_zone0: failed to read out thermal zone 0
So instead of returning -EAGAIN, return an intial temperature estimate of
40 degrees, and a success status.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/input/touchscreen/sun4i-ts.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index 66ccd5a..d641b12 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -189,12 +189,7 @@ static void sun4i_ts_close(struct input_dev *dev)
static int sun4i_get_temp(const struct sun4i_ts_data *ts, long *temp)
{
- /* No temp_data until the first irq */
- if (ts->temp_data == -1)
- return -EAGAIN;
-
*temp = (ts->temp_data - ts->temp_offset) * ts->temp_step;
-
return 0;
}
@@ -212,11 +207,8 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
{
struct sun4i_ts_data *ts = dev_get_drvdata(dev);
long temp;
- int error;
- error = sun4i_get_temp(ts, &temp);
- if (error)
- return error;
+ sun4i_get_temp(ts, &temp);
return sprintf(buf, "%ld\n", temp);
}
@@ -253,7 +245,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)
ts->dev = dev;
ts->ignore_fifo_data = true;
- ts->temp_data = -1;
+
if (of_device_is_compatible(np, "allwinner,sun6i-a31-ts")) {
/* Allwinner SDK has temperature = -271 + (value / 6) (C) */
ts->temp_offset = 1626;
@@ -283,6 +275,13 @@ static int sun4i_ts_probe(struct platform_device *pdev)
ts->temp_step = 100;
}
+ /*
+ * Start by reporting 40 degrees as temperature, this avoids
+ * "thermal_zone: failed to read out thermal zone" errors while
+ * waiting for the first temp ready irq.
+ */
+ ts->temp_data = ts->temp_offset + 40000 / ts->temp_step;
+
ts_attached = of_property_read_bool(np, "allwinner,ts-attached");
if (ts_attached) {
ts->input = devm_input_allocate_device(dev);
--
2.3.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/3] ARM: dts: sunxi: Adjust touchscreen compatible for sun5i and later
2015-03-08 20:53 ` Hans de Goede
@ 2015-03-08 20:53 ` Hans de Goede
-1 siblings, 0 replies; 18+ messages in thread
From: Hans de Goede @ 2015-03-08 20:53 UTC (permalink / raw)
To: Maxime Ripard, Dmitry Torokhov
Cc: Chen-Yu Tsai, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
The touchscreen controller in the A13 and later has a different temperature
curve than the one in the original A10, change the compatible for the A13 and
later so that the kernel will use the correct curve.
Reported-by: Tong Zhang <lovewilliam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
arch/arm/boot/dts/sun5i.dtsi | 2 +-
arch/arm/boot/dts/sun7i-a20.dtsi | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi
index e42cbb0..610ea18 100644
--- a/arch/arm/boot/dts/sun5i.dtsi
+++ b/arch/arm/boot/dts/sun5i.dtsi
@@ -494,7 +494,7 @@
};
rtp: rtp@01c25000 {
- compatible = "allwinner,sun4i-a10-ts";
+ compatible = "allwinner,sun5i-a13-ts";
reg = <0x01c25000 0x100>;
interrupts = <29>;
#thermal-sensor-cells = <0>;
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 3a8530b..8df77f5 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -1043,7 +1043,7 @@
};
rtp: rtp@01c25000 {
- compatible = "allwinner,sun4i-a10-ts";
+ compatible = "allwinner,sun5i-a13-ts";
reg = <0x01c25000 0x100>;
interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
#thermal-sensor-cells = <0>;
--
2.3.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/3] ARM: dts: sunxi: Adjust touchscreen compatible for sun5i and later
@ 2015-03-08 20:53 ` Hans de Goede
0 siblings, 0 replies; 18+ messages in thread
From: Hans de Goede @ 2015-03-08 20:53 UTC (permalink / raw)
To: linux-arm-kernel
The touchscreen controller in the A13 and later has a different temperature
curve than the one in the original A10, change the compatible for the A13 and
later so that the kernel will use the correct curve.
Reported-by: Tong Zhang <lovewilliam@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
arch/arm/boot/dts/sun5i.dtsi | 2 +-
arch/arm/boot/dts/sun7i-a20.dtsi | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi
index e42cbb0..610ea18 100644
--- a/arch/arm/boot/dts/sun5i.dtsi
+++ b/arch/arm/boot/dts/sun5i.dtsi
@@ -494,7 +494,7 @@
};
rtp: rtp at 01c25000 {
- compatible = "allwinner,sun4i-a10-ts";
+ compatible = "allwinner,sun5i-a13-ts";
reg = <0x01c25000 0x100>;
interrupts = <29>;
#thermal-sensor-cells = <0>;
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 3a8530b..8df77f5 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -1043,7 +1043,7 @@
};
rtp: rtp at 01c25000 {
- compatible = "allwinner,sun4i-a10-ts";
+ compatible = "allwinner,sun5i-a13-ts";
reg = <0x01c25000 0x100>;
interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
#thermal-sensor-cells = <0>;
--
2.3.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 0/3] touchscreen: sun4i-ts: A10 (sun4i) has a different temperature curve
2015-03-08 20:53 ` Hans de Goede
@ 2015-03-08 21:11 ` Dmitry Torokhov
-1 siblings, 0 replies; 18+ messages in thread
From: Dmitry Torokhov @ 2015-03-08 21:11 UTC (permalink / raw)
To: Hans de Goede
Cc: Maxime Ripard, Chen-Yu Tsai,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Eduardo Valentin
Hi Hans,
On Sun, Mar 08, 2015 at 09:53:39PM +0100, Hans de Goede wrote:
> Hi Dmitry, Maxime, et al.
>
> Here is a patch-set for the sun4i-ts driver temperature sensor support,
> it consists of 2 fixes:
>
> 1) Use a better temperature curve for A10 SoCs to avoid reporting a way to
> high temperature.
>
> 2) Start with reporting an "estimated" temperature of 40 degrees rather then
> returning -EAGAIN until we get the first temperature ready interrupt to avoid
> the kernel tempzone core logging errors because of our -EAGAIN return.
No, I think we better teach thermal core not to complain about
-EAGAINs.
>
> Dmitry can you please queue up the 2 sun4i-ts patches for 4.1, and Maxime,
> can you please queue up the matching dts change ?
>
> Thanks & Regards,
>
> Hans
--
Dmitry
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/3] touchscreen: sun4i-ts: A10 (sun4i) has a different temperature curve
@ 2015-03-08 21:11 ` Dmitry Torokhov
0 siblings, 0 replies; 18+ messages in thread
From: Dmitry Torokhov @ 2015-03-08 21:11 UTC (permalink / raw)
To: linux-arm-kernel
Hi Hans,
On Sun, Mar 08, 2015 at 09:53:39PM +0100, Hans de Goede wrote:
> Hi Dmitry, Maxime, et al.
>
> Here is a patch-set for the sun4i-ts driver temperature sensor support,
> it consists of 2 fixes:
>
> 1) Use a better temperature curve for A10 SoCs to avoid reporting a way to
> high temperature.
>
> 2) Start with reporting an "estimated" temperature of 40 degrees rather then
> returning -EAGAIN until we get the first temperature ready interrupt to avoid
> the kernel tempzone core logging errors because of our -EAGAIN return.
No, I think we better teach thermal core not to complain about
-EAGAINs.
>
> Dmitry can you please queue up the 2 sun4i-ts patches for 4.1, and Maxime,
> can you please queue up the matching dts change ?
>
> Thanks & Regards,
>
> Hans
--
Dmitry
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] touchscreen: sun4i-ts: A10 (sun4i) has a different temperature curve
2015-03-08 20:53 ` Hans de Goede
@ 2015-03-08 21:13 ` Dmitry Torokhov
-1 siblings, 0 replies; 18+ messages in thread
From: Dmitry Torokhov @ 2015-03-08 21:13 UTC (permalink / raw)
To: Hans de Goede
Cc: Maxime Ripard, Chen-Yu Tsai,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Tong Zhang, Olliver Schinagl
On Sun, Mar 08, 2015 at 09:53:40PM +0100, Hans de Goede wrote:
> 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.
>
> 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,
> the new curve us based on callibration results on 4 completely different
> models:
> raw min raw max temp min temp max stepsize offset
> Tong Zhang's hackberry 2402 2680 45.0 80.0 0.125 -255.3
> Hansg's Cubieboard 2207 2300 36.0 45.0 0.096 -175.8
> Olliver's lime 1 (*): 2258 2537 48.3 87.1 0.139 -265.7
> Olliver's lime 2 (*): 2222 2486 46.7 91.7 0.170 -331.0
> *) from: http://linux-sunxi.org/Temperature_Calibration
>
> Average all 4: 0.133 -257.0
> Average without outliers (middle 2): 0.132 -261.0
>
> Since it is better to slightly overreport the temperature this patch uses
> the average of all 4 as curve.
>
> This fixes the temperature reported on the A10 being much higher then
> expected.
>
> Cc: Tong Zhang <lovewilliam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Olliver Schinagl <o.schinagl-U3FVU11NWA554TAoqtyWWQ@public.gmane.org>
> Reported-by: Tong Zhang <lovewilliam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Applied, thank you.
> ---
> .../devicetree/bindings/input/touchscreen/sun4i.txt | 3 ++-
> drivers/input/touchscreen/sun4i-ts.c | 16 +++++++++++++---
> 2 files changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> index 433332d..d59d252 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> @@ -2,7 +2,8 @@ sun4i resistive touchscreen controller
> --------------------------------------
>
> Required properties:
> - - compatible: "allwinner,sun4i-a10-ts" or "allwinner,sun6i-a31-ts"
> + - compatible: "allwinner,sun4i-a10-ts", "allwinner,sun5i-a13-ts" or
> + "allwinner,sun6i-a31-ts"
> - reg: mmio address range of the chip
> - interrupts: interrupt to which the chip is connected
> - #thermal-sensor-cells: shall be 0
> diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
> index b93a28b..66ccd5a 100644
> --- a/drivers/input/touchscreen/sun4i-ts.c
> +++ b/drivers/input/touchscreen/sun4i-ts.c
> @@ -258,6 +258,15 @@ static int sun4i_ts_probe(struct platform_device *pdev)
> /* Allwinner SDK has temperature = -271 + (value / 6) (C) */
> ts->temp_offset = 1626;
> ts->temp_step = 167;
> + } else if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts")) {
> + /*
> + * The A10 temperature sensor has quite a wide spread, these
> + * parameters are based on the averaging of the calibration
> + * results of 4 completely different boards, with a spread of
> + * temp_step from 96 - 170 and temp_offset from 1758 - 3310.
> + */
> + ts->temp_offset = 2570;
> + ts->temp_step = 133;
> } else {
> /*
> * The user manuals do not contain the formula for calculating
> @@ -330,10 +339,10 @@ static int sun4i_ts_probe(struct platform_device *pdev)
> * finally enable tp mode.
> */
> reg = STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1);
> - if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts"))
> - reg |= TP_MODE_EN(1);
> - else
> + if (of_device_is_compatible(np, "allwinner,sun6i-a31-ts"))
> reg |= SUN6I_TP_MODE_EN(1);
> + else
> + reg |= TP_MODE_EN(1);
> writel(reg, ts->base + TP_CTRL1);
>
> /*
> @@ -383,6 +392,7 @@ static int sun4i_ts_remove(struct platform_device *pdev)
>
> static const struct of_device_id sun4i_ts_of_match[] = {
> { .compatible = "allwinner,sun4i-a10-ts", },
> + { .compatible = "allwinner,sun5i-a13-ts", },
> { .compatible = "allwinner,sun6i-a31-ts", },
> { /* sentinel */ }
> };
> --
> 2.3.1
>
--
Dmitry
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/3] touchscreen: sun4i-ts: A10 (sun4i) has a different temperature curve
@ 2015-03-08 21:13 ` Dmitry Torokhov
0 siblings, 0 replies; 18+ messages in thread
From: Dmitry Torokhov @ 2015-03-08 21:13 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Mar 08, 2015 at 09:53:40PM +0100, Hans de Goede wrote:
> 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.
>
> 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,
> the new curve us based on callibration results on 4 completely different
> models:
> raw min raw max temp min temp max stepsize offset
> Tong Zhang's hackberry 2402 2680 45.0 80.0 0.125 -255.3
> Hansg's Cubieboard 2207 2300 36.0 45.0 0.096 -175.8
> Olliver's lime 1 (*): 2258 2537 48.3 87.1 0.139 -265.7
> Olliver's lime 2 (*): 2222 2486 46.7 91.7 0.170 -331.0
> *) from: http://linux-sunxi.org/Temperature_Calibration
>
> Average all 4: 0.133 -257.0
> Average without outliers (middle 2): 0.132 -261.0
>
> Since it is better to slightly overreport the temperature this patch uses
> the average of all 4 as curve.
>
> This fixes the temperature reported on the A10 being much higher then
> expected.
>
> Cc: Tong Zhang <lovewilliam@gmail.com>
> Cc: Olliver Schinagl <o.schinagl@ultimaker.com>
> Reported-by: Tong Zhang <lovewilliam@gmail.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Applied, thank you.
> ---
> .../devicetree/bindings/input/touchscreen/sun4i.txt | 3 ++-
> drivers/input/touchscreen/sun4i-ts.c | 16 +++++++++++++---
> 2 files changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> index 433332d..d59d252 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> @@ -2,7 +2,8 @@ sun4i resistive touchscreen controller
> --------------------------------------
>
> Required properties:
> - - compatible: "allwinner,sun4i-a10-ts" or "allwinner,sun6i-a31-ts"
> + - compatible: "allwinner,sun4i-a10-ts", "allwinner,sun5i-a13-ts" or
> + "allwinner,sun6i-a31-ts"
> - reg: mmio address range of the chip
> - interrupts: interrupt to which the chip is connected
> - #thermal-sensor-cells: shall be 0
> diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
> index b93a28b..66ccd5a 100644
> --- a/drivers/input/touchscreen/sun4i-ts.c
> +++ b/drivers/input/touchscreen/sun4i-ts.c
> @@ -258,6 +258,15 @@ static int sun4i_ts_probe(struct platform_device *pdev)
> /* Allwinner SDK has temperature = -271 + (value / 6) (C) */
> ts->temp_offset = 1626;
> ts->temp_step = 167;
> + } else if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts")) {
> + /*
> + * The A10 temperature sensor has quite a wide spread, these
> + * parameters are based on the averaging of the calibration
> + * results of 4 completely different boards, with a spread of
> + * temp_step from 96 - 170 and temp_offset from 1758 - 3310.
> + */
> + ts->temp_offset = 2570;
> + ts->temp_step = 133;
> } else {
> /*
> * The user manuals do not contain the formula for calculating
> @@ -330,10 +339,10 @@ static int sun4i_ts_probe(struct platform_device *pdev)
> * finally enable tp mode.
> */
> reg = STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1);
> - if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts"))
> - reg |= TP_MODE_EN(1);
> - else
> + if (of_device_is_compatible(np, "allwinner,sun6i-a31-ts"))
> reg |= SUN6I_TP_MODE_EN(1);
> + else
> + reg |= TP_MODE_EN(1);
> writel(reg, ts->base + TP_CTRL1);
>
> /*
> @@ -383,6 +392,7 @@ static int sun4i_ts_remove(struct platform_device *pdev)
>
> static const struct of_device_id sun4i_ts_of_match[] = {
> { .compatible = "allwinner,sun4i-a10-ts", },
> + { .compatible = "allwinner,sun5i-a13-ts", },
> { .compatible = "allwinner,sun6i-a31-ts", },
> { /* sentinel */ }
> };
> --
> 2.3.1
>
--
Dmitry
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] ARM: dts: sunxi: Adjust touchscreen compatible for sun5i and later
2015-03-08 20:53 ` Hans de Goede
@ 2015-03-08 21:43 ` Maxime Ripard
-1 siblings, 0 replies; 18+ messages in thread
From: Maxime Ripard @ 2015-03-08 21:43 UTC (permalink / raw)
To: Hans de Goede
Cc: Dmitry Torokhov, Chen-Yu Tsai,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 574 bytes --]
On Sun, Mar 08, 2015 at 09:53:42PM +0100, Hans de Goede wrote:
> The touchscreen controller in the A13 and later has a different temperature
> curve than the one in the original A10, change the compatible for the A13 and
> later so that the kernel will use the correct curve.
>
> Reported-by: Tong Zhang <lovewilliam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Applied, thanks!
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 3/3] ARM: dts: sunxi: Adjust touchscreen compatible for sun5i and later
@ 2015-03-08 21:43 ` Maxime Ripard
0 siblings, 0 replies; 18+ messages in thread
From: Maxime Ripard @ 2015-03-08 21:43 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Mar 08, 2015 at 09:53:42PM +0100, Hans de Goede wrote:
> The touchscreen controller in the A13 and later has a different temperature
> curve than the one in the original A10, change the compatible for the A13 and
> later so that the kernel will use the correct curve.
>
> Reported-by: Tong Zhang <lovewilliam@gmail.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Applied, thanks!
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150308/dd932ba1/attachment.sig>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] touchscreen: sun4i-ts: A10 (sun4i) has a different temperature curve
2015-03-08 21:13 ` Dmitry Torokhov
@ 2015-03-09 8:15 ` Hans de Goede
-1 siblings, 0 replies; 18+ messages in thread
From: Hans de Goede @ 2015-03-09 8:15 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Ripard, Chen-Yu Tsai,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Tong Zhang, Olliver Schinagl
Hi,
On 08-03-15 22:13, Dmitry Torokhov wrote:
> On Sun, Mar 08, 2015 at 09:53:40PM +0100, Hans de Goede wrote:
>> 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.
>>
>> 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,
>> the new curve us based on callibration results on 4 completely different
>> models:
>> raw min raw max temp min temp max stepsize offset
>> Tong Zhang's hackberry 2402 2680 45.0 80.0 0.125 -255.3
>> Hansg's Cubieboard 2207 2300 36.0 45.0 0.096 -175.8
>> Olliver's lime 1 (*): 2258 2537 48.3 87.1 0.139 -265.7
>> Olliver's lime 2 (*): 2222 2486 46.7 91.7 0.170 -331.0
>> *) from: http://linux-sunxi.org/Temperature_Calibration
>>
>> Average all 4: 0.133 -257.0
>> Average without outliers (middle 2): 0.132 -261.0
>>
>> Since it is better to slightly overreport the temperature this patch uses
>> the average of all 4 as curve.
>>
>> This fixes the temperature reported on the A10 being much higher then
>> expected.
>>
>> Cc: Tong Zhang <lovewilliam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> Cc: Olliver Schinagl <o.schinagl-U3FVU11NWA554TAoqtyWWQ@public.gmane.org>
>> Reported-by: Tong Zhang <lovewilliam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>
>
> Applied, thank you.
Thanks.
Note I've just found out that I've made a math error, the offset as I've used it is
in degrees, but the actual code applies the offset before multiplying by stepsize :|
Given that this is rather backwards (every math course ever thought applies
the multiplication before the offset for linear functions. I'll do a follow up
patch fixing the code to do the logical thing, and adjusting the offset for
the other models accordingly.
Regards,
Hans
>
>> ---
>> .../devicetree/bindings/input/touchscreen/sun4i.txt | 3 ++-
>> drivers/input/touchscreen/sun4i-ts.c | 16 +++++++++++++---
>> 2 files changed, 15 insertions(+), 4 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
>> index 433332d..d59d252 100644
>> --- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
>> +++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
>> @@ -2,7 +2,8 @@ sun4i resistive touchscreen controller
>> --------------------------------------
>>
>> Required properties:
>> - - compatible: "allwinner,sun4i-a10-ts" or "allwinner,sun6i-a31-ts"
>> + - compatible: "allwinner,sun4i-a10-ts", "allwinner,sun5i-a13-ts" or
>> + "allwinner,sun6i-a31-ts"
>> - reg: mmio address range of the chip
>> - interrupts: interrupt to which the chip is connected
>> - #thermal-sensor-cells: shall be 0
>> diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
>> index b93a28b..66ccd5a 100644
>> --- a/drivers/input/touchscreen/sun4i-ts.c
>> +++ b/drivers/input/touchscreen/sun4i-ts.c
>> @@ -258,6 +258,15 @@ static int sun4i_ts_probe(struct platform_device *pdev)
>> /* Allwinner SDK has temperature = -271 + (value / 6) (C) */
>> ts->temp_offset = 1626;
>> ts->temp_step = 167;
>> + } else if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts")) {
>> + /*
>> + * The A10 temperature sensor has quite a wide spread, these
>> + * parameters are based on the averaging of the calibration
>> + * results of 4 completely different boards, with a spread of
>> + * temp_step from 96 - 170 and temp_offset from 1758 - 3310.
>> + */
>> + ts->temp_offset = 2570;
>> + ts->temp_step = 133;
>> } else {
>> /*
>> * The user manuals do not contain the formula for calculating
>> @@ -330,10 +339,10 @@ static int sun4i_ts_probe(struct platform_device *pdev)
>> * finally enable tp mode.
>> */
>> reg = STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1);
>> - if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts"))
>> - reg |= TP_MODE_EN(1);
>> - else
>> + if (of_device_is_compatible(np, "allwinner,sun6i-a31-ts"))
>> reg |= SUN6I_TP_MODE_EN(1);
>> + else
>> + reg |= TP_MODE_EN(1);
>> writel(reg, ts->base + TP_CTRL1);
>>
>> /*
>> @@ -383,6 +392,7 @@ static int sun4i_ts_remove(struct platform_device *pdev)
>>
>> static const struct of_device_id sun4i_ts_of_match[] = {
>> { .compatible = "allwinner,sun4i-a10-ts", },
>> + { .compatible = "allwinner,sun5i-a13-ts", },
>> { .compatible = "allwinner,sun6i-a31-ts", },
>> { /* sentinel */ }
>> };
>> --
>> 2.3.1
>>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/3] touchscreen: sun4i-ts: A10 (sun4i) has a different temperature curve
@ 2015-03-09 8:15 ` Hans de Goede
0 siblings, 0 replies; 18+ messages in thread
From: Hans de Goede @ 2015-03-09 8:15 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On 08-03-15 22:13, Dmitry Torokhov wrote:
> On Sun, Mar 08, 2015 at 09:53:40PM +0100, Hans de Goede wrote:
>> 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.
>>
>> 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,
>> the new curve us based on callibration results on 4 completely different
>> models:
>> raw min raw max temp min temp max stepsize offset
>> Tong Zhang's hackberry 2402 2680 45.0 80.0 0.125 -255.3
>> Hansg's Cubieboard 2207 2300 36.0 45.0 0.096 -175.8
>> Olliver's lime 1 (*): 2258 2537 48.3 87.1 0.139 -265.7
>> Olliver's lime 2 (*): 2222 2486 46.7 91.7 0.170 -331.0
>> *) from: http://linux-sunxi.org/Temperature_Calibration
>>
>> Average all 4: 0.133 -257.0
>> Average without outliers (middle 2): 0.132 -261.0
>>
>> Since it is better to slightly overreport the temperature this patch uses
>> the average of all 4 as curve.
>>
>> This fixes the temperature reported on the A10 being much higher then
>> expected.
>>
>> Cc: Tong Zhang <lovewilliam@gmail.com>
>> Cc: Olliver Schinagl <o.schinagl@ultimaker.com>
>> Reported-by: Tong Zhang <lovewilliam@gmail.com>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
>
> Applied, thank you.
Thanks.
Note I've just found out that I've made a math error, the offset as I've used it is
in degrees, but the actual code applies the offset before multiplying by stepsize :|
Given that this is rather backwards (every math course ever thought applies
the multiplication before the offset for linear functions. I'll do a follow up
patch fixing the code to do the logical thing, and adjusting the offset for
the other models accordingly.
Regards,
Hans
>
>> ---
>> .../devicetree/bindings/input/touchscreen/sun4i.txt | 3 ++-
>> drivers/input/touchscreen/sun4i-ts.c | 16 +++++++++++++---
>> 2 files changed, 15 insertions(+), 4 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
>> index 433332d..d59d252 100644
>> --- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
>> +++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
>> @@ -2,7 +2,8 @@ sun4i resistive touchscreen controller
>> --------------------------------------
>>
>> Required properties:
>> - - compatible: "allwinner,sun4i-a10-ts" or "allwinner,sun6i-a31-ts"
>> + - compatible: "allwinner,sun4i-a10-ts", "allwinner,sun5i-a13-ts" or
>> + "allwinner,sun6i-a31-ts"
>> - reg: mmio address range of the chip
>> - interrupts: interrupt to which the chip is connected
>> - #thermal-sensor-cells: shall be 0
>> diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
>> index b93a28b..66ccd5a 100644
>> --- a/drivers/input/touchscreen/sun4i-ts.c
>> +++ b/drivers/input/touchscreen/sun4i-ts.c
>> @@ -258,6 +258,15 @@ static int sun4i_ts_probe(struct platform_device *pdev)
>> /* Allwinner SDK has temperature = -271 + (value / 6) (C) */
>> ts->temp_offset = 1626;
>> ts->temp_step = 167;
>> + } else if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts")) {
>> + /*
>> + * The A10 temperature sensor has quite a wide spread, these
>> + * parameters are based on the averaging of the calibration
>> + * results of 4 completely different boards, with a spread of
>> + * temp_step from 96 - 170 and temp_offset from 1758 - 3310.
>> + */
>> + ts->temp_offset = 2570;
>> + ts->temp_step = 133;
>> } else {
>> /*
>> * The user manuals do not contain the formula for calculating
>> @@ -330,10 +339,10 @@ static int sun4i_ts_probe(struct platform_device *pdev)
>> * finally enable tp mode.
>> */
>> reg = STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1);
>> - if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts"))
>> - reg |= TP_MODE_EN(1);
>> - else
>> + if (of_device_is_compatible(np, "allwinner,sun6i-a31-ts"))
>> reg |= SUN6I_TP_MODE_EN(1);
>> + else
>> + reg |= TP_MODE_EN(1);
>> writel(reg, ts->base + TP_CTRL1);
>>
>> /*
>> @@ -383,6 +392,7 @@ static int sun4i_ts_remove(struct platform_device *pdev)
>>
>> static const struct of_device_id sun4i_ts_of_match[] = {
>> { .compatible = "allwinner,sun4i-a10-ts", },
>> + { .compatible = "allwinner,sun5i-a13-ts", },
>> { .compatible = "allwinner,sun6i-a31-ts", },
>> { /* sentinel */ }
>> };
>> --
>> 2.3.1
>>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 0/3] touchscreen: sun4i-ts: A10 (sun4i) has a different temperature curve
2015-03-08 21:11 ` Dmitry Torokhov
@ 2015-03-09 8:17 ` Hans de Goede
-1 siblings, 0 replies; 18+ messages in thread
From: Hans de Goede @ 2015-03-09 8:17 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Ripard, Chen-Yu Tsai,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Eduardo Valentin
Hi,
On 08-03-15 22:11, Dmitry Torokhov wrote:
> Hi Hans,
>
> On Sun, Mar 08, 2015 at 09:53:39PM +0100, Hans de Goede wrote:
>> Hi Dmitry, Maxime, et al.
>>
>> Here is a patch-set for the sun4i-ts driver temperature sensor support,
>> it consists of 2 fixes:
>>
>> 1) Use a better temperature curve for A10 SoCs to avoid reporting a way to
>> high temperature.
>>
>> 2) Start with reporting an "estimated" temperature of 40 degrees rather then
>> returning -EAGAIN until we get the first temperature ready interrupt to avoid
>> the kernel tempzone core logging errors because of our -EAGAIN return.
>
> No, I think we better teach thermal core not to complain about
> -EAGAINs.
I was wondering if that would not be a better fix myself, so ack. I'll go do
a patch for that and submit it to the thermalzone maintainer.
Regards,
Hans
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/3] touchscreen: sun4i-ts: A10 (sun4i) has a different temperature curve
@ 2015-03-09 8:17 ` Hans de Goede
0 siblings, 0 replies; 18+ messages in thread
From: Hans de Goede @ 2015-03-09 8:17 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On 08-03-15 22:11, Dmitry Torokhov wrote:
> Hi Hans,
>
> On Sun, Mar 08, 2015 at 09:53:39PM +0100, Hans de Goede wrote:
>> Hi Dmitry, Maxime, et al.
>>
>> Here is a patch-set for the sun4i-ts driver temperature sensor support,
>> it consists of 2 fixes:
>>
>> 1) Use a better temperature curve for A10 SoCs to avoid reporting a way to
>> high temperature.
>>
>> 2) Start with reporting an "estimated" temperature of 40 degrees rather then
>> returning -EAGAIN until we get the first temperature ready interrupt to avoid
>> the kernel tempzone core logging errors because of our -EAGAIN return.
>
> No, I think we better teach thermal core not to complain about
> -EAGAINs.
I was wondering if that would not be a better fix myself, so ack. I'll go do
a patch for that and submit it to the thermalzone maintainer.
Regards,
Hans
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2015-03-09 8:17 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-08 20:53 [PATCH 0/3] touchscreen: sun4i-ts: A10 (sun4i) has a different temperature curve Hans de Goede
2015-03-08 20:53 ` Hans de Goede
[not found] ` <1425848022-18001-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-08 20:53 ` [PATCH 1/3] " Hans de Goede
2015-03-08 20:53 ` Hans de Goede
[not found] ` <1425848022-18001-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-08 21:13 ` Dmitry Torokhov
2015-03-08 21:13 ` Dmitry Torokhov
2015-03-09 8:15 ` Hans de Goede
2015-03-09 8:15 ` Hans de Goede
2015-03-08 20:53 ` [PATCH 2/3] touchscreen: sun4i-ts: Do not report -EAGAIN from tempzone callback Hans de Goede
2015-03-08 20:53 ` Hans de Goede
2015-03-08 20:53 ` [PATCH 3/3] ARM: dts: sunxi: Adjust touchscreen compatible for sun5i and later Hans de Goede
2015-03-08 20:53 ` Hans de Goede
[not found] ` <1425848022-18001-4-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-08 21:43 ` Maxime Ripard
2015-03-08 21:43 ` Maxime Ripard
2015-03-08 21:11 ` [PATCH 0/3] touchscreen: sun4i-ts: A10 (sun4i) has a different temperature curve Dmitry Torokhov
2015-03-08 21:11 ` Dmitry Torokhov
2015-03-09 8:17 ` Hans de Goede
2015-03-09 8:17 ` Hans de Goede
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.