* [PATCH 0/2] touchscreen: sun4i-ts: fix reported temperature on A10 @ 2014-06-16 18:24 Hans de Goede [not found] ` <1402943069-19420-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Hans de Goede @ 2014-06-16 18:24 UTC (permalink / raw) To: Dmitry Torokhov, Maxime Ripard Cc: Tong Zhang, linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw Hi Dmitry and Maxime, I've learned today that the temperature reported on the A10 / sun4i SoC family is aprox twice too high, since the A10 rtp controller temperature register seems to have double the resolution (one bit more) then that of the A13 (sun5i) and later. Dmitry, can you please add the sun4i-ts.c patch to your tree? Ideally as a bug-fix for 3.16 (where this driver was first added). Maxime, can you please add the dts patch to your tree ? Thanks & Regards, Hans ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1402943069-19420-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* [PATCH 1/2] touchscreen: sun4i-ts: A10 (sun4i) has double the temperature precision [not found] ` <1402943069-19420-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2014-06-16 18:24 ` Hans de Goede [not found] ` <1402943069-19420-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2014-06-16 18:24 ` [PATCH 2/2] ARM: dts: sunxi: Adjust touchscreen compatible for sun5i and later Hans de Goede 1 sibling, 1 reply; 6+ messages in thread From: Hans de Goede @ 2014-06-16 18:24 UTC (permalink / raw) To: Dmitry Torokhov, Maxime Ripard Cc: Tong Zhang, linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede Testing has revealed that the temperature in the rtp controller of the A10 (sun4i) SoC has a resolution of 50 milli degrees / step, where as the A13 (sun5i) and later models have 100 milli degrees / step. Add a new sun5i-a13-ts compatible to differentiate the newer models and set the resolution based on the compatible string. This fixes the temperature reported on the A10 being twice as high as expected. Reported-by: Tong Zhang <lovewilliam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> --- Documentation/devicetree/bindings/input/touchscreen/sun4i.txt | 2 +- drivers/input/touchscreen/sun4i-ts.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt index aef5779..5106709 100644 --- 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 diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c index 2ba8260..5661be0 100644 --- a/drivers/input/touchscreen/sun4i-ts.c +++ b/drivers/input/touchscreen/sun4i-ts.c @@ -111,6 +111,7 @@ struct sun4i_ts_data { unsigned int irq; bool ignore_fifo_data; int temp_data; + int temp_step; }; static void sun4i_ts_irq_handle_input(struct sun4i_ts_data *ts, u32 reg_val) @@ -189,7 +190,7 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, 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 - 1447) * ts->temp_step); } static ssize_t show_temp_label(struct device *dev, @@ -224,6 +225,10 @@ 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,sun4i-a10-ts")) + ts->temp_step = 50; + else + ts->temp_step = 100; ts_attached = of_property_read_bool(np, "allwinner,ts-attached"); if (ts_attached) { @@ -318,6 +323,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", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, sun4i_ts_of_match); -- 2.0.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <1402943069-19420-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH 1/2] touchscreen: sun4i-ts: A10 (sun4i) has double the temperature precision [not found] ` <1402943069-19420-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2014-06-16 21:30 ` Dmitry Torokhov [not found] ` <20140616213048.GA422-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Dmitry Torokhov @ 2014-06-16 21:30 UTC (permalink / raw) To: Hans de Goede Cc: Maxime Ripard, Tong Zhang, linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw Hi Hans, On Mon, Jun 16, 2014 at 08:24:28PM +0200, Hans de Goede wrote: > Testing has revealed that the temperature in the rtp controller of the A10 > (sun4i) SoC has a resolution of 50 milli degrees / step, where as the > A13 (sun5i) and later models have 100 milli degrees / step. > > Add a new sun5i-a13-ts compatible to differentiate the newer models and > set the resolution based on the compatible string. > > This fixes the temperature reported on the A10 being twice as high as expected. Should we maybe add explicit temperature steps property so that we won;t need to patch again if they decided to change resolution again? Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <20140616213048.GA422-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org>]
* Re: [PATCH 1/2] touchscreen: sun4i-ts: A10 (sun4i) has double the temperature precision [not found] ` <20140616213048.GA422-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org> @ 2014-06-17 6:31 ` Hans de Goede 2014-06-17 17:15 ` Hans de Goede 1 sibling, 0 replies; 6+ messages in thread From: Hans de Goede @ 2014-06-17 6:31 UTC (permalink / raw) To: Dmitry Torokhov Cc: Maxime Ripard, Tong Zhang, linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw Hi, On 06/16/2014 11:30 PM, Dmitry Torokhov wrote: > Hi Hans, > > On Mon, Jun 16, 2014 at 08:24:28PM +0200, Hans de Goede wrote: >> Testing has revealed that the temperature in the rtp controller of the A10 >> (sun4i) SoC has a resolution of 50 milli degrees / step, where as the >> A13 (sun5i) and later models have 100 milli degrees / step. >> >> Add a new sun5i-a13-ts compatible to differentiate the newer models and >> set the resolution based on the compatible string. >> >> This fixes the temperature reported on the A10 being twice as high as expected. > > Should we maybe add explicit temperature steps property so that we won;t > need to patch again if they decided to change resolution again? I can understand where your coming from, but in general the rule for devicetree bindings is to not add properties for things which are purely dependent on the SoC generation. Those must be deferred from the compatible string. Regards, Hans ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] touchscreen: sun4i-ts: A10 (sun4i) has double the temperature precision [not found] ` <20140616213048.GA422-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org> 2014-06-17 6:31 ` Hans de Goede @ 2014-06-17 17:15 ` Hans de Goede 1 sibling, 0 replies; 6+ messages in thread From: Hans de Goede @ 2014-06-17 17:15 UTC (permalink / raw) To: Dmitry Torokhov Cc: Maxime Ripard, Tong Zhang, linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw Hi, On 06/16/2014 11:30 PM, Dmitry Torokhov wrote: > Hi Hans, > > On Mon, Jun 16, 2014 at 08:24:28PM +0200, Hans de Goede wrote: >> Testing has revealed that the temperature in the rtp controller of the A10 >> (sun4i) SoC has a resolution of 50 milli degrees / step, where as the >> A13 (sun5i) and later models have 100 milli degrees / step. >> >> Add a new sun5i-a13-ts compatible to differentiate the newer models and >> set the resolution based on the compatible string. >> >> This fixes the temperature reported on the A10 being twice as high as expected. > > Should we maybe add explicit temperature steps property so that we won;t > need to patch again if they decided to change resolution again? Self NAK, further testing has revealed that it is likely not the resolution which is different on the A10, but that we need to apply a different offset. Regards, Hans ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] ARM: dts: sunxi: Adjust touchscreen compatible for sun5i and later [not found] ` <1402943069-19420-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2014-06-16 18:24 ` [PATCH 1/2] touchscreen: sun4i-ts: A10 (sun4i) has double the temperature precision Hans de Goede @ 2014-06-16 18:24 ` Hans de Goede 1 sibling, 0 replies; 6+ messages in thread From: Hans de Goede @ 2014-06-16 18:24 UTC (permalink / raw) To: Dmitry Torokhov, Maxime Ripard Cc: Tong Zhang, linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede The touchscreen controller in the A13 and later has a different temperature resulution compated to the one in the original A10, change the compatible for the A13 and later so that the kernel will use the correct resolution. 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-a10s.dtsi | 2 +- arch/arm/boot/dts/sun5i-a13.dtsi | 2 +- arch/arm/boot/dts/sun7i-a20.dtsi | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi index 6835b88..25549c1 100644 --- a/arch/arm/boot/dts/sun5i-a10s.dtsi +++ b/arch/arm/boot/dts/sun5i-a10s.dtsi @@ -519,7 +519,7 @@ }; rtp: rtp@01c25000 { - compatible = "allwinner,sun4i-a10-ts"; + compatible = "allwinner,sun5i-a13-ts"; reg = <0x01c25000 0x100>; interrupts = <29>; }; diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi index 206b6f8..be28b3b 100644 --- a/arch/arm/boot/dts/sun5i-a13.dtsi +++ b/arch/arm/boot/dts/sun5i-a13.dtsi @@ -467,7 +467,7 @@ }; rtp: rtp@01c25000 { - compatible = "allwinner,sun4i-a10-ts"; + compatible = "allwinner,sun5i-a13-ts"; reg = <0x01c25000 0x100>; interrupts = <29>; }; diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi index 8029a75..87c7d33 100644 --- a/arch/arm/boot/dts/sun7i-a20.dtsi +++ b/arch/arm/boot/dts/sun7i-a20.dtsi @@ -823,7 +823,7 @@ }; rtp: rtp@01c25000 { - compatible = "allwinner,sun4i-a10-ts"; + compatible = "allwinner,sun5i-a13-ts"; reg = <0x01c25000 0x100>; interrupts = <0 29 4>; }; -- 2.0.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-06-17 17:15 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-06-16 18:24 [PATCH 0/2] touchscreen: sun4i-ts: fix reported temperature on A10 Hans de Goede [not found] ` <1402943069-19420-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2014-06-16 18:24 ` [PATCH 1/2] touchscreen: sun4i-ts: A10 (sun4i) has double the temperature precision Hans de Goede [not found] ` <1402943069-19420-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2014-06-16 21:30 ` Dmitry Torokhov [not found] ` <20140616213048.GA422-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org> 2014-06-17 6:31 ` Hans de Goede 2014-06-17 17:15 ` Hans de Goede 2014-06-16 18:24 ` [PATCH 2/2] ARM: dts: sunxi: Adjust touchscreen compatible for sun5i and later Hans de Goede
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).