From patchwork Wed Jul 20 03:49:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Welling X-Patchwork-Id: 9238745 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 DA737602F0 for ; Wed, 20 Jul 2016 03:50:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C115B2026B for ; Wed, 20 Jul 2016 03:50:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B595E2624C; Wed, 20 Jul 2016 03:50:41 +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_SIGNED, 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 089032026B for ; Wed, 20 Jul 2016 03:50:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750810AbcGTDuj (ORCPT ); Tue, 19 Jul 2016 23:50:39 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:34014 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750715AbcGTDuj (ORCPT ); Tue, 19 Jul 2016 23:50:39 -0400 Received: by mail-oi0-f65.google.com with SMTP id c199so3704126oig.1; Tue, 19 Jul 2016 20:50:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=UWKoXHeO024fbcWo/Y7/Dj94VRD2hJHeVVGCqjzITiQ=; b=eerP6keaGJQerXpJ3p9CRz9sbjp3zO+1l9jpUZ2x0a6tDbGdBMjQX67sF0IBiyQwGw 0ubenro/L4clzUufzWXS3OClREaW2p7HB9FOZYFlYtFmoQkaglTNYtRmVASrSW6Ke8SD 9tS0St4AADgWubFEyS6lJSMeZsRRgPO8IkK/d/eJBCGSRiq7/WO3RT8UDzoDdVKnlipK ULqH441k+PgCLLr083ZHNNIJNMZsOfCdhknDA+MfpLkSK35hmnVt6ArDbVtVGNZXnync mWtnqYZn+vRNrUxpxVoqvaiXmxLmCzuKvZT9XfFEA1PDb3U6Ev7D0M0cYQ6hySUI4gTc iWAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=UWKoXHeO024fbcWo/Y7/Dj94VRD2hJHeVVGCqjzITiQ=; b=M53HRuD53bpYrX4+D1wq/KqDgwLKqq219ES+ay36371Remgg9GWohiCRpuR+PJqCNK 6cYNRsO+s4OA4Slp6sqsQQUUTiFRY2GT2td3W4HjORYJRbsKphrBpx6d00LBKEg5ccht 3ydDb/3RkXFkl5o9qBJOibAR3hxZF/T/sr/uux2wCBfioUlEkCQCkYrxzCvTJXUdquAV YSzTJs8rD4c63v8SMQmdEYVPM2U1MqWeK9f02ULx/4CWY/r9TL870Z/V5g95lZ196VEP V56fMkPcWXXB0nU8I8NPeaN0aa3BKpRjPoAidqlPSIXMhqxD5hmTEC97Q74Fnw0WEVzK /ONw== X-Gm-Message-State: ALyK8tLPfptdM6wKCgm2r7pJsECue7YzxJwZvEZvNxnDu0nDyiGyIVyuEEp9dDXyJOUxaA== X-Received: by 10.157.27.225 with SMTP id v30mr14924963otv.107.1468986638062; Tue, 19 Jul 2016 20:50:38 -0700 (PDT) Received: from localhost.localdomain (ip98-184-130-254.tu.ok.cox.net. [98.184.130.254]) by smtp.gmail.com with ESMTPSA id 3sm332068otx.3.2016.07.19.20.50.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jul 2016 20:50:37 -0700 (PDT) From: Michael Welling To: kernel list , linux-input@vger.kernel.org, pali.rohar@gmail.com, sre@kernel.org, ivo.g.dimitrov.75@gmail.com, patrikbachan@gmail.com, serge@hallyn.com, Pavel Machek , Dmitry Torokhov , Aaro Koskinen Cc: Michael Welling Subject: [PATCH] Input: tsc200x - Report proper input_dev name Date: Tue, 19 Jul 2016 22:49:52 -0500 Message-Id: <1468986592-4973-1-git-send-email-mwelling@ieee.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <20160720014424.GI19250@dtor-ws> References: <20160720014424.GI19250@dtor-ws> 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 Passes input_id struct to the 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. Signed-off-by: Michael Welling --- drivers/input/touchscreen/tsc2004.c | 7 ++++++- drivers/input/touchscreen/tsc2005.c | 7 ++++++- drivers/input/touchscreen/tsc200x-core.c | 7 ++++--- drivers/input/touchscreen/tsc200x-core.h | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) 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..5e625c4 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,10 @@ 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"; + input_dev->name = devm_kasprintf(dev, GFP_KERNEL, "TSC%04d touchscreen", + tsc_id->product); 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);