input: misc: remove blackfin rotary driver
The blackfin architecture is getting removed, so this one is obsolete as well. Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Aaron Wu <aaron.wu@analog.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
parent
01b7649598
commit
c957ea5c79
|
@ -655,15 +655,6 @@ config INPUT_DM355EVM
|
|||
To compile this driver as a module, choose M here: the
|
||||
module will be called dm355evm_keys.
|
||||
|
||||
config INPUT_BFIN_ROTARY
|
||||
tristate "Blackfin Rotary support"
|
||||
depends on BF54x || BF52x
|
||||
help
|
||||
Say Y here if you want to use the Blackfin Rotary.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called bfin-rotary.
|
||||
|
||||
config INPUT_WM831X_ON
|
||||
tristate "WM831X ON pin"
|
||||
depends on MFD_WM831X
|
||||
|
|
|
@ -19,7 +19,6 @@ obj-$(CONFIG_INPUT_ARIZONA_HAPTICS) += arizona-haptics.o
|
|||
obj-$(CONFIG_INPUT_ATI_REMOTE2) += ati_remote2.o
|
||||
obj-$(CONFIG_INPUT_ATLAS_BTNS) += atlas_btns.o
|
||||
obj-$(CONFIG_INPUT_ATMEL_CAPTOUCH) += atmel_captouch.o
|
||||
obj-$(CONFIG_INPUT_BFIN_ROTARY) += bfin_rotary.o
|
||||
obj-$(CONFIG_INPUT_BMA150) += bma150.o
|
||||
obj-$(CONFIG_INPUT_CM109) += cm109.o
|
||||
obj-$(CONFIG_INPUT_CMA3000) += cma3000_d0x.o
|
||||
|
|
|
@ -1,294 +0,0 @@
|
|||
/*
|
||||
* Rotary counter driver for Analog Devices Blackfin Processors
|
||||
*
|
||||
* Copyright 2008-2009 Analog Devices Inc.
|
||||
* Licensed under the GPL-2 or later.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/platform_data/bfin_rotary.h>
|
||||
|
||||
#include <asm/portmux.h>
|
||||
|
||||
#define CNT_CONFIG_OFF 0 /* CNT Config Offset */
|
||||
#define CNT_IMASK_OFF 4 /* CNT Interrupt Mask Offset */
|
||||
#define CNT_STATUS_OFF 8 /* CNT Status Offset */
|
||||
#define CNT_COMMAND_OFF 12 /* CNT Command Offset */
|
||||
#define CNT_DEBOUNCE_OFF 16 /* CNT Debounce Offset */
|
||||
#define CNT_COUNTER_OFF 20 /* CNT Counter Offset */
|
||||
#define CNT_MAX_OFF 24 /* CNT Maximum Count Offset */
|
||||
#define CNT_MIN_OFF 28 /* CNT Minimum Count Offset */
|
||||
|
||||
struct bfin_rot {
|
||||
struct input_dev *input;
|
||||
void __iomem *base;
|
||||
int irq;
|
||||
unsigned int up_key;
|
||||
unsigned int down_key;
|
||||
unsigned int button_key;
|
||||
unsigned int rel_code;
|
||||
|
||||
unsigned short mode;
|
||||
unsigned short debounce;
|
||||
|
||||
unsigned short cnt_config;
|
||||
unsigned short cnt_imask;
|
||||
unsigned short cnt_debounce;
|
||||
};
|
||||
|
||||
static void report_key_event(struct input_dev *input, int keycode)
|
||||
{
|
||||
/* simulate a press-n-release */
|
||||
input_report_key(input, keycode, 1);
|
||||
input_sync(input);
|
||||
input_report_key(input, keycode, 0);
|
||||
input_sync(input);
|
||||
}
|
||||
|
||||
static void report_rotary_event(struct bfin_rot *rotary, int delta)
|
||||
{
|
||||
struct input_dev *input = rotary->input;
|
||||
|
||||
if (rotary->up_key) {
|
||||
report_key_event(input,
|
||||
delta > 0 ? rotary->up_key : rotary->down_key);
|
||||
} else {
|
||||
input_report_rel(input, rotary->rel_code, delta);
|
||||
input_sync(input);
|
||||
}
|
||||
}
|
||||
|
||||
static irqreturn_t bfin_rotary_isr(int irq, void *dev_id)
|
||||
{
|
||||
struct bfin_rot *rotary = dev_id;
|
||||
int delta;
|
||||
|
||||
switch (readw(rotary->base + CNT_STATUS_OFF)) {
|
||||
|
||||
case ICII:
|
||||
break;
|
||||
|
||||
case UCII:
|
||||
case DCII:
|
||||
delta = readl(rotary->base + CNT_COUNTER_OFF);
|
||||
if (delta)
|
||||
report_rotary_event(rotary, delta);
|
||||
break;
|
||||
|
||||
case CZMII:
|
||||
report_key_event(rotary->input, rotary->button_key);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
writew(W1LCNT_ZERO, rotary->base + CNT_COMMAND_OFF); /* Clear COUNTER */
|
||||
writew(-1, rotary->base + CNT_STATUS_OFF); /* Clear STATUS */
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int bfin_rotary_open(struct input_dev *input)
|
||||
{
|
||||
struct bfin_rot *rotary = input_get_drvdata(input);
|
||||
unsigned short val;
|
||||
|
||||
if (rotary->mode & ROT_DEBE)
|
||||
writew(rotary->debounce & DPRESCALE,
|
||||
rotary->base + CNT_DEBOUNCE_OFF);
|
||||
|
||||
writew(rotary->mode & ~CNTE, rotary->base + CNT_CONFIG_OFF);
|
||||
|
||||
val = UCIE | DCIE;
|
||||
if (rotary->button_key)
|
||||
val |= CZMIE;
|
||||
writew(val, rotary->base + CNT_IMASK_OFF);
|
||||
|
||||
writew(rotary->mode | CNTE, rotary->base + CNT_CONFIG_OFF);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bfin_rotary_close(struct input_dev *input)
|
||||
{
|
||||
struct bfin_rot *rotary = input_get_drvdata(input);
|
||||
|
||||
writew(0, rotary->base + CNT_CONFIG_OFF);
|
||||
writew(0, rotary->base + CNT_IMASK_OFF);
|
||||
}
|
||||
|
||||
static void bfin_rotary_free_action(void *data)
|
||||
{
|
||||
peripheral_free_list(data);
|
||||
}
|
||||
|
||||
static int bfin_rotary_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
const struct bfin_rotary_platform_data *pdata = dev_get_platdata(dev);
|
||||
struct bfin_rot *rotary;
|
||||
struct resource *res;
|
||||
struct input_dev *input;
|
||||
int error;
|
||||
|
||||
/* Basic validation */
|
||||
if ((pdata->rotary_up_key && !pdata->rotary_down_key) ||
|
||||
(!pdata->rotary_up_key && pdata->rotary_down_key)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (pdata->pin_list) {
|
||||
error = peripheral_request_list(pdata->pin_list,
|
||||
dev_name(dev));
|
||||
if (error) {
|
||||
dev_err(dev, "requesting peripherals failed: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
|
||||
error = devm_add_action_or_reset(dev, bfin_rotary_free_action,
|
||||
pdata->pin_list);
|
||||
if (error) {
|
||||
dev_err(dev, "setting cleanup action failed: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
rotary = devm_kzalloc(dev, sizeof(struct bfin_rot), GFP_KERNEL);
|
||||
if (!rotary)
|
||||
return -ENOMEM;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
rotary->base = devm_ioremap_resource(dev, res);
|
||||
if (IS_ERR(rotary->base))
|
||||
return PTR_ERR(rotary->base);
|
||||
|
||||
input = devm_input_allocate_device(dev);
|
||||
if (!input)
|
||||
return -ENOMEM;
|
||||
|
||||
rotary->input = input;
|
||||
|
||||
rotary->up_key = pdata->rotary_up_key;
|
||||
rotary->down_key = pdata->rotary_down_key;
|
||||
rotary->button_key = pdata->rotary_button_key;
|
||||
rotary->rel_code = pdata->rotary_rel_code;
|
||||
|
||||
rotary->mode = pdata->mode;
|
||||
rotary->debounce = pdata->debounce;
|
||||
|
||||
input->name = pdev->name;
|
||||
input->phys = "bfin-rotary/input0";
|
||||
input->dev.parent = dev;
|
||||
|
||||
input_set_drvdata(input, rotary);
|
||||
|
||||
input->id.bustype = BUS_HOST;
|
||||
input->id.vendor = 0x0001;
|
||||
input->id.product = 0x0001;
|
||||
input->id.version = 0x0100;
|
||||
|
||||
input->open = bfin_rotary_open;
|
||||
input->close = bfin_rotary_close;
|
||||
|
||||
if (rotary->up_key) {
|
||||
__set_bit(EV_KEY, input->evbit);
|
||||
__set_bit(rotary->up_key, input->keybit);
|
||||
__set_bit(rotary->down_key, input->keybit);
|
||||
} else {
|
||||
__set_bit(EV_REL, input->evbit);
|
||||
__set_bit(rotary->rel_code, input->relbit);
|
||||
}
|
||||
|
||||
if (rotary->button_key) {
|
||||
__set_bit(EV_KEY, input->evbit);
|
||||
__set_bit(rotary->button_key, input->keybit);
|
||||
}
|
||||
|
||||
/* Quiesce the device before requesting irq */
|
||||
bfin_rotary_close(input);
|
||||
|
||||
rotary->irq = platform_get_irq(pdev, 0);
|
||||
if (rotary->irq < 0) {
|
||||
dev_err(dev, "No rotary IRQ specified\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr,
|
||||
0, dev_name(dev), rotary);
|
||||
if (error) {
|
||||
dev_err(dev, "unable to claim irq %d; error %d\n",
|
||||
rotary->irq, error);
|
||||
return error;
|
||||
}
|
||||
|
||||
error = input_register_device(input);
|
||||
if (error) {
|
||||
dev_err(dev, "unable to register input device (%d)\n", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, rotary);
|
||||
device_init_wakeup(dev, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused bfin_rotary_suspend(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct bfin_rot *rotary = platform_get_drvdata(pdev);
|
||||
|
||||
rotary->cnt_config = readw(rotary->base + CNT_CONFIG_OFF);
|
||||
rotary->cnt_imask = readw(rotary->base + CNT_IMASK_OFF);
|
||||
rotary->cnt_debounce = readw(rotary->base + CNT_DEBOUNCE_OFF);
|
||||
|
||||
if (device_may_wakeup(&pdev->dev))
|
||||
enable_irq_wake(rotary->irq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused bfin_rotary_resume(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct bfin_rot *rotary = platform_get_drvdata(pdev);
|
||||
|
||||
writew(rotary->cnt_debounce, rotary->base + CNT_DEBOUNCE_OFF);
|
||||
writew(rotary->cnt_imask, rotary->base + CNT_IMASK_OFF);
|
||||
writew(rotary->cnt_config & ~CNTE, rotary->base + CNT_CONFIG_OFF);
|
||||
|
||||
if (device_may_wakeup(&pdev->dev))
|
||||
disable_irq_wake(rotary->irq);
|
||||
|
||||
if (rotary->cnt_config & CNTE)
|
||||
writew(rotary->cnt_config, rotary->base + CNT_CONFIG_OFF);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(bfin_rotary_pm_ops,
|
||||
bfin_rotary_suspend, bfin_rotary_resume);
|
||||
|
||||
static struct platform_driver bfin_rotary_device_driver = {
|
||||
.probe = bfin_rotary_probe,
|
||||
.driver = {
|
||||
.name = "bfin-rotary",
|
||||
.pm = &bfin_rotary_pm_ops,
|
||||
},
|
||||
};
|
||||
module_platform_driver(bfin_rotary_device_driver);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
|
||||
MODULE_DESCRIPTION("Rotary Counter driver for Blackfin Processors");
|
||||
MODULE_ALIAS("platform:bfin-rotary");
|
|
@ -1,117 +0,0 @@
|
|||
/*
|
||||
* board initialization should put one of these structures into platform_data
|
||||
* and place the bfin-rotary onto platform_bus named "bfin-rotary".
|
||||
*
|
||||
* Copyright 2008-2010 Analog Devices Inc.
|
||||
*
|
||||
* Licensed under the GPL-2 or later.
|
||||
*/
|
||||
|
||||
#ifndef _BFIN_ROTARY_H
|
||||
#define _BFIN_ROTARY_H
|
||||
|
||||
/* mode bitmasks */
|
||||
#define ROT_QUAD_ENC CNTMODE_QUADENC /* quadrature/grey code encoder mode */
|
||||
#define ROT_BIN_ENC CNTMODE_BINENC /* binary encoder mode */
|
||||
#define ROT_UD_CNT CNTMODE_UDCNT /* rotary counter mode */
|
||||
#define ROT_DIR_CNT CNTMODE_DIRCNT /* direction counter mode */
|
||||
|
||||
#define ROT_DEBE DEBE /* Debounce Enable */
|
||||
|
||||
#define ROT_CDGINV CDGINV /* CDG Pin Polarity Invert */
|
||||
#define ROT_CUDINV CUDINV /* CUD Pin Polarity Invert */
|
||||
#define ROT_CZMINV CZMINV /* CZM Pin Polarity Invert */
|
||||
|
||||
struct bfin_rotary_platform_data {
|
||||
/* set rotary UP KEY_### or BTN_### in case you prefer
|
||||
* bfin-rotary to send EV_KEY otherwise set 0
|
||||
*/
|
||||
unsigned int rotary_up_key;
|
||||
/* set rotary DOWN KEY_### or BTN_### in case you prefer
|
||||
* bfin-rotary to send EV_KEY otherwise set 0
|
||||
*/
|
||||
unsigned int rotary_down_key;
|
||||
/* set rotary BUTTON KEY_### or BTN_### */
|
||||
unsigned int rotary_button_key;
|
||||
/* set rotary Relative Axis REL_### in case you prefer
|
||||
* bfin-rotary to send EV_REL otherwise set 0
|
||||
*/
|
||||
unsigned int rotary_rel_code;
|
||||
unsigned short debounce; /* 0..17 */
|
||||
unsigned short mode;
|
||||
unsigned short pm_wakeup;
|
||||
unsigned short *pin_list;
|
||||
};
|
||||
|
||||
/* CNT_CONFIG bitmasks */
|
||||
#define CNTE (1 << 0) /* Counter Enable */
|
||||
#define DEBE (1 << 1) /* Debounce Enable */
|
||||
#define CDGINV (1 << 4) /* CDG Pin Polarity Invert */
|
||||
#define CUDINV (1 << 5) /* CUD Pin Polarity Invert */
|
||||
#define CZMINV (1 << 6) /* CZM Pin Polarity Invert */
|
||||
#define CNTMODE_SHIFT 8
|
||||
#define CNTMODE (0x7 << CNTMODE_SHIFT) /* Counter Operating Mode */
|
||||
#define ZMZC (1 << 1) /* CZM Zeroes Counter Enable */
|
||||
#define BNDMODE_SHIFT 12
|
||||
#define BNDMODE (0x3 << BNDMODE_SHIFT) /* Boundary register Mode */
|
||||
#define INPDIS (1 << 15) /* CUG and CDG Input Disable */
|
||||
|
||||
#define CNTMODE_QUADENC (0 << CNTMODE_SHIFT) /* quadrature encoder mode */
|
||||
#define CNTMODE_BINENC (1 << CNTMODE_SHIFT) /* binary encoder mode */
|
||||
#define CNTMODE_UDCNT (2 << CNTMODE_SHIFT) /* up/down counter mode */
|
||||
#define CNTMODE_DIRCNT (4 << CNTMODE_SHIFT) /* direction counter mode */
|
||||
#define CNTMODE_DIRTMR (5 << CNTMODE_SHIFT) /* direction timer mode */
|
||||
|
||||
#define BNDMODE_COMP (0 << BNDMODE_SHIFT) /* boundary compare mode */
|
||||
#define BNDMODE_ZERO (1 << BNDMODE_SHIFT) /* boundary compare and zero mode */
|
||||
#define BNDMODE_CAPT (2 << BNDMODE_SHIFT) /* boundary capture mode */
|
||||
#define BNDMODE_AEXT (3 << BNDMODE_SHIFT) /* boundary auto-extend mode */
|
||||
|
||||
/* CNT_IMASK bitmasks */
|
||||
#define ICIE (1 << 0) /* Illegal Gray/Binary Code Interrupt Enable */
|
||||
#define UCIE (1 << 1) /* Up count Interrupt Enable */
|
||||
#define DCIE (1 << 2) /* Down count Interrupt Enable */
|
||||
#define MINCIE (1 << 3) /* Min Count Interrupt Enable */
|
||||
#define MAXCIE (1 << 4) /* Max Count Interrupt Enable */
|
||||
#define COV31IE (1 << 5) /* Bit 31 Overflow Interrupt Enable */
|
||||
#define COV15IE (1 << 6) /* Bit 15 Overflow Interrupt Enable */
|
||||
#define CZEROIE (1 << 7) /* Count to Zero Interrupt Enable */
|
||||
#define CZMIE (1 << 8) /* CZM Pin Interrupt Enable */
|
||||
#define CZMEIE (1 << 9) /* CZM Error Interrupt Enable */
|
||||
#define CZMZIE (1 << 10) /* CZM Zeroes Counter Interrupt Enable */
|
||||
|
||||
/* CNT_STATUS bitmasks */
|
||||
#define ICII (1 << 0) /* Illegal Gray/Binary Code Interrupt Identifier */
|
||||
#define UCII (1 << 1) /* Up count Interrupt Identifier */
|
||||
#define DCII (1 << 2) /* Down count Interrupt Identifier */
|
||||
#define MINCII (1 << 3) /* Min Count Interrupt Identifier */
|
||||
#define MAXCII (1 << 4) /* Max Count Interrupt Identifier */
|
||||
#define COV31II (1 << 5) /* Bit 31 Overflow Interrupt Identifier */
|
||||
#define COV15II (1 << 6) /* Bit 15 Overflow Interrupt Identifier */
|
||||
#define CZEROII (1 << 7) /* Count to Zero Interrupt Identifier */
|
||||
#define CZMII (1 << 8) /* CZM Pin Interrupt Identifier */
|
||||
#define CZMEII (1 << 9) /* CZM Error Interrupt Identifier */
|
||||
#define CZMZII (1 << 10) /* CZM Zeroes Counter Interrupt Identifier */
|
||||
|
||||
/* CNT_COMMAND bitmasks */
|
||||
#define W1LCNT 0xf /* Load Counter Register */
|
||||
#define W1LMIN 0xf0 /* Load Min Register */
|
||||
#define W1LMAX 0xf00 /* Load Max Register */
|
||||
#define W1ZMONCE (1 << 12) /* Enable CZM Clear Counter Once */
|
||||
|
||||
#define W1LCNT_ZERO (1 << 0) /* write 1 to load CNT_COUNTER with zero */
|
||||
#define W1LCNT_MIN (1 << 2) /* write 1 to load CNT_COUNTER from CNT_MIN */
|
||||
#define W1LCNT_MAX (1 << 3) /* write 1 to load CNT_COUNTER from CNT_MAX */
|
||||
|
||||
#define W1LMIN_ZERO (1 << 4) /* write 1 to load CNT_MIN with zero */
|
||||
#define W1LMIN_CNT (1 << 5) /* write 1 to load CNT_MIN from CNT_COUNTER */
|
||||
#define W1LMIN_MAX (1 << 7) /* write 1 to load CNT_MIN from CNT_MAX */
|
||||
|
||||
#define W1LMAX_ZERO (1 << 8) /* write 1 to load CNT_MAX with zero */
|
||||
#define W1LMAX_CNT (1 << 9) /* write 1 to load CNT_MAX from CNT_COUNTER */
|
||||
#define W1LMAX_MIN (1 << 10) /* write 1 to load CNT_MAX from CNT_MIN */
|
||||
|
||||
/* CNT_DEBOUNCE bitmasks */
|
||||
#define DPRESCALE 0xf /* Load Counter Register */
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue