From patchwork Sun Sep 17 11:14:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9954757 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 D345C603F2 for ; Sun, 17 Sep 2017 11:15:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9357128B98 for ; Sun, 17 Sep 2017 11:15:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8883828B99; Sun, 17 Sep 2017 11:15:36 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 0857928B50 for ; Sun, 17 Sep 2017 11:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750824AbdIQLPB (ORCPT ); Sun, 17 Sep 2017 07:15:01 -0400 Received: from mail-lf0-f47.google.com ([209.85.215.47]:43201 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750803AbdIQLPA (ORCPT ); Sun, 17 Sep 2017 07:15:00 -0400 Received: by mail-lf0-f47.google.com with SMTP id c80so5677546lfh.0 for ; Sun, 17 Sep 2017 04:15:00 -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:in-reply-to:references; bh=3BZyeBd4dbXU93u6C56RJsCwZiRh4Tsz5RyygO1mo04=; b=gv7HX8lhZnaxvmJX/YZjpccnvaCGuZtsfetNegHQhVgwaND2KdfSVYFJRxPIMCU1Tf s7/WoSxuZxaYD8+sJ2wDCGQtq44132fNNeGWlwDhTnmI2Q/Ov3A5iw9jxGKSP0E/qmMA 9TSFrzk3IcbIiZsYsGSOvKDlkphrriQUwxcmQ= 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:in-reply-to :references; bh=3BZyeBd4dbXU93u6C56RJsCwZiRh4Tsz5RyygO1mo04=; b=PRqr8YH63gcP+jgwpT4svo4mmKVSKOKA8aRQvSRwrncnegaVhW0jFzGKFMZ6FhXvRm MPfhQFnBTTf3TyxUko9Rjp3xZZ4HIdoTyA5/YlN5ELQP14QNMc4EreA2KZcZ/KQCKmnl bKgl/QT6ZPv7hUycCgW/yybwXzhgq/NO4AwB9D0+x54lseuaMAD7nXTIQaxtCInNG+7u yCsdCm98POzpIzv9AGSQWkcu8Xx7VCTEWJn+J4yT2s0vSuGX0kOwwUAabbE4dz43qPmT CfCvYeoSxEkutbCWgqj63cdlUc564pEJUXzmhCJ8wZamWY3nwEE93lrJtPJYV6ZICtvw 92OA== X-Gm-Message-State: AHPjjUgcug4gys5/jSkZjTTdVNJ2wL1te8t0L1SEsWKerAiaCj5Sr3/N N1aAPJnLeWwVecaa X-Google-Smtp-Source: AOwi7QB4A7iXenrXQ/v2dL/Dwco+SI1fEYtDXjsQC48fYZlxdAHJE0+NBYtvJwN5s5qJp7vThZ4/xA== X-Received: by 10.46.43.142 with SMTP id r14mr7156173ljr.159.1505646899242; Sun, 17 Sep 2017 04:14:59 -0700 (PDT) Received: from fabina.bredbandsbolaget.se (c-2209e055.014-348-6c756e10.cust.bredbandsbolaget.se. [85.224.9.34]) by smtp.gmail.com with ESMTPSA id h83sm1007069lfi.16.2017.09.17.04.14.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Sep 2017 04:14:58 -0700 (PDT) From: Linus Walleij To: Dmitry Torokhov , linux-input@vger.kernel.org, Hans-Christian Noren Egtvedt Cc: Linus Walleij Subject: [PATCH 1/5] input: mouse: Kill off platform data for GPIO mouse Date: Sun, 17 Sep 2017 13:14:41 +0200 Message-Id: <20170917111445.30880-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170917111445.30880-1-linus.walleij@linaro.org> References: <20170917111445.30880-1-linus.walleij@linaro.org> 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 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. Signed-off-by: Linus Walleij --- 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 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 */