From patchwork Fri Jan 29 23:48:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 8168971 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8084EBEEE5 for ; Fri, 29 Jan 2016 23:48:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 89BA120395 for ; Fri, 29 Jan 2016 23:48:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A5A2720392 for ; Fri, 29 Jan 2016 23:48:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932594AbcA2XsV (ORCPT ); Fri, 29 Jan 2016 18:48:21 -0500 Received: from mail.kmu-office.ch ([178.209.48.109]:59703 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932218AbcA2XsU (ORCPT ); Fri, 29 Jan 2016 18:48:20 -0500 Received: from trochilidae.toradex.int (75-146-58-181-Washington.hfc.comcastbusiness.net [75.146.58.181]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 07BA65C14E2; Sat, 30 Jan 2016 00:46:56 +0100 (CET) From: Stefan Agner To: dmitry.torokhov@gmail.com, michael.hennerich@analog.com, robh+dt@kernel.org Cc: mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, realmz6@gmail.com, broonie@kernel.org, jic23@kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Stefan Agner Subject: [PATCH v2 2/3] input: touchscreen: ad7879: fix default x/y axis assignment Date: Fri, 29 Jan 2016 15:48:14 -0800 Message-Id: <1454111295-5615-2-git-send-email-stefan@agner.ch> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1454111295-5615-1-git-send-email-stefan@agner.ch> References: <1454111295-5615-1-git-send-email-stefan@agner.ch> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1454111219; bh=UwF1sLcFWzn+YzetuoHMRumc3yLRcg6ukmbr9JcHmA8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=UctznoiBKyw+bdJNcdQ5ivTHnia22iNC2T3ulvR6xHaM4eHOVSB51+epP4CQIt0BpvocxtIhISGqVJCSXQFls97NOXmEx8PHwR16CqpAiMu21lJxC7k+sHQumzqFiH1mtC3EobcDGqaYO6wyMAB8km4LVk6HC2tmkJyQSGmhEkQ= Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 The X/Y position measurements read from the controller are interpreted wrong. The first measurement X+ contains the Y position, and the second measurement Y+ the X position (see also Table 11 Register Table in the data sheet). The problem is already known and a swap option has been introduced: commit 6680884a4420 ("Input: ad7879 - add option to correct xy axis") However, the meaning of the new boolean is inverted since the underlying values are already swapped. Let ts->swap_xy set to true actually be the swapped configuration of the two axis. Signed-off-by: Stefan Agner --- Changes since v1: - Keep axis swapped by default when using platform data drivers/input/touchscreen/ad7879.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index 93b8ea2..abd0220 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c @@ -94,8 +94,8 @@ #define AD7879_TEMP_BIT (1<<1) enum { - AD7879_SEQ_XPOS = 0, - AD7879_SEQ_YPOS = 1, + AD7879_SEQ_YPOS = 0, + AD7879_SEQ_XPOS = 1, AD7879_SEQ_Z1 = 2, AD7879_SEQ_Z2 = 3, AD7879_NR_SENSE = 4, @@ -517,7 +517,9 @@ struct ad7879 *ad7879_probe(struct device *dev, u8 devid, unsigned int irq, ts->dev = dev; ts->input = input_dev; ts->irq = irq; - ts->swap_xy = pdata->swap_xy; + + /* Use swapped axis by default (backward compatibility) */ + ts->swap_xy = !pdata->swap_xy; setup_timer(&ts->timer, ad7879_timer, (unsigned long) ts);