From patchwork Mon Sep 25 16:34:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 114174 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp2803760qgf; Mon, 25 Sep 2017 09:34:42 -0700 (PDT) X-Received: by 10.101.86.79 with SMTP id m15mr8205903pgs.157.1506357281919; Mon, 25 Sep 2017 09:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506357281; cv=none; d=google.com; s=arc-20160816; b=JM0m6VDtreQ7tGmlLQ5M9LD2W0bTIqGl18LPvhqXSgJcDoewMItjUhuJK+INQ6A7Jv iMQpByBVhwhZfVszIkYi9/b0LLZJd3e5uqz8kI2FnemQPRFXi62le/GG6ONE+avQSsz9 FAbLAusr3Vtj3m429r7W/i6eOlEFc8fGpU/gxlJakHZxwmRhssnpxV8WG3WysqVAaMON exB3+KyA/teMwW36ReX5w5DW3J4ylAaQBfb6jmi+KVXrmIWOYyox5RFQhKPs0u8Z4gC2 Tkmh0JeydEvTxCqHCt74imbvGXAN910H6AQUBBxRUGihJuMsIYudNHqsMHSiXMObaclU QDIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=PViTOxUjsJjWigeNy2JSTtWQ+OVnjqEFT1nvDqFpKPg=; b=CTDi0Cy3bvLjedzzH0BD2C4Z2LMDtWzVOxj6IDrN/1Qaknzf3xtaHcTQsJ/5mQXfCW G03tcrSl2m/gvoUr2fvW3chUadoo3RvLG8bMUZ5eU/bqwT029w88YtfThRS/1OlDEpqj CuDBtt4GYKgwqLqT+xOuoDF1FchoGnEshA6WS+uCrUQUzbE/KaJ3SKUpCrWMCxlIMojv 8cMAG8GlTekA3z/KlzDRmHLbDXAy6EN9LtBPRP9EphK12m5aYLRcDyNtjmKnmWWTMBFg m190753RqkG/x7bOFwmxQwjgJaLoi1Nv+3NywgWRj13GsxbxmS+CAQGFlONASKulwZAG SgwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Jrbz93ce; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r7si4373999ple.652.2017.09.25.09.34.41 for ; Mon, 25 Sep 2017 09:34:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Jrbz93ce; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965161AbdIYQek (ORCPT ); Mon, 25 Sep 2017 12:34:40 -0400 Received: from mail-pg0-f47.google.com ([74.125.83.47]:52314 "EHLO mail-pg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964935AbdIYQej (ORCPT ); Mon, 25 Sep 2017 12:34:39 -0400 Received: by mail-pg0-f47.google.com with SMTP id i195so4264750pgd.9 for ; Mon, 25 Sep 2017 09:34:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=0dDQVrgElU7wFnPSTJX0s5kxTVGvFUv3I8ofiYNIqGE=; b=Jrbz93cettaSxmNackcxXBNInTPNhV4YQuwQ61tDYAYSDAkvERx2R/V/BO+215BGWI bdjeWLGJ7t2ICzpvM0GC96wcALZ6UcKsE5yX4eBAmr7PPNRwP9AhNDl58llYX4xwhP/Z +hQAsSVVKXvvHdFU4ZqtD60UG0PHtIOYxh1vE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0dDQVrgElU7wFnPSTJX0s5kxTVGvFUv3I8ofiYNIqGE=; b=SmENlu4opt2jeF6txd4bIlRZXles3mAxhVZU5DH58Wiiu/rXUL4KLbMTng4BdidN4e 3o+9bUksHY4EPxQto12fDdi1yYA0rR39uh4xc2iHj474hcx/OA/3a9YR9wJ9LlLcaDyg yBF/07V278sTiEED63l35vetVnyAIjrUB7MYYWq2hSdoE2tPGUqp1I/RAd65M71Y2Fwu eVfHyM8MBz3hP+RgNWk3nAOXJoZxzLc0GYfUgWgecLArMISacIOmUcyC3i+DLHw+G28X ciQLRxV75fPWIicjjcLvIdwm7ljIYxBFcGeHBjnJ3ppUPC7SHJDXSstLM082Ks6oDzO0 cj9A== X-Gm-Message-State: AHPjjUgrNZ63fSuB3RE2xS5n6eOFN5u8yQnKcZy5MOjHAOOO/EBDk6Uq SMf5Ui4sg10qJZtM0/Ua6eSBpA== X-Google-Smtp-Source: AOwi7QAtXyagAdiAwgrNP65sWzz+htwBIpaI6+ieOkkpdho7L/SAOZXB21yT4vQ516pZirTgm/VPhQ== X-Received: by 10.98.144.89 with SMTP id a86mr8033534pfe.64.1506357279282; Mon, 25 Sep 2017 09:34:39 -0700 (PDT) Received: from localhost.localdomain ([70.35.39.2]) by smtp.gmail.com with ESMTPSA id j1sm12004413pfc.169.2017.09.25.09.34.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Sep 2017 09:34:38 -0700 (PDT) From: Linus Walleij To: Dmitry Torokhov , linux-input@vger.kernel.org Cc: Hans-Christian Noren Egtvedt , Linus Walleij Subject: [PATCH 1/5 v2] input: mouse: Kill off platform data for GPIO mouse Date: Mon, 25 Sep 2017 18:34:26 +0200 Message-Id: <20170925163430.22397-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This is not used much: git grep gpio_mouse_platform_data shows that absolutely nothing in the kernel defines this platform data. It could be argued that the driver should be deleted. But that is a bit harsh I think since it seems generally useful. So this patch starts a series which repurposes it to be used with hardware nodes from device tree or ACPI. This first patch simply localize the platform data header and allocates a dummy platform data. Yes: this patch leaves the driver in a pretty useless state, but since nothing is instantiating this driver, it doesn't make it more useless than it already is. Later patches makes use of the driver. Acked-by: Hans-Christian Noren Egtvedt Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Collect Hand-Christian's ACK --- drivers/input/mouse/gpio_mouse.c | 59 +++++++++++++++++++++++++++++++++----- include/linux/gpio_mouse.h | 61 ---------------------------------------- 2 files changed, 52 insertions(+), 68 deletions(-) delete mode 100644 include/linux/gpio_mouse.h -- 2.13.5 -- 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/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c index ced07391304b..dcaba1e4fffb 100644 --- a/drivers/input/mouse/gpio_mouse.c +++ b/drivers/input/mouse/gpio_mouse.c @@ -12,8 +12,54 @@ #include #include #include -#include +#define GPIO_MOUSE_POLARITY_ACT_HIGH 0x00 +#define GPIO_MOUSE_POLARITY_ACT_LOW 0x01 + +#define GPIO_MOUSE_PIN_UP 0 +#define GPIO_MOUSE_PIN_DOWN 1 +#define GPIO_MOUSE_PIN_LEFT 2 +#define GPIO_MOUSE_PIN_RIGHT 3 +#define GPIO_MOUSE_PIN_BLEFT 4 +#define GPIO_MOUSE_PIN_BMIDDLE 5 +#define GPIO_MOUSE_PIN_BRIGHT 6 +#define GPIO_MOUSE_PIN_MAX 7 + +/** + * struct gpio_mouse_platform_data + * @scan_ms: integer in ms specifying the scan periode. + * @polarity: Pin polarity, active high or low. + * @up: GPIO line for up value. + * @down: GPIO line for down value. + * @left: GPIO line for left value. + * @right: GPIO line for right value. + * @bleft: GPIO line for left button. + * @bmiddle: GPIO line for middle button. + * @bright: GPIO line for right button. + * @pins: GPIO line numbers used for the mouse. + * + * This struct must be added to the platform_device in the board code. + * It is used by the gpio_mouse driver to setup GPIO lines and to + * calculate mouse movement. + */ +struct gpio_mouse_platform_data { + int scan_ms; + int polarity; + + union { + struct { + int up; + int down; + int left; + int right; + + int bleft; + int bmiddle; + int bright; + }; + int pins[GPIO_MOUSE_PIN_MAX]; + }; +}; /* * Timer function which is run every scan_ms ms when the device is opened. @@ -47,17 +93,16 @@ static void gpio_mouse_scan(struct input_polled_dev *dev) static int gpio_mouse_probe(struct platform_device *pdev) { - struct gpio_mouse_platform_data *pdata = dev_get_platdata(&pdev->dev); + struct device *dev = &pdev->dev; + struct gpio_mouse_platform_data *pdata; struct input_polled_dev *input_poll; struct input_dev *input; int pin, i; int error; - if (!pdata) { - dev_err(&pdev->dev, "no platform data\n"); - error = -ENXIO; - goto out; - } + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; if (pdata->scan_ms < 0) { dev_err(&pdev->dev, "invalid scan time\n"); diff --git a/include/linux/gpio_mouse.h b/include/linux/gpio_mouse.h deleted file mode 100644 index 44ed7aa14d85..000000000000 --- a/include/linux/gpio_mouse.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Driver for simulating a mouse on GPIO lines. - * - * Copyright (C) 2007 Atmel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef _GPIO_MOUSE_H -#define _GPIO_MOUSE_H - -#define GPIO_MOUSE_POLARITY_ACT_HIGH 0x00 -#define GPIO_MOUSE_POLARITY_ACT_LOW 0x01 - -#define GPIO_MOUSE_PIN_UP 0 -#define GPIO_MOUSE_PIN_DOWN 1 -#define GPIO_MOUSE_PIN_LEFT 2 -#define GPIO_MOUSE_PIN_RIGHT 3 -#define GPIO_MOUSE_PIN_BLEFT 4 -#define GPIO_MOUSE_PIN_BMIDDLE 5 -#define GPIO_MOUSE_PIN_BRIGHT 6 -#define GPIO_MOUSE_PIN_MAX 7 - -/** - * struct gpio_mouse_platform_data - * @scan_ms: integer in ms specifying the scan periode. - * @polarity: Pin polarity, active high or low. - * @up: GPIO line for up value. - * @down: GPIO line for down value. - * @left: GPIO line for left value. - * @right: GPIO line for right value. - * @bleft: GPIO line for left button. - * @bmiddle: GPIO line for middle button. - * @bright: GPIO line for right button. - * - * This struct must be added to the platform_device in the board code. - * It is used by the gpio_mouse driver to setup GPIO lines and to - * calculate mouse movement. - */ -struct gpio_mouse_platform_data { - int scan_ms; - int polarity; - - union { - struct { - int up; - int down; - int left; - int right; - - int bleft; - int bmiddle; - int bright; - }; - int pins[GPIO_MOUSE_PIN_MAX]; - }; -}; - -#endif /* _GPIO_MOUSE_H */