Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1610543pxb; Sun, 17 Jan 2021 15:50:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKmTwYyXYDj6XJY4LLezfbxari5Csm+1QNzJA0ak3inkp2dX1hSxe/AuEZlYHNu3keeI0X X-Received: by 2002:a05:6402:438d:: with SMTP id o13mr1623276edc.135.1610927427195; Sun, 17 Jan 2021 15:50:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610927427; cv=none; d=google.com; s=arc-20160816; b=TPugXeBVsdiFUoIAcbneOoOz5Z6J6pAElpVJuPkMcqINr2fb6a2e9lbrZrzdnT539J ELH8arZJe7vOOsLj8JsAS4zmFXnenY/o1xnVzU7B8kxNQO/8cv6pHh9P8uOnmwAs/OoI 43Hm96DChJ9uEfCQa2GVh3A+iMisO6uZH5cp6rB3rMOkz1gMAdSpphOUpx6chw/yuklj qAafQZZ2sZLGpDDFAI9obgj4EXp2ru18FAG9T83XX4eXAXhp7oixd3doq+4N5ii+nV6+ k8X3CC/JdTZz8z+0gBNUOcQxaRmvncSbp8pXTUDxIi2WJeUJlIK9VjeQ3xtI/3eNRn9F TisQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=oClwcGbSXTcI3kvaAdIUVBBqOR56N1zqJP29sSkNGDE=; b=qUmet0oUKGaYtcQcaaHVYgMTwv8KhVV7IMuEvJOc2e6urU7nThHqx5vy/JxgSCYIZo kE0L4SLnrLapBJFmiuf/VW5DIa3Z6xPr4rtbBLMUBpqrKMr/P8XPPdr3cAsJ8ZAw3YUs Kli+bIhhwhewTqqv1q5vg6d7mM59qlgDBRGHpirCSUhwrJFLWkcPYgBDG6Y0gipQl5QQ XyUn9FOTTGUcpmoGUIxk5QLHAKtqN2HEMjZBi1HsiQa5PUxmaZJodbLv9wY9SxPc25N0 QJh4SsqQkp9IdRJBqvSjuQflrIZUJzhG1cmED0+8OaUF8qMOE/UqKVxMD8qw8pUxEyVz j57w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alistair23.me header.s=fm3 header.b=eEZgM6hB; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=EcAeSGdA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mp28si5483991ejc.284.2021.01.17.15.50.04; Sun, 17 Jan 2021 15:50:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alistair23.me header.s=fm3 header.b=eEZgM6hB; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=EcAeSGdA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730736AbhAQXnD (ORCPT + 99 others); Sun, 17 Jan 2021 18:43:03 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:41975 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729455AbhAQXm5 (ORCPT ); Sun, 17 Jan 2021 18:42:57 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 59A535C011C; Sun, 17 Jan 2021 18:42:11 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sun, 17 Jan 2021 18:42:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=oClwcGbSXTcI3 kvaAdIUVBBqOR56N1zqJP29sSkNGDE=; b=eEZgM6hBkrm7HoX0OCsWqtC493sup XmOlx3249ZSXbayhSc969s/Fqii8LHg9voL/JNeRRNuo6ZlHXgUFR90lDAl+5xpC Ik+PTk79cSWR/ekCh4lQxufedLRUSNaZODvBIKigEydiNVI2qKua+yFR8Ok7JoVn CJxSoKz/bEM9jUiQCAE/3mRN2OyjLnTXmos1gsoS7s/gTMlmLbbQ55ge2UJHk6y7 s7sBvpLu/gR395LuzfAYvMynuipXnjcurvRKD21MTGjsWHkDaGJEtTru5DJXDa/H yHlnDZn4kaXQm+uD4ilRPthlAOhXNX+N6sBZ/oWjHAF9G0hq4xHKRc/pQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=oClwcGbSXTcI3kvaAdIUVBBqOR56N1zqJP29sSkNGDE=; b=EcAeSGdA Z4hY4mTaauvBSe8VuWJaIpasBcv7VxFHRvrH2Ybxy4DGf0DVaDv1quCqlDDvY02Z pu2wein8I91qAGRmnLXYIMQxlXDzOS0jcZ/em3iniDgvjJR89bXD4lXO3Q3Tq5bW mpmtYSXhQvaz4flmu/b1792mQbHGi3JPY0jHsU0WJ6ANCzpe0sggOTpQzDGSjhGf CurMJlorwhVfx+xFmySbKKNFZ2j7JajQxpyHyRJly/cY6Yx59M0Uk9RMMJi/fg8j WJ5sIvhUyt17/BIFJmih6/+ZFP4dmYU/QPPVBmGr3beMfwfGq7/14tHvYAqgoUru U0OqyGtVaJZd5g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrtdejgdduvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeetlhhishhtrghirhcuhfhrrghntghishcuoegrlhhishhtrghi rhesrghlihhsthgrihhrvdefrdhmvgeqnecuggftrfgrthhtvghrnhepgeegtdetjeekge eguefgheeuvedugedvteejveeiudegvddtkeffkeehtdetudfhnecukfhppeejfedrleef rdekgedrvddtkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpegrlhhishhtrghirhesrghlihhsthgrihhrvdefrdhmvg X-ME-Proxy: Received: from ThinkpadX1Yoga3.localdomain (c-73-93-84-208.hsd1.ca.comcast.net [73.93.84.208]) by mail.messagingengine.com (Postfix) with ESMTPA id 76DBE240066; Sun, 17 Jan 2021 18:42:10 -0500 (EST) From: Alistair Francis To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de Cc: linux-kernel@vger.kernel.org, alistair23@gmail.com, Alistair Francis Subject: [PATCH 2/3] input/touchscreen: Add device tree support to wacom_i2c Date: Sat, 16 Jan 2021 20:24:27 -0800 Message-Id: <20210117042428.1497-2-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210117042428.1497-1-alistair@alistair23.me> References: <20210117042428.1497-1-alistair@alistair23.me> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow the wacom-i2c device to be exposed via device tree. Signed-off-by: Alistair Francis --- drivers/input/touchscreen/wacom_i2c.c | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index 1afc6bde2891..54af2934ba17 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #define WACOM_CMD_QUERY0 0x04 @@ -35,6 +36,13 @@ struct wacom_i2c { u8 data[WACOM_QUERY_SIZE]; bool prox; int tool; + + bool flip_tilt_x; + bool flip_tilt_y; + bool flip_pos_x; + bool flip_pos_y; + bool flip_distance; + bool flip_pressure; }; static int wacom_query_device(struct i2c_client *client, @@ -144,6 +152,20 @@ static void wacom_i2c_close(struct input_dev *dev) disable_irq(client->irq); } +#ifdef CONFIG_OF +static void wacom_of_read(struct wacom_i2c *wac_i2c) +{ + struct i2c_client *client = wac_i2c->client; + + wac_i2c->flip_tilt_x = of_property_read_bool(client->dev.of_node, "flip-tilt-x"); + wac_i2c->flip_tilt_y = of_property_read_bool(client->dev.of_node, "flip-tilt-y"); + wac_i2c->flip_pos_x = of_property_read_bool(client->dev.of_node, "flip-pos-x"); + wac_i2c->flip_pos_y = of_property_read_bool(client->dev.of_node, "flip-pos-y"); + wac_i2c->flip_distance = of_property_read_bool(client->dev.of_node, "flip-distance"); + wac_i2c->flip_pressure = of_property_read_bool(client->dev.of_node, "flip-pressure"); +} +#endif + static int wacom_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -214,6 +236,11 @@ static int wacom_i2c_probe(struct i2c_client *client, } i2c_set_clientdata(client, wac_i2c); + +#ifdef CONFIG_OF + wacom_of_read(wac_i2c); +#endif + return 0; err_free_irq: @@ -262,10 +289,21 @@ static const struct i2c_device_id wacom_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, wacom_i2c_id); +#ifdef CONFIG_OF +static const struct of_device_id wacom_i2c_of_match_table[] = { + { .compatible = "wacom,wacom-i2c" }, + {} +}; +MODULE_DEVICE_TABLE(of, wacom_i2c_of_match_table); +#endif + static struct i2c_driver wacom_i2c_driver = { .driver = { .name = "wacom_i2c", .pm = &wacom_i2c_pm, +#ifdef CONFIG_OF + .of_match_table = of_match_ptr(wacom_i2c_of_match_table), +#endif }, .probe = wacom_i2c_probe, -- 2.29.2