All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Arnd Bergmann <arnd@kernel.org>, Sekhar Nori <nsekhar@ti.com>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	linux-arm-kernel@lists.infradead.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-kernel@vger.kernel.org, Kevin Hilman <khilman@baylibre.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-input@vger.kernel.org
Subject: Re: [PATCH 07/14] input: remove davinci keyboard driver
Date: Thu, 20 Oct 2022 10:02:43 +0200	[thread overview]
Message-ID: <8735biapng.fsf@baylibre.com> (raw)
In-Reply-To: <20221019152947.3857217-8-arnd@kernel.org>

On Wed, Oct 19, 2022 at 17:29, Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
>
> The dm365evm board was removed, and no other users of this
> device exist.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

> ---
>  drivers/input/keyboard/Kconfig           |  10 -
>  drivers/input/keyboard/Makefile          |   1 -
>  drivers/input/keyboard/davinci_keyscan.c | 315 -----------------------
>  3 files changed, 326 deletions(-)
>  delete mode 100644 drivers/input/keyboard/davinci_keyscan.c
>
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index 00292118b79b..957cc6728f4c 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -657,16 +657,6 @@ config KEYBOARD_SUN4I_LRADC
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called sun4i-lradc-keys.
>  
> -config KEYBOARD_DAVINCI
> -	tristate "TI DaVinci Key Scan"
> -	depends on ARCH_DAVINCI_DM365
> -	help
> -	  Say Y to enable keypad module support for the TI DaVinci
> -	  platforms (DM365).
> -
> -	  To compile this driver as a module, choose M here: the
> -	  module will be called davinci_keyscan.
> -
>  config KEYBOARD_IPAQ_MICRO
>  	tristate "Buttons on Micro SoC (iPaq h3100,h3600,h3700)"
>  	depends on MFD_IPAQ_MICRO
> diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
> index 5f67196bb2c1..5ccfdf5c0222 100644
> --- a/drivers/input/keyboard/Makefile
> +++ b/drivers/input/keyboard/Makefile
> @@ -18,7 +18,6 @@ obj-$(CONFIG_KEYBOARD_CAP11XX)		+= cap11xx.o
>  obj-$(CONFIG_KEYBOARD_CLPS711X)		+= clps711x-keypad.o
>  obj-$(CONFIG_KEYBOARD_CROS_EC)		+= cros_ec_keyb.o
>  obj-$(CONFIG_KEYBOARD_CYPRESS_SF)	+= cypress-sf.o
> -obj-$(CONFIG_KEYBOARD_DAVINCI)		+= davinci_keyscan.o
>  obj-$(CONFIG_KEYBOARD_DLINK_DIR685)	+= dlink-dir685-touchkeys.o
>  obj-$(CONFIG_KEYBOARD_EP93XX)		+= ep93xx_keypad.o
>  obj-$(CONFIG_KEYBOARD_GOLDFISH_EVENTS)	+= goldfish_events.o
> diff --git a/drivers/input/keyboard/davinci_keyscan.c b/drivers/input/keyboard/davinci_keyscan.c
> deleted file mode 100644
> index f489cd585b33..000000000000
> --- a/drivers/input/keyboard/davinci_keyscan.c
> +++ /dev/null
> @@ -1,315 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * DaVinci Key Scan Driver for TI platforms
> - *
> - * Copyright (C) 2009 Texas Instruments, Inc
> - *
> - * Author: Miguel Aguilar <miguel.aguilar@ridgerun.com>
> - *
> - * Initial Code: Sandeep Paulraj <s-paulraj@ti.com>
> - */
> -#include <linux/module.h>
> -#include <linux/init.h>
> -#include <linux/interrupt.h>
> -#include <linux/types.h>
> -#include <linux/input.h>
> -#include <linux/kernel.h>
> -#include <linux/delay.h>
> -#include <linux/platform_device.h>
> -#include <linux/errno.h>
> -#include <linux/slab.h>
> -
> -#include <linux/platform_data/keyscan-davinci.h>
> -
> -/* Key scan registers */
> -#define DAVINCI_KEYSCAN_KEYCTRL		0x0000
> -#define DAVINCI_KEYSCAN_INTENA		0x0004
> -#define DAVINCI_KEYSCAN_INTFLAG		0x0008
> -#define DAVINCI_KEYSCAN_INTCLR		0x000c
> -#define DAVINCI_KEYSCAN_STRBWIDTH	0x0010
> -#define DAVINCI_KEYSCAN_INTERVAL	0x0014
> -#define DAVINCI_KEYSCAN_CONTTIME	0x0018
> -#define DAVINCI_KEYSCAN_CURRENTST	0x001c
> -#define DAVINCI_KEYSCAN_PREVSTATE	0x0020
> -#define DAVINCI_KEYSCAN_EMUCTRL		0x0024
> -#define DAVINCI_KEYSCAN_IODFTCTRL	0x002c
> -
> -/* Key Control Register (KEYCTRL) */
> -#define DAVINCI_KEYSCAN_KEYEN		0x00000001
> -#define DAVINCI_KEYSCAN_PREVMODE	0x00000002
> -#define DAVINCI_KEYSCAN_CHATOFF		0x00000004
> -#define DAVINCI_KEYSCAN_AUTODET		0x00000008
> -#define DAVINCI_KEYSCAN_SCANMODE	0x00000010
> -#define DAVINCI_KEYSCAN_OUTTYPE		0x00000020
> -
> -/* Masks for the interrupts */
> -#define DAVINCI_KEYSCAN_INT_CONT	0x00000008
> -#define DAVINCI_KEYSCAN_INT_OFF		0x00000004
> -#define DAVINCI_KEYSCAN_INT_ON		0x00000002
> -#define DAVINCI_KEYSCAN_INT_CHANGE	0x00000001
> -#define DAVINCI_KEYSCAN_INT_ALL		0x0000000f
> -
> -struct davinci_ks {
> -	struct input_dev		*input;
> -	struct davinci_ks_platform_data	*pdata;
> -	int				irq;
> -	void __iomem			*base;
> -	resource_size_t			pbase;
> -	size_t				base_size;
> -	unsigned short			keymap[];
> -};
> -
> -/* Initializing the kp Module */
> -static int __init davinci_ks_initialize(struct davinci_ks *davinci_ks)
> -{
> -	struct device *dev = &davinci_ks->input->dev;
> -	struct davinci_ks_platform_data *pdata = davinci_ks->pdata;
> -	u32 matrix_ctrl;
> -
> -	/* Enable all interrupts */
> -	__raw_writel(DAVINCI_KEYSCAN_INT_ALL,
> -		     davinci_ks->base + DAVINCI_KEYSCAN_INTENA);
> -
> -	/* Clear interrupts if any */
> -	__raw_writel(DAVINCI_KEYSCAN_INT_ALL,
> -		     davinci_ks->base + DAVINCI_KEYSCAN_INTCLR);
> -
> -	/* Setup the scan period = strobe + interval */
> -	__raw_writel(pdata->strobe,
> -		     davinci_ks->base + DAVINCI_KEYSCAN_STRBWIDTH);
> -	__raw_writel(pdata->interval,
> -		     davinci_ks->base + DAVINCI_KEYSCAN_INTERVAL);
> -	__raw_writel(0x01,
> -		     davinci_ks->base + DAVINCI_KEYSCAN_CONTTIME);
> -
> -	/* Define matrix type */
> -	switch (pdata->matrix_type) {
> -	case DAVINCI_KEYSCAN_MATRIX_4X4:
> -		matrix_ctrl = 0;
> -		break;
> -	case DAVINCI_KEYSCAN_MATRIX_5X3:
> -		matrix_ctrl = (1 << 6);
> -		break;
> -	default:
> -		dev_err(dev->parent, "wrong matrix type\n");
> -		return -EINVAL;
> -	}
> -
> -	/* Enable key scan module and set matrix type */
> -	__raw_writel(DAVINCI_KEYSCAN_AUTODET | DAVINCI_KEYSCAN_KEYEN |
> -		     matrix_ctrl, davinci_ks->base + DAVINCI_KEYSCAN_KEYCTRL);
> -
> -	return 0;
> -}
> -
> -static irqreturn_t davinci_ks_interrupt(int irq, void *dev_id)
> -{
> -	struct davinci_ks *davinci_ks = dev_id;
> -	struct device *dev = &davinci_ks->input->dev;
> -	unsigned short *keymap = davinci_ks->keymap;
> -	int keymapsize = davinci_ks->pdata->keymapsize;
> -	u32 prev_status, new_status, changed;
> -	bool release;
> -	int keycode = KEY_UNKNOWN;
> -	int i;
> -
> -	/* Disable interrupt */
> -	__raw_writel(0x0, davinci_ks->base + DAVINCI_KEYSCAN_INTENA);
> -
> -	/* Reading previous and new status of the key scan */
> -	prev_status = __raw_readl(davinci_ks->base + DAVINCI_KEYSCAN_PREVSTATE);
> -	new_status = __raw_readl(davinci_ks->base + DAVINCI_KEYSCAN_CURRENTST);
> -
> -	changed = prev_status ^ new_status;
> -
> -	if (changed) {
> -		/*
> -		 * It goes through all bits in 'changed' to ensure
> -		 * that no key changes are being missed
> -		 */
> -		for (i = 0 ; i < keymapsize; i++) {
> -			if ((changed>>i) & 0x1) {
> -				keycode = keymap[i];
> -				release = (new_status >> i) & 0x1;
> -				dev_dbg(dev->parent, "key %d %s\n", keycode,
> -					release ? "released" : "pressed");
> -				input_report_key(davinci_ks->input, keycode,
> -						 !release);
> -				input_sync(davinci_ks->input);
> -			}
> -		}
> -		/* Clearing interrupt */
> -		__raw_writel(DAVINCI_KEYSCAN_INT_ALL,
> -			     davinci_ks->base + DAVINCI_KEYSCAN_INTCLR);
> -	}
> -
> -	/* Enable interrupts */
> -	__raw_writel(0x1, davinci_ks->base + DAVINCI_KEYSCAN_INTENA);
> -
> -	return IRQ_HANDLED;
> -}
> -
> -static int __init davinci_ks_probe(struct platform_device *pdev)
> -{
> -	struct davinci_ks *davinci_ks;
> -	struct input_dev *key_dev;
> -	struct resource *res, *mem;
> -	struct device *dev = &pdev->dev;
> -	struct davinci_ks_platform_data *pdata = dev_get_platdata(dev);
> -	int error, i;
> -
> -	if (pdata->device_enable) {
> -		error = pdata->device_enable(dev);
> -		if (error < 0) {
> -			dev_dbg(dev, "device enable function failed\n");
> -			return error;
> -		}
> -	}
> -
> -	if (!pdata->keymap) {
> -		dev_dbg(dev, "no keymap from pdata\n");
> -		return -EINVAL;
> -	}
> -
> -	davinci_ks = kzalloc(sizeof(struct davinci_ks) +
> -		sizeof(unsigned short) * pdata->keymapsize, GFP_KERNEL);
> -	if (!davinci_ks) {
> -		dev_dbg(dev, "could not allocate memory for private data\n");
> -		return -ENOMEM;
> -	}
> -
> -	memcpy(davinci_ks->keymap, pdata->keymap,
> -		sizeof(unsigned short) * pdata->keymapsize);
> -
> -	key_dev = input_allocate_device();
> -	if (!key_dev) {
> -		dev_dbg(dev, "could not allocate input device\n");
> -		error = -ENOMEM;
> -		goto fail1;
> -	}
> -
> -	davinci_ks->input = key_dev;
> -
> -	davinci_ks->irq = platform_get_irq(pdev, 0);
> -	if (davinci_ks->irq < 0) {
> -		error = davinci_ks->irq;
> -		goto fail2;
> -	}
> -
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res) {
> -		dev_err(dev, "no mem resource\n");
> -		error = -EINVAL;
> -		goto fail2;
> -	}
> -
> -	davinci_ks->pbase = res->start;
> -	davinci_ks->base_size = resource_size(res);
> -
> -	mem = request_mem_region(davinci_ks->pbase, davinci_ks->base_size,
> -				 pdev->name);
> -	if (!mem) {
> -		dev_err(dev, "key scan registers at %08x are not free\n",
> -			davinci_ks->pbase);
> -		error = -EBUSY;
> -		goto fail2;
> -	}
> -
> -	davinci_ks->base = ioremap(davinci_ks->pbase, davinci_ks->base_size);
> -	if (!davinci_ks->base) {
> -		dev_err(dev, "can't ioremap MEM resource.\n");
> -		error = -ENOMEM;
> -		goto fail3;
> -	}
> -
> -	/* Enable auto repeat feature of Linux input subsystem */
> -	if (pdata->rep)
> -		__set_bit(EV_REP, key_dev->evbit);
> -
> -	/* Setup input device */
> -	__set_bit(EV_KEY, key_dev->evbit);
> -
> -	/* Setup the platform data */
> -	davinci_ks->pdata = pdata;
> -
> -	for (i = 0; i < davinci_ks->pdata->keymapsize; i++)
> -		__set_bit(davinci_ks->pdata->keymap[i], key_dev->keybit);
> -
> -	key_dev->name = "davinci_keyscan";
> -	key_dev->phys = "davinci_keyscan/input0";
> -	key_dev->dev.parent = dev;
> -	key_dev->id.bustype = BUS_HOST;
> -	key_dev->id.vendor = 0x0001;
> -	key_dev->id.product = 0x0001;
> -	key_dev->id.version = 0x0001;
> -	key_dev->keycode = davinci_ks->keymap;
> -	key_dev->keycodesize = sizeof(davinci_ks->keymap[0]);
> -	key_dev->keycodemax = davinci_ks->pdata->keymapsize;
> -
> -	error = input_register_device(davinci_ks->input);
> -	if (error < 0) {
> -		dev_err(dev, "unable to register davinci key scan device\n");
> -		goto fail4;
> -	}
> -
> -	error = request_irq(davinci_ks->irq, davinci_ks_interrupt,
> -			  0, pdev->name, davinci_ks);
> -	if (error < 0) {
> -		dev_err(dev, "unable to register davinci key scan interrupt\n");
> -		goto fail5;
> -	}
> -
> -	error = davinci_ks_initialize(davinci_ks);
> -	if (error < 0) {
> -		dev_err(dev, "unable to initialize davinci key scan device\n");
> -		goto fail6;
> -	}
> -
> -	platform_set_drvdata(pdev, davinci_ks);
> -	return 0;
> -
> -fail6:
> -	free_irq(davinci_ks->irq, davinci_ks);
> -fail5:
> -	input_unregister_device(davinci_ks->input);
> -	key_dev = NULL;
> -fail4:
> -	iounmap(davinci_ks->base);
> -fail3:
> -	release_mem_region(davinci_ks->pbase, davinci_ks->base_size);
> -fail2:
> -	input_free_device(key_dev);
> -fail1:
> -	kfree(davinci_ks);
> -
> -	return error;
> -}
> -
> -static int davinci_ks_remove(struct platform_device *pdev)
> -{
> -	struct davinci_ks *davinci_ks = platform_get_drvdata(pdev);
> -
> -	free_irq(davinci_ks->irq, davinci_ks);
> -
> -	input_unregister_device(davinci_ks->input);
> -
> -	iounmap(davinci_ks->base);
> -	release_mem_region(davinci_ks->pbase, davinci_ks->base_size);
> -
> -	kfree(davinci_ks);
> -
> -	return 0;
> -}
> -
> -static struct platform_driver davinci_ks_driver = {
> -	.driver	= {
> -		.name = "davinci_keyscan",
> -	},
> -	.remove	= davinci_ks_remove,
> -};
> -
> -module_platform_driver_probe(davinci_ks_driver, davinci_ks_probe);
> -
> -MODULE_AUTHOR("Miguel Aguilar");
> -MODULE_DESCRIPTION("Texas Instruments DaVinci Key Scan Driver");
> -MODULE_LICENSE("GPL");
> -- 
> 2.29.2

WARNING: multiple messages have this Message-ID (diff)
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Arnd Bergmann <arnd@kernel.org>, Sekhar Nori <nsekhar@ti.com>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	linux-arm-kernel@lists.infradead.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-kernel@vger.kernel.org, Kevin Hilman <khilman@baylibre.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-input@vger.kernel.org
Subject: Re: [PATCH 07/14] input: remove davinci keyboard driver
Date: Thu, 20 Oct 2022 10:02:43 +0200	[thread overview]
Message-ID: <8735biapng.fsf@baylibre.com> (raw)
In-Reply-To: <20221019152947.3857217-8-arnd@kernel.org>

On Wed, Oct 19, 2022 at 17:29, Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
>
> The dm365evm board was removed, and no other users of this
> device exist.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

> ---
>  drivers/input/keyboard/Kconfig           |  10 -
>  drivers/input/keyboard/Makefile          |   1 -
>  drivers/input/keyboard/davinci_keyscan.c | 315 -----------------------
>  3 files changed, 326 deletions(-)
>  delete mode 100644 drivers/input/keyboard/davinci_keyscan.c
>
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index 00292118b79b..957cc6728f4c 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -657,16 +657,6 @@ config KEYBOARD_SUN4I_LRADC
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called sun4i-lradc-keys.
>  
> -config KEYBOARD_DAVINCI
> -	tristate "TI DaVinci Key Scan"
> -	depends on ARCH_DAVINCI_DM365
> -	help
> -	  Say Y to enable keypad module support for the TI DaVinci
> -	  platforms (DM365).
> -
> -	  To compile this driver as a module, choose M here: the
> -	  module will be called davinci_keyscan.
> -
>  config KEYBOARD_IPAQ_MICRO
>  	tristate "Buttons on Micro SoC (iPaq h3100,h3600,h3700)"
>  	depends on MFD_IPAQ_MICRO
> diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
> index 5f67196bb2c1..5ccfdf5c0222 100644
> --- a/drivers/input/keyboard/Makefile
> +++ b/drivers/input/keyboard/Makefile
> @@ -18,7 +18,6 @@ obj-$(CONFIG_KEYBOARD_CAP11XX)		+= cap11xx.o
>  obj-$(CONFIG_KEYBOARD_CLPS711X)		+= clps711x-keypad.o
>  obj-$(CONFIG_KEYBOARD_CROS_EC)		+= cros_ec_keyb.o
>  obj-$(CONFIG_KEYBOARD_CYPRESS_SF)	+= cypress-sf.o
> -obj-$(CONFIG_KEYBOARD_DAVINCI)		+= davinci_keyscan.o
>  obj-$(CONFIG_KEYBOARD_DLINK_DIR685)	+= dlink-dir685-touchkeys.o
>  obj-$(CONFIG_KEYBOARD_EP93XX)		+= ep93xx_keypad.o
>  obj-$(CONFIG_KEYBOARD_GOLDFISH_EVENTS)	+= goldfish_events.o
> diff --git a/drivers/input/keyboard/davinci_keyscan.c b/drivers/input/keyboard/davinci_keyscan.c
> deleted file mode 100644
> index f489cd585b33..000000000000
> --- a/drivers/input/keyboard/davinci_keyscan.c
> +++ /dev/null
> @@ -1,315 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * DaVinci Key Scan Driver for TI platforms
> - *
> - * Copyright (C) 2009 Texas Instruments, Inc
> - *
> - * Author: Miguel Aguilar <miguel.aguilar@ridgerun.com>
> - *
> - * Initial Code: Sandeep Paulraj <s-paulraj@ti.com>
> - */
> -#include <linux/module.h>
> -#include <linux/init.h>
> -#include <linux/interrupt.h>
> -#include <linux/types.h>
> -#include <linux/input.h>
> -#include <linux/kernel.h>
> -#include <linux/delay.h>
> -#include <linux/platform_device.h>
> -#include <linux/errno.h>
> -#include <linux/slab.h>
> -
> -#include <linux/platform_data/keyscan-davinci.h>
> -
> -/* Key scan registers */
> -#define DAVINCI_KEYSCAN_KEYCTRL		0x0000
> -#define DAVINCI_KEYSCAN_INTENA		0x0004
> -#define DAVINCI_KEYSCAN_INTFLAG		0x0008
> -#define DAVINCI_KEYSCAN_INTCLR		0x000c
> -#define DAVINCI_KEYSCAN_STRBWIDTH	0x0010
> -#define DAVINCI_KEYSCAN_INTERVAL	0x0014
> -#define DAVINCI_KEYSCAN_CONTTIME	0x0018
> -#define DAVINCI_KEYSCAN_CURRENTST	0x001c
> -#define DAVINCI_KEYSCAN_PREVSTATE	0x0020
> -#define DAVINCI_KEYSCAN_EMUCTRL		0x0024
> -#define DAVINCI_KEYSCAN_IODFTCTRL	0x002c
> -
> -/* Key Control Register (KEYCTRL) */
> -#define DAVINCI_KEYSCAN_KEYEN		0x00000001
> -#define DAVINCI_KEYSCAN_PREVMODE	0x00000002
> -#define DAVINCI_KEYSCAN_CHATOFF		0x00000004
> -#define DAVINCI_KEYSCAN_AUTODET		0x00000008
> -#define DAVINCI_KEYSCAN_SCANMODE	0x00000010
> -#define DAVINCI_KEYSCAN_OUTTYPE		0x00000020
> -
> -/* Masks for the interrupts */
> -#define DAVINCI_KEYSCAN_INT_CONT	0x00000008
> -#define DAVINCI_KEYSCAN_INT_OFF		0x00000004
> -#define DAVINCI_KEYSCAN_INT_ON		0x00000002
> -#define DAVINCI_KEYSCAN_INT_CHANGE	0x00000001
> -#define DAVINCI_KEYSCAN_INT_ALL		0x0000000f
> -
> -struct davinci_ks {
> -	struct input_dev		*input;
> -	struct davinci_ks_platform_data	*pdata;
> -	int				irq;
> -	void __iomem			*base;
> -	resource_size_t			pbase;
> -	size_t				base_size;
> -	unsigned short			keymap[];
> -};
> -
> -/* Initializing the kp Module */
> -static int __init davinci_ks_initialize(struct davinci_ks *davinci_ks)
> -{
> -	struct device *dev = &davinci_ks->input->dev;
> -	struct davinci_ks_platform_data *pdata = davinci_ks->pdata;
> -	u32 matrix_ctrl;
> -
> -	/* Enable all interrupts */
> -	__raw_writel(DAVINCI_KEYSCAN_INT_ALL,
> -		     davinci_ks->base + DAVINCI_KEYSCAN_INTENA);
> -
> -	/* Clear interrupts if any */
> -	__raw_writel(DAVINCI_KEYSCAN_INT_ALL,
> -		     davinci_ks->base + DAVINCI_KEYSCAN_INTCLR);
> -
> -	/* Setup the scan period = strobe + interval */
> -	__raw_writel(pdata->strobe,
> -		     davinci_ks->base + DAVINCI_KEYSCAN_STRBWIDTH);
> -	__raw_writel(pdata->interval,
> -		     davinci_ks->base + DAVINCI_KEYSCAN_INTERVAL);
> -	__raw_writel(0x01,
> -		     davinci_ks->base + DAVINCI_KEYSCAN_CONTTIME);
> -
> -	/* Define matrix type */
> -	switch (pdata->matrix_type) {
> -	case DAVINCI_KEYSCAN_MATRIX_4X4:
> -		matrix_ctrl = 0;
> -		break;
> -	case DAVINCI_KEYSCAN_MATRIX_5X3:
> -		matrix_ctrl = (1 << 6);
> -		break;
> -	default:
> -		dev_err(dev->parent, "wrong matrix type\n");
> -		return -EINVAL;
> -	}
> -
> -	/* Enable key scan module and set matrix type */
> -	__raw_writel(DAVINCI_KEYSCAN_AUTODET | DAVINCI_KEYSCAN_KEYEN |
> -		     matrix_ctrl, davinci_ks->base + DAVINCI_KEYSCAN_KEYCTRL);
> -
> -	return 0;
> -}
> -
> -static irqreturn_t davinci_ks_interrupt(int irq, void *dev_id)
> -{
> -	struct davinci_ks *davinci_ks = dev_id;
> -	struct device *dev = &davinci_ks->input->dev;
> -	unsigned short *keymap = davinci_ks->keymap;
> -	int keymapsize = davinci_ks->pdata->keymapsize;
> -	u32 prev_status, new_status, changed;
> -	bool release;
> -	int keycode = KEY_UNKNOWN;
> -	int i;
> -
> -	/* Disable interrupt */
> -	__raw_writel(0x0, davinci_ks->base + DAVINCI_KEYSCAN_INTENA);
> -
> -	/* Reading previous and new status of the key scan */
> -	prev_status = __raw_readl(davinci_ks->base + DAVINCI_KEYSCAN_PREVSTATE);
> -	new_status = __raw_readl(davinci_ks->base + DAVINCI_KEYSCAN_CURRENTST);
> -
> -	changed = prev_status ^ new_status;
> -
> -	if (changed) {
> -		/*
> -		 * It goes through all bits in 'changed' to ensure
> -		 * that no key changes are being missed
> -		 */
> -		for (i = 0 ; i < keymapsize; i++) {
> -			if ((changed>>i) & 0x1) {
> -				keycode = keymap[i];
> -				release = (new_status >> i) & 0x1;
> -				dev_dbg(dev->parent, "key %d %s\n", keycode,
> -					release ? "released" : "pressed");
> -				input_report_key(davinci_ks->input, keycode,
> -						 !release);
> -				input_sync(davinci_ks->input);
> -			}
> -		}
> -		/* Clearing interrupt */
> -		__raw_writel(DAVINCI_KEYSCAN_INT_ALL,
> -			     davinci_ks->base + DAVINCI_KEYSCAN_INTCLR);
> -	}
> -
> -	/* Enable interrupts */
> -	__raw_writel(0x1, davinci_ks->base + DAVINCI_KEYSCAN_INTENA);
> -
> -	return IRQ_HANDLED;
> -}
> -
> -static int __init davinci_ks_probe(struct platform_device *pdev)
> -{
> -	struct davinci_ks *davinci_ks;
> -	struct input_dev *key_dev;
> -	struct resource *res, *mem;
> -	struct device *dev = &pdev->dev;
> -	struct davinci_ks_platform_data *pdata = dev_get_platdata(dev);
> -	int error, i;
> -
> -	if (pdata->device_enable) {
> -		error = pdata->device_enable(dev);
> -		if (error < 0) {
> -			dev_dbg(dev, "device enable function failed\n");
> -			return error;
> -		}
> -	}
> -
> -	if (!pdata->keymap) {
> -		dev_dbg(dev, "no keymap from pdata\n");
> -		return -EINVAL;
> -	}
> -
> -	davinci_ks = kzalloc(sizeof(struct davinci_ks) +
> -		sizeof(unsigned short) * pdata->keymapsize, GFP_KERNEL);
> -	if (!davinci_ks) {
> -		dev_dbg(dev, "could not allocate memory for private data\n");
> -		return -ENOMEM;
> -	}
> -
> -	memcpy(davinci_ks->keymap, pdata->keymap,
> -		sizeof(unsigned short) * pdata->keymapsize);
> -
> -	key_dev = input_allocate_device();
> -	if (!key_dev) {
> -		dev_dbg(dev, "could not allocate input device\n");
> -		error = -ENOMEM;
> -		goto fail1;
> -	}
> -
> -	davinci_ks->input = key_dev;
> -
> -	davinci_ks->irq = platform_get_irq(pdev, 0);
> -	if (davinci_ks->irq < 0) {
> -		error = davinci_ks->irq;
> -		goto fail2;
> -	}
> -
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res) {
> -		dev_err(dev, "no mem resource\n");
> -		error = -EINVAL;
> -		goto fail2;
> -	}
> -
> -	davinci_ks->pbase = res->start;
> -	davinci_ks->base_size = resource_size(res);
> -
> -	mem = request_mem_region(davinci_ks->pbase, davinci_ks->base_size,
> -				 pdev->name);
> -	if (!mem) {
> -		dev_err(dev, "key scan registers at %08x are not free\n",
> -			davinci_ks->pbase);
> -		error = -EBUSY;
> -		goto fail2;
> -	}
> -
> -	davinci_ks->base = ioremap(davinci_ks->pbase, davinci_ks->base_size);
> -	if (!davinci_ks->base) {
> -		dev_err(dev, "can't ioremap MEM resource.\n");
> -		error = -ENOMEM;
> -		goto fail3;
> -	}
> -
> -	/* Enable auto repeat feature of Linux input subsystem */
> -	if (pdata->rep)
> -		__set_bit(EV_REP, key_dev->evbit);
> -
> -	/* Setup input device */
> -	__set_bit(EV_KEY, key_dev->evbit);
> -
> -	/* Setup the platform data */
> -	davinci_ks->pdata = pdata;
> -
> -	for (i = 0; i < davinci_ks->pdata->keymapsize; i++)
> -		__set_bit(davinci_ks->pdata->keymap[i], key_dev->keybit);
> -
> -	key_dev->name = "davinci_keyscan";
> -	key_dev->phys = "davinci_keyscan/input0";
> -	key_dev->dev.parent = dev;
> -	key_dev->id.bustype = BUS_HOST;
> -	key_dev->id.vendor = 0x0001;
> -	key_dev->id.product = 0x0001;
> -	key_dev->id.version = 0x0001;
> -	key_dev->keycode = davinci_ks->keymap;
> -	key_dev->keycodesize = sizeof(davinci_ks->keymap[0]);
> -	key_dev->keycodemax = davinci_ks->pdata->keymapsize;
> -
> -	error = input_register_device(davinci_ks->input);
> -	if (error < 0) {
> -		dev_err(dev, "unable to register davinci key scan device\n");
> -		goto fail4;
> -	}
> -
> -	error = request_irq(davinci_ks->irq, davinci_ks_interrupt,
> -			  0, pdev->name, davinci_ks);
> -	if (error < 0) {
> -		dev_err(dev, "unable to register davinci key scan interrupt\n");
> -		goto fail5;
> -	}
> -
> -	error = davinci_ks_initialize(davinci_ks);
> -	if (error < 0) {
> -		dev_err(dev, "unable to initialize davinci key scan device\n");
> -		goto fail6;
> -	}
> -
> -	platform_set_drvdata(pdev, davinci_ks);
> -	return 0;
> -
> -fail6:
> -	free_irq(davinci_ks->irq, davinci_ks);
> -fail5:
> -	input_unregister_device(davinci_ks->input);
> -	key_dev = NULL;
> -fail4:
> -	iounmap(davinci_ks->base);
> -fail3:
> -	release_mem_region(davinci_ks->pbase, davinci_ks->base_size);
> -fail2:
> -	input_free_device(key_dev);
> -fail1:
> -	kfree(davinci_ks);
> -
> -	return error;
> -}
> -
> -static int davinci_ks_remove(struct platform_device *pdev)
> -{
> -	struct davinci_ks *davinci_ks = platform_get_drvdata(pdev);
> -
> -	free_irq(davinci_ks->irq, davinci_ks);
> -
> -	input_unregister_device(davinci_ks->input);
> -
> -	iounmap(davinci_ks->base);
> -	release_mem_region(davinci_ks->pbase, davinci_ks->base_size);
> -
> -	kfree(davinci_ks);
> -
> -	return 0;
> -}
> -
> -static struct platform_driver davinci_ks_driver = {
> -	.driver	= {
> -		.name = "davinci_keyscan",
> -	},
> -	.remove	= davinci_ks_remove,
> -};
> -
> -module_platform_driver_probe(davinci_ks_driver, davinci_ks_probe);
> -
> -MODULE_AUTHOR("Miguel Aguilar");
> -MODULE_DESCRIPTION("Texas Instruments DaVinci Key Scan Driver");
> -MODULE_LICENSE("GPL");
> -- 
> 2.29.2

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-10-20  8:02 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 15:29 [PATCH 00/14] ARM: remove unused davinci board & drivers Arnd Bergmann
2022-10-19 15:29 ` Arnd Bergmann
2022-10-19 15:29 ` Arnd Bergmann
2022-10-19 15:29 ` [PATCH 01/14] ARM: davinci: remove unused board support Arnd Bergmann
2022-10-20 11:27   ` Bartosz Golaszewski
2022-10-20 11:27     ` Bartosz Golaszewski
2022-10-19 15:29 ` [PATCH 02/14] ARM: davinci: drop DAVINCI_DMxxx references Arnd Bergmann
2022-10-19 15:29   ` Arnd Bergmann
2022-10-19 16:37   ` David Lechner
2022-10-19 16:37     ` David Lechner
2022-10-19 20:32     ` Arnd Bergmann
2022-10-19 20:32       ` Arnd Bergmann
2022-10-27  1:10   ` Stephen Boyd
2022-10-27  1:10     ` Stephen Boyd
2022-10-19 15:29 ` [PATCH 03/14] ARM: davinci: clean up platform support Arnd Bergmann
2022-10-19 15:29   ` Arnd Bergmann
2022-10-20 11:32   ` Bartosz Golaszewski
2022-10-20 11:32     ` Bartosz Golaszewski
2022-10-19 15:29 ` [PATCH 04/14] clk: remove davinci dm3xx drivers Arnd Bergmann
2022-10-19 15:29   ` Arnd Bergmann
2022-10-19 16:39   ` David Lechner
2022-10-19 16:39     ` David Lechner
2022-10-20  7:53   ` Linus Walleij
2022-10-20  7:53     ` Linus Walleij
2022-10-20 11:44   ` Bartosz Golaszewski
2022-10-20 11:44     ` Bartosz Golaszewski
2022-10-27  1:10   ` Stephen Boyd
2022-10-27  1:10     ` Stephen Boyd
2022-10-19 15:29 ` [PATCH 05/14] usb: musb: remove unused davinci support Arnd Bergmann
2022-10-19 15:29   ` Arnd Bergmann
2022-10-20 11:34   ` Bartosz Golaszewski
2022-10-20 11:34     ` Bartosz Golaszewski
2022-10-19 15:29 ` [PATCH 06/14] mfd: remove dm355evm_msp driver Arnd Bergmann
2022-10-19 15:29   ` Arnd Bergmann
2022-10-20 11:35   ` Bartosz Golaszewski
2022-10-20 11:35     ` Bartosz Golaszewski
2022-10-31 15:01   ` Lee Jones
2022-10-31 15:01     ` Lee Jones
2022-10-31 15:01     ` Lee Jones
2022-10-31 15:01       ` Lee Jones
2022-10-19 15:29 ` [PATCH 07/14] input: remove davinci keyboard driver Arnd Bergmann
2022-10-19 15:29   ` Arnd Bergmann
2022-10-20  8:02   ` Mattijs Korpershoek [this message]
2022-10-20  8:02     ` Mattijs Korpershoek
2022-10-20 11:17   ` Bartosz Golaszewski
2022-10-20 11:17     ` Bartosz Golaszewski
2022-10-19 15:29 ` [PATCH 08/14] rtc: remove davinci rtc driver Arnd Bergmann
2022-10-19 15:29   ` Arnd Bergmann
2022-10-20 11:35   ` Bartosz Golaszewski
2022-10-20 11:35     ` Bartosz Golaszewski
2022-10-19 15:29 ` [PATCH 09/14] ASoC: remove unused davinci support Arnd Bergmann
2022-10-19 15:29   ` Arnd Bergmann
2022-10-19 15:29   ` Arnd Bergmann
2022-10-19 15:52   ` Mark Brown
2022-10-19 15:52     ` Mark Brown
2022-10-19 15:52     ` Mark Brown
2022-10-19 15:29 ` [PATCH 10/14] mfd: remove davinci voicecodec driver Arnd Bergmann
2022-10-19 15:29   ` Arnd Bergmann
2022-10-20 11:35   ` Bartosz Golaszewski
2022-10-20 11:35     ` Bartosz Golaszewski
2022-10-31 15:17   ` Lee Jones
2022-10-31 15:17     ` Lee Jones
2022-10-19 15:29 ` [PATCH 11/14] pata: remove palmchip bk3710 driver Arnd Bergmann
2022-10-19 15:29   ` Arnd Bergmann
2022-10-19 23:17   ` Damien Le Moal
2022-10-19 23:17     ` Damien Le Moal
2022-10-20  7:09     ` Arnd Bergmann
2022-10-20  7:09       ` Arnd Bergmann
2022-10-20 11:02   ` Sergey Shtylyov
2022-10-20 11:02     ` Sergey Shtylyov
2022-10-20 11:18   ` Bartosz Golaszewski
2022-10-20 11:18     ` Bartosz Golaszewski
2022-10-20 23:03   ` Damien Le Moal
2022-10-20 23:03     ` Damien Le Moal
2022-10-19 15:29 ` [PATCH 12/14] irqchip: remove davinci aintc driver Arnd Bergmann
2022-10-19 15:29   ` Arnd Bergmann
2022-10-20 11:33   ` Bartosz Golaszewski
2022-10-20 11:33     ` Bartosz Golaszewski
2022-10-19 15:29 ` [PATCH 13/14] staging: media: remove davinci vpfe_capture driver Arnd Bergmann
2022-10-20 15:39   ` Greg Kroah-Hartman
2022-10-20 15:39     ` Greg Kroah-Hartman
2022-10-24 11:01   ` Hans Verkuil
2022-10-24 11:01     ` Hans Verkuil
2022-10-25 22:21   ` Lad, Prabhakar
2022-10-25 22:21     ` Lad, Prabhakar
2022-10-19 15:29 ` [PATCH 14/14] media: davinci: remove vpbe support Arnd Bergmann
2022-10-24 11:03   ` Hans Verkuil
2022-10-25 22:22   ` Lad, Prabhakar
2022-10-25 22:22     ` Lad, Prabhakar
2022-10-19 15:39 ` [PATCH 00/14] ARM: remove unused davinci board & drivers Marc Zyngier
2022-10-19 15:39   ` Marc Zyngier
2022-10-19 15:39   ` Marc Zyngier
2022-10-24 18:25 ` Kevin Hilman
2022-10-24 18:25   ` Kevin Hilman
2022-10-24 18:25   ` Kevin Hilman
2022-11-14 21:08 ` Alexandre Belloni
2022-11-14 21:08   ` Alexandre Belloni
2022-11-14 21:08   ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8735biapng.fsf@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=brgl@bgdev.pl \
    --cc=dmitry.torokhov@gmail.com \
    --cc=khilman@baylibre.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nsekhar@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.