From patchwork Mon Jun 16 18:24:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 4361971 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C93ACBEEAA for ; Mon, 16 Jun 2014 18:26:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E96C320204 for ; Mon, 16 Jun 2014 18:26:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 75BC8202AE for ; Mon, 16 Jun 2014 18:26:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932252AbaFPS0L (ORCPT ); Mon, 16 Jun 2014 14:26:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41593 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754506AbaFPS0J (ORCPT ); Mon, 16 Jun 2014 14:26:09 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5GIOZQB010878 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Jun 2014 14:24:35 -0400 Received: from shalem.localdomain.com (vpn1-4-150.ams2.redhat.com [10.36.4.150]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5GIOUaT023718; Mon, 16 Jun 2014 14:24:33 -0400 From: Hans de Goede To: Dmitry Torokhov , Maxime Ripard Cc: Tong Zhang , linux-input@vger.kernel.org, LM Sensors , linux-arm-kernel@lists.infradead.org, devicetree , linux-sunxi@googlegroups.com, Hans de Goede Subject: [PATCH 1/2] touchscreen: sun4i-ts: A10 (sun4i) has double the temperature precision Date: Mon, 16 Jun 2014 20:24:28 +0200 Message-Id: <1402943069-19420-2-git-send-email-hdegoede@redhat.com> In-Reply-To: <1402943069-19420-1-git-send-email-hdegoede@redhat.com> References: <1402943069-19420-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Hans de Goede --- 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);