From patchwork Wed Jul 20 17:14:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9240073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 522AA602F0 for ; Wed, 20 Jul 2016 17:14:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F62B1FEBD for ; Wed, 20 Jul 2016 17:14:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3432327CE5; Wed, 20 Jul 2016 17:14:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 098621FF60 for ; Wed, 20 Jul 2016 17:14:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753386AbcGTROx (ORCPT ); Wed, 20 Jul 2016 13:14:53 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36172 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752583AbcGTROw (ORCPT ); Wed, 20 Jul 2016 13:14:52 -0400 Received: by mail-pf0-f194.google.com with SMTP id y134so3807464pfg.3; Wed, 20 Jul 2016 10:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=PbQdo+8L9Oq1NY0t5OZdBuuxwc+P5UPSXztu2d5x9QU=; b=aK+vTZzzYq9fbexULyXSEG0nOZ87URxesotI1XNdB+YwtwSFjDEFwVr80fjFE2NqEI wT12MNLJN3t5kOor9Ywi9EGDQhAksmph9libDk58PlRpPeIPa22EvlTti/i3n+EdVGIr iyV+XnEXeZT7Fx0JBEL+YJ8dPkbBYonR4VgsngIzXcPSxBtMBmKZZIAajcAYb4bdl40u uALKBl3wmalZiS8y/vWD6KMflJr3a/Yo9OsD5zMnDXq8ThX5PBYo87jrvL/aBCUFKeVM qaUoe+G4/s2cLka5pb5Tw7crwOab3aKepd6IjahGpmFdrKm1oQT+gIydvaqJBSVg8Qc1 faJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=PbQdo+8L9Oq1NY0t5OZdBuuxwc+P5UPSXztu2d5x9QU=; b=kJKCmMJQCazAxLxoizlLXPyPp4lP78iIZzzCENprqqFLzgILzXhcMS0EHfdvZhGhKE VPXgWhSJySyqeChLf9ZK4sLbtM9vBruDpV2X/ng2jpUIKzOoAgYqHvlxptG8LkIUt4rz TPezvn7M8L79w5VA8TcsQbOa4kPe4aX4jekCplLUWspx1Kw2BAvpg7Z/XEIpAqob3/CZ sUdeuA4AXLPvpuvfiNiXm8AuokeeU5f6Y7upgkZ8P2pla/QugFR+ro/okZrLWvcWiS+K XSISoIV5auDcXJyDe+r2xRPrY6XQ6ezkVxJlqz8P73cl+wH4cXtyDXFfgDE4zQhPzudW sxTg== X-Gm-Message-State: ALyK8tIaCFsPw2nvR4+7cY7/IgYalLkMB5XXW5te1RXv7jvHMTQTbAmzSTTU+5u6Kf61lg== X-Received: by 10.98.77.65 with SMTP id a62mr66324818pfb.128.1469034891975; Wed, 20 Jul 2016 10:14:51 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1311:30df:8391:d700:488c]) by smtp.gmail.com with ESMTPSA id n5sm6025492pai.11.2016.07.20.10.14.50 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 20 Jul 2016 10:14:51 -0700 (PDT) Date: Wed, 20 Jul 2016 10:14:49 -0700 From: Dmitry Torokhov To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: Pavel Machek , Michael Welling , kernel list , linux-input@vger.kernel.org, sre@kernel.org, ivo.g.dimitrov.75@gmail.com, patrikbachan@gmail.com, serge@hallyn.com, Aaro Koskinen Subject: Re: [PATCH] Input: tsc200x - Report proper input_dev name Message-ID: <20160720171449.GD25655@dtor-ws> References: <20160720014424.GI19250@dtor-ws> <20160720065405.GD3792@amd> <20160720164503.GB25655@dtor-ws> <201607201856.51367@pali> <20160720170412.GC25655@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160720170412.GC25655@dtor-ws> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Input: tsc200x - report proper input_dev name From: Michael Welling Passes input_id struct to the common probe function for the tsc200x drivers instead of just the bustype. This allows for the use of the product variable to set the input_dev->name variable according to the type of touchscreen used. Note that when we introduced support for TSC2004 we started calling everything TSC200X, so let's keep this quirk. Reported-by: Pavel Machek Signed-off-by: Michael Welling Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov Acked-by: Pavel Machek Acked-by: Pali Rohár --- drivers/input/touchscreen/tsc2004.c | 7 ++++++- drivers/input/touchscreen/tsc2005.c | 7 ++++++- drivers/input/touchscreen/tsc200x-core.c | 15 ++++++++++++--- drivers/input/touchscreen/tsc200x-core.h | 2 +- 4 files changed, 25 insertions(+), 6 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/input/touchscreen/tsc2004.c b/drivers/input/touchscreen/tsc2004.c index 7295c19..6fe55d5 100644 --- a/drivers/input/touchscreen/tsc2004.c +++ b/drivers/input/touchscreen/tsc2004.c @@ -22,6 +22,11 @@ #include #include "tsc200x-core.h" +static const struct input_id tsc2004_input_id = { + .bustype = BUS_I2C, + .product = 2004, +}; + static int tsc2004_cmd(struct device *dev, u8 cmd) { u8 tx = TSC200X_CMD | TSC200X_CMD_12BIT | cmd; @@ -42,7 +47,7 @@ static int tsc2004_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { - return tsc200x_probe(&i2c->dev, i2c->irq, BUS_I2C, + return tsc200x_probe(&i2c->dev, i2c->irq, &tsc2004_input_id, devm_regmap_init_i2c(i2c, &tsc200x_regmap_config), tsc2004_cmd); } diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c index b9f593d..f2c5f0e 100644 --- a/drivers/input/touchscreen/tsc2005.c +++ b/drivers/input/touchscreen/tsc2005.c @@ -24,6 +24,11 @@ #include #include "tsc200x-core.h" +static const struct input_id tsc2005_input_id = { + .bustype = BUS_SPI, + .product = 2005, +}; + static int tsc2005_cmd(struct device *dev, u8 cmd) { u8 tx = TSC200X_CMD | TSC200X_CMD_12BIT | cmd; @@ -62,7 +67,7 @@ static int tsc2005_probe(struct spi_device *spi) if (error) return error; - return tsc200x_probe(&spi->dev, spi->irq, BUS_SPI, + return tsc200x_probe(&spi->dev, spi->irq, &tsc2005_input_id, devm_regmap_init_spi(spi, &tsc200x_regmap_config), tsc2005_cmd); } diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c index 26e81d1b..b7059ed 100644 --- a/drivers/input/touchscreen/tsc200x-core.c +++ b/drivers/input/touchscreen/tsc200x-core.c @@ -450,7 +450,7 @@ static void tsc200x_close(struct input_dev *input) mutex_unlock(&ts->mutex); } -int tsc200x_probe(struct device *dev, int irq, __u16 bustype, +int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id, struct regmap *regmap, int (*tsc200x_cmd)(struct device *dev, u8 cmd)) { @@ -547,9 +547,18 @@ int tsc200x_probe(struct device *dev, int irq, __u16 bustype, snprintf(ts->phys, sizeof(ts->phys), "%s/input-ts", dev_name(dev)); - input_dev->name = "TSC200X touchscreen"; + if (tsc_id->product == 2004) { + input_dev->name = "TSC200X touchscreen"; + } else { + input_dev->name = devm_kasprintf(dev, GFP_KERNEL, + "TSC%04d touchscreen", + tsc_id->product); + if (!input_dev->name) + return -ENOMEM; + } + input_dev->phys = ts->phys; - input_dev->id.bustype = bustype; + input_dev->id = *tsc_id; input_dev->dev.parent = dev; input_dev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY); input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); diff --git a/drivers/input/touchscreen/tsc200x-core.h b/drivers/input/touchscreen/tsc200x-core.h index 7a482d1..49a63a3 100644 --- a/drivers/input/touchscreen/tsc200x-core.h +++ b/drivers/input/touchscreen/tsc200x-core.h @@ -70,7 +70,7 @@ extern const struct regmap_config tsc200x_regmap_config; extern const struct dev_pm_ops tsc200x_pm_ops; -int tsc200x_probe(struct device *dev, int irq, __u16 bustype, +int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id, struct regmap *regmap, int (*tsc200x_cmd)(struct device *dev, u8 cmd)); int tsc200x_remove(struct device *dev);