mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-11 18:26:02 +00:00
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov: "Assorted fixes and cleanups to the existing drivers plus a new driver for IMS Passenger Control Unit device they use for ther in-flight entertainment system." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (44 commits) Input: trackpoint - Optimize trackpoint init to use power-on reset Input: apbps2 - convert to devm_ioremap_resource() Input: ALPS - use %ph to print buffers ARM - shmobile: Armadillo800EVA: Move st1232 reset pin handling Input: st1232 - add reset pin handling Input: st1232 - convert to devm_* infrastructure Input: MT - handle semi-mt devices in core Input: adxl34x - use spi_get_drvdata() Input: ad7877 - use spi_get_drvdata() and spi_set_drvdata() Input: ads7846 - use spi_get_drvdata() and spi_set_drvdata() Input: ims-pcu - fix a memory leak on error Input: sysrq - supplement reset sequence with timeout functionality Input: tegra-kbc - support for defining row/columns based on SoC Input: imx_keypad - switch to using managed resources Input: arc_ps2 - add support for device tree Input: mma8450 - fix signed 12bits to 32bits conversion Input: eeti_ts - remove redundant null check Input: edt-ft5x06 - remove redundant null check before kfree Input: ad714x - add CONFIG_PM_SLEEP to suspend/resume functions Input: adxl34x - add CONFIG_PM_SLEEP to suspend/resume functions ...
This commit is contained in:
commit
251df49db3
@ -0,0 +1,16 @@
|
||||
Aeroflex Gaisler APBPS2 PS/2 Core, supporting Keyboard or Mouse.
|
||||
|
||||
The APBPS2 PS/2 core is available in the GRLIB VHDL IP core library.
|
||||
|
||||
Note: In the ordinary environment for the APBPS2 core, a LEON SPARC system,
|
||||
these properties are built from information in the AMBA plug&play and from
|
||||
bootloader settings.
|
||||
|
||||
Required properties:
|
||||
|
||||
- name : Should be "GAISLER_APBPS2" or "01_060"
|
||||
- reg : Address and length of the register set for the device
|
||||
- interrupts : Interrupt numbers for this device
|
||||
|
||||
For further information look in the documentation for the GLIB IP core library:
|
||||
http://www.gaisler.com/products/grlib/grip.pdf
|
@ -0,0 +1,30 @@
|
||||
* AUO in-cell touchscreen controller using Pixcir sensors
|
||||
|
||||
Required properties:
|
||||
- compatible: must be "auo,auo_pixcir_ts"
|
||||
- reg: I2C address of the chip
|
||||
- interrupts: interrupt to which the chip is connected
|
||||
- gpios: gpios the chip is connected to
|
||||
first one is the interrupt gpio and second one the reset gpio
|
||||
- x-size: horizontal resolution of touchscreen
|
||||
- y-size: vertical resolution of touchscreen
|
||||
|
||||
Example:
|
||||
|
||||
i2c@00000000 {
|
||||
/* ... */
|
||||
|
||||
auo_pixcir_ts@5c {
|
||||
compatible = "auo,auo_pixcir_ts";
|
||||
reg = <0x5c>;
|
||||
interrupts = <2 0>;
|
||||
|
||||
gpios = <&gpf 2 0 2>, /* INT */
|
||||
<&gpf 5 1 0>; /* RST */
|
||||
|
||||
x-size = <800>;
|
||||
y-size = <600>;
|
||||
};
|
||||
|
||||
/* ... */
|
||||
};
|
@ -0,0 +1,24 @@
|
||||
* Sitronix st1232 touchscreen controller
|
||||
|
||||
Required properties:
|
||||
- compatible: must be "sitronix,st1232"
|
||||
- reg: I2C address of the chip
|
||||
- interrupts: interrupt to which the chip is connected
|
||||
|
||||
Optional properties:
|
||||
- gpios: a phandle to the reset GPIO
|
||||
|
||||
Example:
|
||||
|
||||
i2c@00000000 {
|
||||
/* ... */
|
||||
|
||||
touchscreen@55 {
|
||||
compatible = "sitronix,st1232";
|
||||
reg = <0x55>;
|
||||
interrupts = <2 0>;
|
||||
gpios = <&gpio1 166 0>;
|
||||
};
|
||||
|
||||
/* ... */
|
||||
};
|
16
Documentation/devicetree/bindings/serio/snps-arc_ps2.txt
Normal file
16
Documentation/devicetree/bindings/serio/snps-arc_ps2.txt
Normal file
@ -0,0 +1,16 @@
|
||||
* ARC PS/2 driver: PS/2 block used in some ARC FPGA's & nSIM OSCI model
|
||||
|
||||
Required properties:
|
||||
- compatible : "snps,arc_ps2"
|
||||
- reg : offset and length (always 0x14) of registers
|
||||
- interrupts : interrupt
|
||||
- interrupt-names : name of interrupt, must be "arc_ps2_irq"
|
||||
|
||||
Example:
|
||||
|
||||
serio@c9000400 {
|
||||
compatible = "snps,arc_ps2";
|
||||
reg = <0xc9000400 0x14>;
|
||||
interrupts = <13>;
|
||||
interrupt-names = "arc_ps2_irq";
|
||||
}
|
@ -24,6 +24,7 @@
|
||||
#include <linux/err.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/platform_data/st1232_pdata.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/gpio.h>
|
||||
@ -882,10 +883,15 @@ static struct platform_device i2c_gpio_device = {
|
||||
};
|
||||
|
||||
/* I2C */
|
||||
static struct st1232_pdata st1232_i2c0_pdata = {
|
||||
.reset_gpio = 166,
|
||||
};
|
||||
|
||||
static struct i2c_board_info i2c0_devices[] = {
|
||||
{
|
||||
I2C_BOARD_INFO("st1232-ts", 0x55),
|
||||
.irq = evt2irq(0x0340),
|
||||
.platform_data = &st1232_i2c0_pdata,
|
||||
},
|
||||
{
|
||||
I2C_BOARD_INFO("wm8978", 0x1a),
|
||||
@ -1009,7 +1015,6 @@ static void __init eva_init(void)
|
||||
|
||||
/* Touchscreen */
|
||||
gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */
|
||||
gpio_request_one(GPIO_PORT166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */
|
||||
|
||||
/* GETHER */
|
||||
gpio_request(GPIO_FN_ET_CRS, NULL);
|
||||
|
@ -670,6 +670,80 @@ int devres_release_group(struct device *dev, void *id)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devres_release_group);
|
||||
|
||||
/*
|
||||
* Custom devres actions allow inserting a simple function call
|
||||
* into the teadown sequence.
|
||||
*/
|
||||
|
||||
struct action_devres {
|
||||
void *data;
|
||||
void (*action)(void *);
|
||||
};
|
||||
|
||||
static int devm_action_match(struct device *dev, void *res, void *p)
|
||||
{
|
||||
struct action_devres *devres = res;
|
||||
struct action_devres *target = p;
|
||||
|
||||
return devres->action == target->action &&
|
||||
devres->data == target->data;
|
||||
}
|
||||
|
||||
static void devm_action_release(struct device *dev, void *res)
|
||||
{
|
||||
struct action_devres *devres = res;
|
||||
|
||||
devres->action(devres->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* devm_add_action() - add a custom action to list of managed resources
|
||||
* @dev: Device that owns the action
|
||||
* @action: Function that should be called
|
||||
* @data: Pointer to data passed to @action implementation
|
||||
*
|
||||
* This adds a custom action to the list of managed resources so that
|
||||
* it gets executed as part of standard resource unwinding.
|
||||
*/
|
||||
int devm_add_action(struct device *dev, void (*action)(void *), void *data)
|
||||
{
|
||||
struct action_devres *devres;
|
||||
|
||||
devres = devres_alloc(devm_action_release,
|
||||
sizeof(struct action_devres), GFP_KERNEL);
|
||||
if (!devres)
|
||||
return -ENOMEM;
|
||||
|
||||
devres->data = data;
|
||||
devres->action = action;
|
||||
|
||||
devres_add(dev, devres);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_add_action);
|
||||
|
||||
/**
|
||||
* devm_remove_action() - removes previously added custom action
|
||||
* @dev: Device that owns the action
|
||||
* @action: Function implementing the action
|
||||
* @data: Pointer to data passed to @action implementation
|
||||
*
|
||||
* Removes instance of @action previously added by devm_add_action().
|
||||
* Both action and data should match one of the existing entries.
|
||||
*/
|
||||
void devm_remove_action(struct device *dev, void (*action)(void *), void *data)
|
||||
{
|
||||
struct action_devres devres = {
|
||||
.data = data,
|
||||
.action = action,
|
||||
};
|
||||
|
||||
WARN_ON(devres_destroy(dev, devm_action_release, devm_action_match,
|
||||
&devres));
|
||||
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_remove_action);
|
||||
|
||||
/*
|
||||
* Managed kzalloc/kfree
|
||||
*/
|
||||
|
@ -79,6 +79,8 @@ int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
|
||||
}
|
||||
if (flags & INPUT_MT_DIRECT)
|
||||
__set_bit(INPUT_PROP_DIRECT, dev->propbit);
|
||||
if (flags & INPUT_MT_SEMI_MT)
|
||||
__set_bit(INPUT_PROP_SEMI_MT, dev->propbit);
|
||||
if (flags & INPUT_MT_TRACK) {
|
||||
unsigned int n2 = num_slots * num_slots;
|
||||
mt->red = kcalloc(n2, sizeof(*mt->red), GFP_KERNEL);
|
||||
@ -246,6 +248,7 @@ void input_mt_sync_frame(struct input_dev *dev)
|
||||
{
|
||||
struct input_mt *mt = dev->mt;
|
||||
struct input_mt_slot *s;
|
||||
bool use_count = false;
|
||||
|
||||
if (!mt)
|
||||
return;
|
||||
@ -259,7 +262,10 @@ void input_mt_sync_frame(struct input_dev *dev)
|
||||
}
|
||||
}
|
||||
|
||||
input_mt_report_pointer_emulation(dev, (mt->flags & INPUT_MT_POINTER));
|
||||
if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT))
|
||||
use_count = true;
|
||||
|
||||
input_mt_report_pointer_emulation(dev, use_count);
|
||||
|
||||
mt->frame++;
|
||||
}
|
||||
|
@ -260,18 +260,6 @@ static struct platform_driver amikbd_driver = {
|
||||
},
|
||||
};
|
||||
|
||||
static int __init amikbd_init(void)
|
||||
{
|
||||
return platform_driver_probe(&amikbd_driver, amikbd_probe);
|
||||
}
|
||||
|
||||
module_init(amikbd_init);
|
||||
|
||||
static void __exit amikbd_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&amikbd_driver);
|
||||
}
|
||||
|
||||
module_exit(amikbd_exit);
|
||||
module_platform_driver_probe(amikbd_driver, amikbd_probe);
|
||||
|
||||
MODULE_ALIAS("platform:amiga-keyboard");
|
||||
|
@ -329,17 +329,7 @@ static struct platform_driver davinci_ks_driver = {
|
||||
.remove = davinci_ks_remove,
|
||||
};
|
||||
|
||||
static int __init davinci_ks_init(void)
|
||||
{
|
||||
return platform_driver_probe(&davinci_ks_driver, davinci_ks_probe);
|
||||
}
|
||||
module_init(davinci_ks_init);
|
||||
|
||||
static void __exit davinci_ks_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&davinci_ks_driver);
|
||||
}
|
||||
module_exit(davinci_ks_exit);
|
||||
module_platform_driver_probe(davinci_ks_driver, davinci_ks_probe);
|
||||
|
||||
MODULE_AUTHOR("Miguel Aguilar");
|
||||
MODULE_DESCRIPTION("Texas Instruments DaVinci Key Scan Driver");
|
||||
|
@ -448,24 +448,17 @@ static int imx_keypad_probe(struct platform_device *pdev)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
res = request_mem_region(res->start, resource_size(res), pdev->name);
|
||||
if (res == NULL) {
|
||||
dev_err(&pdev->dev, "failed to request I/O memory\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
input_dev = input_allocate_device();
|
||||
input_dev = devm_input_allocate_device(&pdev->dev);
|
||||
if (!input_dev) {
|
||||
dev_err(&pdev->dev, "failed to allocate the input device\n");
|
||||
error = -ENOMEM;
|
||||
goto failed_rel_mem;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
keypad = kzalloc(sizeof(struct imx_keypad), GFP_KERNEL);
|
||||
keypad = devm_kzalloc(&pdev->dev, sizeof(struct imx_keypad),
|
||||
GFP_KERNEL);
|
||||
if (!keypad) {
|
||||
dev_err(&pdev->dev, "not enough memory for driver data\n");
|
||||
error = -ENOMEM;
|
||||
goto failed_free_input;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
keypad->input_dev = input_dev;
|
||||
@ -475,18 +468,14 @@ static int imx_keypad_probe(struct platform_device *pdev)
|
||||
setup_timer(&keypad->check_matrix_timer,
|
||||
imx_keypad_check_for_events, (unsigned long) keypad);
|
||||
|
||||
keypad->mmio_base = ioremap(res->start, resource_size(res));
|
||||
if (keypad->mmio_base == NULL) {
|
||||
dev_err(&pdev->dev, "failed to remap I/O memory\n");
|
||||
error = -ENOMEM;
|
||||
goto failed_free_priv;
|
||||
}
|
||||
keypad->mmio_base = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(keypad->mmio_base))
|
||||
return PTR_ERR(keypad->mmio_base);
|
||||
|
||||
keypad->clk = clk_get(&pdev->dev, NULL);
|
||||
keypad->clk = devm_clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(keypad->clk)) {
|
||||
dev_err(&pdev->dev, "failed to get keypad clock\n");
|
||||
error = PTR_ERR(keypad->clk);
|
||||
goto failed_unmap;
|
||||
return PTR_ERR(keypad->clk);
|
||||
}
|
||||
|
||||
/* Init the Input device */
|
||||
@ -502,7 +491,7 @@ static int imx_keypad_probe(struct platform_device *pdev)
|
||||
keypad->keycodes, input_dev);
|
||||
if (error) {
|
||||
dev_err(&pdev->dev, "failed to build keymap\n");
|
||||
goto failed_clock_put;
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Search for rows and cols enabled */
|
||||
@ -527,60 +516,23 @@ static int imx_keypad_probe(struct platform_device *pdev)
|
||||
imx_keypad_inhibit(keypad);
|
||||
clk_disable_unprepare(keypad->clk);
|
||||
|
||||
error = request_irq(irq, imx_keypad_irq_handler, 0,
|
||||
error = devm_request_irq(&pdev->dev, irq, imx_keypad_irq_handler, 0,
|
||||
pdev->name, keypad);
|
||||
if (error) {
|
||||
dev_err(&pdev->dev, "failed to request IRQ\n");
|
||||
goto failed_clock_put;
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Register the input device */
|
||||
error = input_register_device(input_dev);
|
||||
if (error) {
|
||||
dev_err(&pdev->dev, "failed to register input device\n");
|
||||
goto failed_free_irq;
|
||||
return error;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, keypad);
|
||||
device_init_wakeup(&pdev->dev, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
failed_free_irq:
|
||||
free_irq(irq, pdev);
|
||||
failed_clock_put:
|
||||
clk_put(keypad->clk);
|
||||
failed_unmap:
|
||||
iounmap(keypad->mmio_base);
|
||||
failed_free_priv:
|
||||
kfree(keypad);
|
||||
failed_free_input:
|
||||
input_free_device(input_dev);
|
||||
failed_rel_mem:
|
||||
release_mem_region(res->start, resource_size(res));
|
||||
return error;
|
||||
}
|
||||
|
||||
static int imx_keypad_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct imx_keypad *keypad = platform_get_drvdata(pdev);
|
||||
struct resource *res;
|
||||
|
||||
dev_dbg(&pdev->dev, ">%s\n", __func__);
|
||||
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
|
||||
input_unregister_device(keypad->input_dev);
|
||||
|
||||
free_irq(keypad->irq, keypad);
|
||||
clk_put(keypad->clk);
|
||||
|
||||
iounmap(keypad->mmio_base);
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
release_mem_region(res->start, resource_size(res));
|
||||
|
||||
kfree(keypad);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -640,7 +592,6 @@ static struct platform_driver imx_keypad_driver = {
|
||||
.of_match_table = of_match_ptr(imx_keypad_of_match),
|
||||
},
|
||||
.probe = imx_keypad_probe,
|
||||
.remove = imx_keypad_remove,
|
||||
};
|
||||
module_platform_driver(imx_keypad_driver);
|
||||
|
||||
|
@ -430,17 +430,7 @@ static struct platform_driver ske_keypad_driver = {
|
||||
.remove = ske_keypad_remove,
|
||||
};
|
||||
|
||||
static int __init ske_keypad_init(void)
|
||||
{
|
||||
return platform_driver_probe(&ske_keypad_driver, ske_keypad_probe);
|
||||
}
|
||||
module_init(ske_keypad_init);
|
||||
|
||||
static void __exit ske_keypad_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&ske_keypad_driver);
|
||||
}
|
||||
module_exit(ske_keypad_exit);
|
||||
module_platform_driver_probe(ske_keypad_driver, ske_keypad_probe);
|
||||
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_AUTHOR("Naveen Kumar <naveen.gaddipati@stericsson.com> / Sundar Iyer <sundar.iyer@stericsson.com>");
|
||||
|
@ -27,17 +27,19 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/input/matrix_keypad.h>
|
||||
#include <linux/clk/tegra.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
#define KBC_MAX_GPIO 24
|
||||
#define KBC_MAX_KPENT 8
|
||||
|
||||
#define KBC_MAX_ROW 16
|
||||
#define KBC_MAX_COL 8
|
||||
#define KBC_MAX_KEY (KBC_MAX_ROW * KBC_MAX_COL)
|
||||
/* Maximum row/column supported by Tegra KBC yet is 16x8 */
|
||||
#define KBC_MAX_GPIO 24
|
||||
/* Maximum keys supported by Tegra KBC yet is 16 x 8*/
|
||||
#define KBC_MAX_KEY (16 * 8)
|
||||
|
||||
#define KBC_MAX_DEBOUNCE_CNT 0x3ffu
|
||||
|
||||
@ -80,6 +82,12 @@ enum tegra_pin_type {
|
||||
PIN_CFG_ROW,
|
||||
};
|
||||
|
||||
/* Tegra KBC hw support */
|
||||
struct tegra_kbc_hw_support {
|
||||
int max_rows;
|
||||
int max_columns;
|
||||
};
|
||||
|
||||
struct tegra_kbc_pin_cfg {
|
||||
enum tegra_pin_type type;
|
||||
unsigned char num;
|
||||
@ -108,6 +116,9 @@ struct tegra_kbc {
|
||||
u32 wakeup_key;
|
||||
struct timer_list timer;
|
||||
struct clk *clk;
|
||||
const struct tegra_kbc_hw_support *hw_support;
|
||||
int max_keys;
|
||||
int num_rows_and_columns;
|
||||
};
|
||||
|
||||
static void tegra_kbc_report_released_keys(struct input_dev *input,
|
||||
@ -204,11 +215,11 @@ static void tegra_kbc_report_keys(struct tegra_kbc *kbc)
|
||||
|
||||
/*
|
||||
* If the platform uses Fn keymaps, translate keys on a Fn keypress.
|
||||
* Function keycodes are KBC_MAX_KEY apart from the plain keycodes.
|
||||
* Function keycodes are max_keys apart from the plain keycodes.
|
||||
*/
|
||||
if (fn_keypress) {
|
||||
for (i = 0; i < num_down; i++) {
|
||||
scancodes[i] += KBC_MAX_KEY;
|
||||
scancodes[i] += kbc->max_keys;
|
||||
keycodes[i] = kbc->keycode[scancodes[i]];
|
||||
}
|
||||
}
|
||||
@ -315,7 +326,7 @@ static void tegra_kbc_setup_wakekeys(struct tegra_kbc *kbc, bool filter)
|
||||
/* Either mask all keys or none. */
|
||||
rst_val = (filter && !kbc->wakeup) ? ~0 : 0;
|
||||
|
||||
for (i = 0; i < KBC_MAX_ROW; i++)
|
||||
for (i = 0; i < kbc->hw_support->max_rows; i++)
|
||||
writel(rst_val, kbc->mmio + KBC_ROW0_MASK_0 + i * 4);
|
||||
}
|
||||
|
||||
@ -452,7 +463,7 @@ static bool tegra_kbc_check_pin_cfg(const struct tegra_kbc *kbc,
|
||||
|
||||
switch (pin_cfg->type) {
|
||||
case PIN_CFG_ROW:
|
||||
if (pin_cfg->num >= KBC_MAX_ROW) {
|
||||
if (pin_cfg->num >= kbc->hw_support->max_rows) {
|
||||
dev_err(kbc->dev,
|
||||
"pin_cfg[%d]: invalid row number %d\n",
|
||||
i, pin_cfg->num);
|
||||
@ -462,7 +473,7 @@ static bool tegra_kbc_check_pin_cfg(const struct tegra_kbc *kbc,
|
||||
break;
|
||||
|
||||
case PIN_CFG_COL:
|
||||
if (pin_cfg->num >= KBC_MAX_COL) {
|
||||
if (pin_cfg->num >= kbc->hw_support->max_columns) {
|
||||
dev_err(kbc->dev,
|
||||
"pin_cfg[%d]: invalid column number %d\n",
|
||||
i, pin_cfg->num);
|
||||
@ -520,6 +531,18 @@ static int tegra_kbc_parse_dt(struct tegra_kbc *kbc)
|
||||
}
|
||||
num_cols = proplen / sizeof(u32);
|
||||
|
||||
if (num_rows > kbc->hw_support->max_rows) {
|
||||
dev_err(kbc->dev,
|
||||
"Number of rows is more than supported by hardware\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (num_cols > kbc->hw_support->max_columns) {
|
||||
dev_err(kbc->dev,
|
||||
"Number of cols is more than supported by hardware\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!of_get_property(np, "linux,keymap", &proplen)) {
|
||||
dev_err(kbc->dev, "property linux,keymap not found\n");
|
||||
return -ENOENT;
|
||||
@ -532,7 +555,7 @@ static int tegra_kbc_parse_dt(struct tegra_kbc *kbc)
|
||||
}
|
||||
|
||||
/* Set all pins as non-configured */
|
||||
for (i = 0; i < KBC_MAX_GPIO; i++)
|
||||
for (i = 0; i < kbc->num_rows_and_columns; i++)
|
||||
kbc->pin_cfg[i].type = PIN_CFG_IGNORE;
|
||||
|
||||
ret = of_property_read_u32_array(np, "nvidia,kbc-row-pins",
|
||||
@ -562,6 +585,24 @@ static int tegra_kbc_parse_dt(struct tegra_kbc *kbc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct tegra_kbc_hw_support tegra20_kbc_hw_support = {
|
||||
.max_rows = 16,
|
||||
.max_columns = 8,
|
||||
};
|
||||
|
||||
static const struct tegra_kbc_hw_support tegra11_kbc_hw_support = {
|
||||
.max_rows = 11,
|
||||
.max_columns = 8,
|
||||
};
|
||||
|
||||
static const struct of_device_id tegra_kbc_of_match[] = {
|
||||
{ .compatible = "nvidia,tegra114-kbc", .data = &tegra11_kbc_hw_support},
|
||||
{ .compatible = "nvidia,tegra30-kbc", .data = &tegra20_kbc_hw_support},
|
||||
{ .compatible = "nvidia,tegra20-kbc", .data = &tegra20_kbc_hw_support},
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, tegra_kbc_of_match);
|
||||
|
||||
static int tegra_kbc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct tegra_kbc *kbc;
|
||||
@ -570,7 +611,10 @@ static int tegra_kbc_probe(struct platform_device *pdev)
|
||||
int num_rows = 0;
|
||||
unsigned int debounce_cnt;
|
||||
unsigned int scan_time_rows;
|
||||
unsigned int keymap_rows = KBC_MAX_KEY;
|
||||
unsigned int keymap_rows;
|
||||
const struct of_device_id *match;
|
||||
|
||||
match = of_match_device(of_match_ptr(tegra_kbc_of_match), &pdev->dev);
|
||||
|
||||
kbc = devm_kzalloc(&pdev->dev, sizeof(*kbc), GFP_KERNEL);
|
||||
if (!kbc) {
|
||||
@ -579,6 +623,12 @@ static int tegra_kbc_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
kbc->dev = &pdev->dev;
|
||||
kbc->hw_support = match->data;
|
||||
kbc->max_keys = kbc->hw_support->max_rows *
|
||||
kbc->hw_support->max_columns;
|
||||
kbc->num_rows_and_columns = kbc->hw_support->max_rows +
|
||||
kbc->hw_support->max_columns;
|
||||
keymap_rows = kbc->max_keys;
|
||||
spin_lock_init(&kbc->lock);
|
||||
|
||||
err = tegra_kbc_parse_dt(kbc);
|
||||
@ -608,11 +658,9 @@ static int tegra_kbc_probe(struct platform_device *pdev)
|
||||
|
||||
setup_timer(&kbc->timer, tegra_kbc_keypress_timer, (unsigned long)kbc);
|
||||
|
||||
kbc->mmio = devm_request_and_ioremap(&pdev->dev, res);
|
||||
if (!kbc->mmio) {
|
||||
dev_err(&pdev->dev, "Cannot request memregion/iomap address\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
kbc->mmio = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(kbc->mmio))
|
||||
return PTR_ERR(kbc->mmio);
|
||||
|
||||
kbc->clk = devm_clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(kbc->clk)) {
|
||||
@ -641,7 +689,8 @@ static int tegra_kbc_probe(struct platform_device *pdev)
|
||||
keymap_rows *= 2;
|
||||
|
||||
err = matrix_keypad_build_keymap(kbc->keymap_data, NULL,
|
||||
keymap_rows, KBC_MAX_COL,
|
||||
keymap_rows,
|
||||
kbc->hw_support->max_columns,
|
||||
kbc->keycode, kbc->idev);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "failed to setup keymap\n");
|
||||
@ -767,12 +816,6 @@ static int tegra_kbc_resume(struct device *dev)
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(tegra_kbc_pm_ops, tegra_kbc_suspend, tegra_kbc_resume);
|
||||
|
||||
static const struct of_device_id tegra_kbc_of_match[] = {
|
||||
{ .compatible = "nvidia,tegra20-kbc", },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, tegra_kbc_of_match);
|
||||
|
||||
static struct platform_driver tegra_kbc_driver = {
|
||||
.probe = tegra_kbc_probe,
|
||||
.driver = {
|
||||
|
@ -590,6 +590,16 @@ config INPUT_ADXL34X_SPI
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called adxl34x-spi.
|
||||
|
||||
config INPUT_IMS_PCU
|
||||
tristate "IMS Passenger Control Unit driver"
|
||||
depends on USB
|
||||
depends on LEDS_CLASS
|
||||
help
|
||||
Say Y here if you have system with IMS Rave Passenger Control Unit.
|
||||
|
||||
To compile this driver as a module, choose M here: the module will be
|
||||
called ims_pcu.
|
||||
|
||||
config INPUT_CMA3000
|
||||
tristate "VTI CMA3000 Tri-axis accelerometer"
|
||||
help
|
||||
|
@ -29,6 +29,7 @@ obj-$(CONFIG_INPUT_DM355EVM) += dm355evm_keys.o
|
||||
obj-$(CONFIG_INPUT_GP2A) += gp2ap002a00f.o
|
||||
obj-$(CONFIG_INPUT_GPIO_TILT_POLLED) += gpio_tilt_polled.o
|
||||
obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
|
||||
obj-$(CONFIG_INPUT_IMS_PCU) += ims-pcu.o
|
||||
obj-$(CONFIG_INPUT_IXP4XX_BEEPER) += ixp4xx-beeper.o
|
||||
obj-$(CONFIG_INPUT_KEYSPAN_REMOTE) += keyspan_remote.o
|
||||
obj-$(CONFIG_INPUT_KXTJ9) += kxtj9.o
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <linux/pm.h>
|
||||
#include "ad714x.h"
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int ad714x_i2c_suspend(struct device *dev)
|
||||
{
|
||||
return ad714x_disable(i2c_get_clientdata(to_i2c_client(dev)));
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define AD714x_SPI_CMD_PREFIX 0xE000 /* bits 15:11 */
|
||||
#define AD714x_SPI_READ BIT(10)
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int ad714x_spi_suspend(struct device *dev)
|
||||
{
|
||||
return ad714x_disable(spi_get_drvdata(to_spi_device(dev)));
|
||||
|
@ -105,7 +105,7 @@ static int adxl34x_i2c_remove(struct i2c_client *client)
|
||||
return adxl34x_remove(ac);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int adxl34x_i2c_suspend(struct device *dev)
|
||||
{
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
|
@ -89,16 +89,16 @@ static int adxl34x_spi_probe(struct spi_device *spi)
|
||||
|
||||
static int adxl34x_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
struct adxl34x *ac = dev_get_drvdata(&spi->dev);
|
||||
struct adxl34x *ac = spi_get_drvdata(spi);
|
||||
|
||||
return adxl34x_remove(ac);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int adxl34x_spi_suspend(struct device *dev)
|
||||
{
|
||||
struct spi_device *spi = to_spi_device(dev);
|
||||
struct adxl34x *ac = dev_get_drvdata(&spi->dev);
|
||||
struct adxl34x *ac = spi_get_drvdata(spi);
|
||||
|
||||
adxl34x_suspend(ac);
|
||||
|
||||
@ -108,7 +108,7 @@ static int adxl34x_spi_suspend(struct device *dev)
|
||||
static int adxl34x_spi_resume(struct device *dev)
|
||||
{
|
||||
struct spi_device *spi = to_spi_device(dev);
|
||||
struct adxl34x *ac = dev_get_drvdata(&spi->dev);
|
||||
struct adxl34x *ac = spi_get_drvdata(spi);
|
||||
|
||||
adxl34x_resume(ac);
|
||||
|
||||
|
1901
drivers/input/misc/ims-pcu.c
Normal file
1901
drivers/input/misc/ims-pcu.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -123,9 +123,9 @@ static void mma8450_poll(struct input_polled_dev *dev)
|
||||
if (ret < 0)
|
||||
return;
|
||||
|
||||
x = ((buf[1] << 4) & 0xff0) | (buf[0] & 0xf);
|
||||
y = ((buf[3] << 4) & 0xff0) | (buf[2] & 0xf);
|
||||
z = ((buf[5] << 4) & 0xff0) | (buf[4] & 0xf);
|
||||
x = ((int)(s8)buf[1] << 4) | (buf[0] & 0xf);
|
||||
y = ((int)(s8)buf[3] << 4) | (buf[2] & 0xf);
|
||||
z = ((int)(s8)buf[5] << 4) | (buf[4] & 0xf);
|
||||
|
||||
input_report_abs(dev->input, ABS_X, x);
|
||||
input_report_abs(dev->input, ABS_Y, y);
|
||||
|
@ -114,18 +114,8 @@ static struct platform_driver twl4030_pwrbutton_driver = {
|
||||
},
|
||||
};
|
||||
|
||||
static int __init twl4030_pwrbutton_init(void)
|
||||
{
|
||||
return platform_driver_probe(&twl4030_pwrbutton_driver,
|
||||
module_platform_driver_probe(twl4030_pwrbutton_driver,
|
||||
twl4030_pwrbutton_probe);
|
||||
}
|
||||
module_init(twl4030_pwrbutton_init);
|
||||
|
||||
static void __exit twl4030_pwrbutton_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&twl4030_pwrbutton_driver);
|
||||
}
|
||||
module_exit(twl4030_pwrbutton_exit);
|
||||
|
||||
MODULE_ALIAS("platform:twl4030_pwrbutton");
|
||||
MODULE_DESCRIPTION("Triton2 Power Button");
|
||||
|
@ -1013,8 +1013,8 @@ static int alps_rpt_cmd(struct psmouse *psmouse, int init_command,
|
||||
if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO))
|
||||
return -EIO;
|
||||
|
||||
psmouse_dbg(psmouse, "%2.2X report: %2.2x %2.2x %2.2x\n",
|
||||
repeated_command, param[0], param[1], param[2]);
|
||||
psmouse_dbg(psmouse, "%2.2X report: %3ph\n",
|
||||
repeated_command, param);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1274,9 +1274,7 @@ static int alps_setup_trackstick_v3(struct psmouse *psmouse, int reg_base)
|
||||
psmouse_warn(psmouse, "trackstick E7 report failed\n");
|
||||
ret = -ENODEV;
|
||||
} else {
|
||||
psmouse_dbg(psmouse,
|
||||
"trackstick E7 report: %2.2x %2.2x %2.2x\n",
|
||||
param[0], param[1], param[2]);
|
||||
psmouse_dbg(psmouse, "trackstick E7 report: %3ph\n", param);
|
||||
|
||||
/*
|
||||
* Not sure what this does, but it is absolutely
|
||||
@ -1323,6 +1321,7 @@ static int alps_hw_init_v3(struct psmouse *psmouse)
|
||||
reg_val = alps_probe_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE);
|
||||
if (reg_val == -EIO)
|
||||
goto error;
|
||||
|
||||
if (reg_val == 0 &&
|
||||
alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO)
|
||||
goto error;
|
||||
@ -1676,8 +1675,7 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
|
||||
}
|
||||
|
||||
psmouse_info(psmouse,
|
||||
"Unknown ALPS touchpad: E7=%2.2x %2.2x %2.2x, EC=%2.2x %2.2x %2.2x\n",
|
||||
e7[0], e7[1], e7[2], ec[0], ec[1], ec[2]);
|
||||
"Unknown ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -146,18 +146,6 @@ static struct platform_driver amimouse_driver = {
|
||||
},
|
||||
};
|
||||
|
||||
static int __init amimouse_init(void)
|
||||
{
|
||||
return platform_driver_probe(&amimouse_driver, amimouse_probe);
|
||||
}
|
||||
|
||||
module_init(amimouse_init);
|
||||
|
||||
static void __exit amimouse_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&amimouse_driver);
|
||||
}
|
||||
|
||||
module_exit(amimouse_exit);
|
||||
module_platform_driver_probe(amimouse_driver, amimouse_probe);
|
||||
|
||||
MODULE_ALIAS("platform:amiga-mouse");
|
||||
|
@ -19,10 +19,35 @@
|
||||
#include "psmouse.h"
|
||||
#include "trackpoint.h"
|
||||
|
||||
/*
|
||||
* Power-on Reset: Resets all trackpoint parameters, including RAM values,
|
||||
* to defaults.
|
||||
* Returns zero on success, non-zero on failure.
|
||||
*/
|
||||
static int trackpoint_power_on_reset(struct ps2dev *ps2dev)
|
||||
{
|
||||
unsigned char results[2];
|
||||
int tries = 0;
|
||||
|
||||
/* Issue POR command, and repeat up to once if 0xFC00 received */
|
||||
do {
|
||||
if (ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND)) ||
|
||||
ps2_command(ps2dev, results, MAKE_PS2_CMD(0, 2, TP_POR)))
|
||||
return -1;
|
||||
} while (results[0] == 0xFC && results[1] == 0x00 && ++tries < 2);
|
||||
|
||||
/* Check for success response -- 0xAA00 */
|
||||
if (results[0] != 0xAA || results[1] != 0x00)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Device IO: read, write and toggle bit
|
||||
*/
|
||||
static int trackpoint_read(struct ps2dev *ps2dev, unsigned char loc, unsigned char *results)
|
||||
static int trackpoint_read(struct ps2dev *ps2dev,
|
||||
unsigned char loc, unsigned char *results)
|
||||
{
|
||||
if (ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND)) ||
|
||||
ps2_command(ps2dev, results, MAKE_PS2_CMD(0, 1, loc))) {
|
||||
@ -32,7 +57,8 @@ static int trackpoint_read(struct ps2dev *ps2dev, unsigned char loc, unsigned ch
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int trackpoint_write(struct ps2dev *ps2dev, unsigned char loc, unsigned char val)
|
||||
static int trackpoint_write(struct ps2dev *ps2dev,
|
||||
unsigned char loc, unsigned char val)
|
||||
{
|
||||
if (ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND)) ||
|
||||
ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_WRITE_MEM)) ||
|
||||
@ -44,7 +70,8 @@ static int trackpoint_write(struct ps2dev *ps2dev, unsigned char loc, unsigned c
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int trackpoint_toggle_bit(struct ps2dev *ps2dev, unsigned char loc, unsigned char mask)
|
||||
static int trackpoint_toggle_bit(struct ps2dev *ps2dev,
|
||||
unsigned char loc, unsigned char mask)
|
||||
{
|
||||
/* Bad things will happen if the loc param isn't in this range */
|
||||
if (loc < 0x20 || loc >= 0x2F)
|
||||
@ -60,6 +87,18 @@ static int trackpoint_toggle_bit(struct ps2dev *ps2dev, unsigned char loc, unsig
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int trackpoint_update_bit(struct ps2dev *ps2dev, unsigned char loc,
|
||||
unsigned char mask, unsigned char value)
|
||||
{
|
||||
int retval = 0;
|
||||
unsigned char data;
|
||||
|
||||
trackpoint_read(ps2dev, loc, &data);
|
||||
if (((data & mask) == mask) != !!value)
|
||||
retval = trackpoint_toggle_bit(ps2dev, loc, mask);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Trackpoint-specific attributes
|
||||
@ -69,6 +108,7 @@ struct trackpoint_attr_data {
|
||||
unsigned char command;
|
||||
unsigned char mask;
|
||||
unsigned char inverted;
|
||||
unsigned char power_on_default;
|
||||
};
|
||||
|
||||
static ssize_t trackpoint_show_int_attr(struct psmouse *psmouse, void *data, char *buf)
|
||||
@ -102,10 +142,11 @@ static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data,
|
||||
return count;
|
||||
}
|
||||
|
||||
#define TRACKPOINT_INT_ATTR(_name, _command) \
|
||||
#define TRACKPOINT_INT_ATTR(_name, _command, _default) \
|
||||
static struct trackpoint_attr_data trackpoint_attr_##_name = { \
|
||||
.field_offset = offsetof(struct trackpoint_data, _name), \
|
||||
.command = _command, \
|
||||
.power_on_default = _default, \
|
||||
}; \
|
||||
PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \
|
||||
&trackpoint_attr_##_name, \
|
||||
@ -139,31 +180,60 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data,
|
||||
}
|
||||
|
||||
|
||||
#define TRACKPOINT_BIT_ATTR(_name, _command, _mask, _inv) \
|
||||
static struct trackpoint_attr_data trackpoint_attr_##_name = { \
|
||||
.field_offset = offsetof(struct trackpoint_data, _name), \
|
||||
.command = _command, \
|
||||
.mask = _mask, \
|
||||
.inverted = _inv, \
|
||||
}; \
|
||||
PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \
|
||||
&trackpoint_attr_##_name, \
|
||||
trackpoint_show_int_attr, trackpoint_set_bit_attr)
|
||||
#define TRACKPOINT_BIT_ATTR(_name, _command, _mask, _inv, _default) \
|
||||
static struct trackpoint_attr_data trackpoint_attr_##_name = { \
|
||||
.field_offset = offsetof(struct trackpoint_data, \
|
||||
_name), \
|
||||
.command = _command, \
|
||||
.mask = _mask, \
|
||||
.inverted = _inv, \
|
||||
.power_on_default = _default, \
|
||||
}; \
|
||||
PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \
|
||||
&trackpoint_attr_##_name, \
|
||||
trackpoint_show_int_attr, trackpoint_set_bit_attr)
|
||||
|
||||
TRACKPOINT_INT_ATTR(sensitivity, TP_SENS);
|
||||
TRACKPOINT_INT_ATTR(speed, TP_SPEED);
|
||||
TRACKPOINT_INT_ATTR(inertia, TP_INERTIA);
|
||||
TRACKPOINT_INT_ATTR(reach, TP_REACH);
|
||||
TRACKPOINT_INT_ATTR(draghys, TP_DRAGHYS);
|
||||
TRACKPOINT_INT_ATTR(mindrag, TP_MINDRAG);
|
||||
TRACKPOINT_INT_ATTR(thresh, TP_THRESH);
|
||||
TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH);
|
||||
TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME);
|
||||
TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV);
|
||||
#define TRACKPOINT_UPDATE_BIT(_psmouse, _tp, _name) \
|
||||
do { \
|
||||
struct trackpoint_attr_data *_attr = &trackpoint_attr_##_name; \
|
||||
\
|
||||
trackpoint_update_bit(&_psmouse->ps2dev, \
|
||||
_attr->command, _attr->mask, _tp->_name); \
|
||||
} while (0)
|
||||
|
||||
TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0);
|
||||
TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK, 0);
|
||||
TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV, 1);
|
||||
#define TRACKPOINT_UPDATE(_power_on, _psmouse, _tp, _name) \
|
||||
do { \
|
||||
if (!_power_on || \
|
||||
_tp->_name != trackpoint_attr_##_name.power_on_default) { \
|
||||
if (!trackpoint_attr_##_name.mask) \
|
||||
trackpoint_write(&_psmouse->ps2dev, \
|
||||
trackpoint_attr_##_name.command, \
|
||||
_tp->_name); \
|
||||
else \
|
||||
TRACKPOINT_UPDATE_BIT(_psmouse, _tp, _name); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define TRACKPOINT_SET_POWER_ON_DEFAULT(_tp, _name) \
|
||||
(_tp->_name = trackpoint_attr_##_name.power_on_default)
|
||||
|
||||
TRACKPOINT_INT_ATTR(sensitivity, TP_SENS, TP_DEF_SENS);
|
||||
TRACKPOINT_INT_ATTR(speed, TP_SPEED, TP_DEF_SPEED);
|
||||
TRACKPOINT_INT_ATTR(inertia, TP_INERTIA, TP_DEF_INERTIA);
|
||||
TRACKPOINT_INT_ATTR(reach, TP_REACH, TP_DEF_REACH);
|
||||
TRACKPOINT_INT_ATTR(draghys, TP_DRAGHYS, TP_DEF_DRAGHYS);
|
||||
TRACKPOINT_INT_ATTR(mindrag, TP_MINDRAG, TP_DEF_MINDRAG);
|
||||
TRACKPOINT_INT_ATTR(thresh, TP_THRESH, TP_DEF_THRESH);
|
||||
TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH, TP_DEF_UP_THRESH);
|
||||
TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME, TP_DEF_Z_TIME);
|
||||
TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV, TP_DEF_JENKS_CURV);
|
||||
|
||||
TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0,
|
||||
TP_DEF_PTSON);
|
||||
TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK, 0,
|
||||
TP_DEF_SKIPBACK);
|
||||
TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV, 1,
|
||||
TP_DEF_EXT_DEV);
|
||||
|
||||
static struct attribute *trackpoint_attrs[] = {
|
||||
&psmouse_attr_sensitivity.dattr.attr,
|
||||
@ -202,73 +272,72 @@ static int trackpoint_start_protocol(struct psmouse *psmouse, unsigned char *fir
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int trackpoint_sync(struct psmouse *psmouse)
|
||||
/*
|
||||
* Write parameters to trackpad.
|
||||
* in_power_on_state: Set to true if TP is in default / power-on state (ex. if
|
||||
* power-on reset was run). If so, values will only be
|
||||
* written to TP if they differ from power-on default.
|
||||
*/
|
||||
static int trackpoint_sync(struct psmouse *psmouse, bool in_power_on_state)
|
||||
{
|
||||
struct trackpoint_data *tp = psmouse->private;
|
||||
unsigned char toggle;
|
||||
|
||||
/* Disable features that may make device unusable with this driver */
|
||||
trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, &toggle);
|
||||
if (toggle & TP_MASK_TWOHAND)
|
||||
trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, TP_MASK_TWOHAND);
|
||||
if (!in_power_on_state) {
|
||||
/*
|
||||
* Disable features that may make device unusable
|
||||
* with this driver.
|
||||
*/
|
||||
trackpoint_update_bit(&psmouse->ps2dev, TP_TOGGLE_TWOHAND,
|
||||
TP_MASK_TWOHAND, TP_DEF_TWOHAND);
|
||||
|
||||
trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_SOURCE_TAG, &toggle);
|
||||
if (toggle & TP_MASK_SOURCE_TAG)
|
||||
trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_SOURCE_TAG, TP_MASK_SOURCE_TAG);
|
||||
trackpoint_update_bit(&psmouse->ps2dev, TP_TOGGLE_SOURCE_TAG,
|
||||
TP_MASK_SOURCE_TAG, TP_DEF_SOURCE_TAG);
|
||||
|
||||
trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_MB, &toggle);
|
||||
if (toggle & TP_MASK_MB)
|
||||
trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_MB, TP_MASK_MB);
|
||||
trackpoint_update_bit(&psmouse->ps2dev, TP_TOGGLE_MB,
|
||||
TP_MASK_MB, TP_DEF_MB);
|
||||
}
|
||||
|
||||
/* Push the config to the device */
|
||||
trackpoint_write(&psmouse->ps2dev, TP_SENS, tp->sensitivity);
|
||||
trackpoint_write(&psmouse->ps2dev, TP_INERTIA, tp->inertia);
|
||||
trackpoint_write(&psmouse->ps2dev, TP_SPEED, tp->speed);
|
||||
/*
|
||||
* These properties can be changed in this driver. Only
|
||||
* configure them if the values are non-default or if the TP is in
|
||||
* an unknown state.
|
||||
*/
|
||||
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, sensitivity);
|
||||
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, inertia);
|
||||
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, speed);
|
||||
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, reach);
|
||||
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, draghys);
|
||||
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, mindrag);
|
||||
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, thresh);
|
||||
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, upthresh);
|
||||
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, ztime);
|
||||
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, jenks);
|
||||
|
||||
trackpoint_write(&psmouse->ps2dev, TP_REACH, tp->reach);
|
||||
trackpoint_write(&psmouse->ps2dev, TP_DRAGHYS, tp->draghys);
|
||||
trackpoint_write(&psmouse->ps2dev, TP_MINDRAG, tp->mindrag);
|
||||
|
||||
trackpoint_write(&psmouse->ps2dev, TP_THRESH, tp->thresh);
|
||||
trackpoint_write(&psmouse->ps2dev, TP_UP_THRESH, tp->upthresh);
|
||||
|
||||
trackpoint_write(&psmouse->ps2dev, TP_Z_TIME, tp->ztime);
|
||||
trackpoint_write(&psmouse->ps2dev, TP_JENKS_CURV, tp->jenks);
|
||||
|
||||
trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_PTSON, &toggle);
|
||||
if (((toggle & TP_MASK_PTSON) == TP_MASK_PTSON) != tp->press_to_select)
|
||||
trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_PTSON, TP_MASK_PTSON);
|
||||
|
||||
trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_SKIPBACK, &toggle);
|
||||
if (((toggle & TP_MASK_SKIPBACK) == TP_MASK_SKIPBACK) != tp->skipback)
|
||||
trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK);
|
||||
|
||||
trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_EXT_DEV, &toggle);
|
||||
if (((toggle & TP_MASK_EXT_DEV) == TP_MASK_EXT_DEV) != tp->ext_dev)
|
||||
trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV);
|
||||
/* toggles */
|
||||
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, press_to_select);
|
||||
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, skipback);
|
||||
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, ext_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void trackpoint_defaults(struct trackpoint_data *tp)
|
||||
{
|
||||
tp->press_to_select = TP_DEF_PTSON;
|
||||
tp->sensitivity = TP_DEF_SENS;
|
||||
tp->speed = TP_DEF_SPEED;
|
||||
tp->reach = TP_DEF_REACH;
|
||||
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, sensitivity);
|
||||
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, speed);
|
||||
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, reach);
|
||||
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, draghys);
|
||||
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, mindrag);
|
||||
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, thresh);
|
||||
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, upthresh);
|
||||
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, ztime);
|
||||
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, jenks);
|
||||
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, inertia);
|
||||
|
||||
tp->draghys = TP_DEF_DRAGHYS;
|
||||
tp->mindrag = TP_DEF_MINDRAG;
|
||||
|
||||
tp->thresh = TP_DEF_THRESH;
|
||||
tp->upthresh = TP_DEF_UP_THRESH;
|
||||
|
||||
tp->ztime = TP_DEF_Z_TIME;
|
||||
tp->jenks = TP_DEF_JENKS_CURV;
|
||||
|
||||
tp->inertia = TP_DEF_INERTIA;
|
||||
tp->skipback = TP_DEF_SKIPBACK;
|
||||
tp->ext_dev = TP_DEF_EXT_DEV;
|
||||
/* toggles */
|
||||
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, press_to_select);
|
||||
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, skipback);
|
||||
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, ext_dev);
|
||||
}
|
||||
|
||||
static void trackpoint_disconnect(struct psmouse *psmouse)
|
||||
@ -281,10 +350,13 @@ static void trackpoint_disconnect(struct psmouse *psmouse)
|
||||
|
||||
static int trackpoint_reconnect(struct psmouse *psmouse)
|
||||
{
|
||||
int reset_fail;
|
||||
|
||||
if (trackpoint_start_protocol(psmouse, NULL))
|
||||
return -1;
|
||||
|
||||
if (trackpoint_sync(psmouse))
|
||||
reset_fail = trackpoint_power_on_reset(&psmouse->ps2dev);
|
||||
if (trackpoint_sync(psmouse, !reset_fail))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@ -322,7 +394,12 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
|
||||
__set_bit(BTN_MIDDLE, psmouse->dev->keybit);
|
||||
|
||||
trackpoint_defaults(psmouse->private);
|
||||
trackpoint_sync(psmouse);
|
||||
|
||||
error = trackpoint_power_on_reset(&psmouse->ps2dev);
|
||||
|
||||
/* Write defaults to TP only if reset fails. */
|
||||
if (error)
|
||||
trackpoint_sync(psmouse, false);
|
||||
|
||||
error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group);
|
||||
if (error) {
|
||||
|
@ -126,6 +126,8 @@
|
||||
#define TP_DEF_PTSON 0x00
|
||||
#define TP_DEF_SKIPBACK 0x00
|
||||
#define TP_DEF_EXT_DEV 0x00 /* 0 means enabled */
|
||||
#define TP_DEF_TWOHAND 0x00
|
||||
#define TP_DEF_SOURCE_TAG 0x00
|
||||
|
||||
#define MAKE_PS2_CMD(params, results, cmd) ((params<<12) | (results<<8) | (cmd))
|
||||
|
||||
@ -136,9 +138,9 @@ struct trackpoint_data
|
||||
unsigned char thresh, upthresh;
|
||||
unsigned char ztime, jenks;
|
||||
|
||||
/* toggles */
|
||||
unsigned char press_to_select;
|
||||
unsigned char skipback;
|
||||
|
||||
unsigned char ext_dev;
|
||||
};
|
||||
|
||||
|
@ -245,4 +245,14 @@ config SERIO_ARC_PS2
|
||||
To compile this driver as a module, choose M here; the module
|
||||
will be called arc_ps2.
|
||||
|
||||
config SERIO_APBPS2
|
||||
tristate "GRLIB APBPS2 PS/2 keyboard/mouse controller"
|
||||
depends on OF
|
||||
help
|
||||
Say Y here if you want support for GRLIB APBPS2 peripherals used
|
||||
to connect to PS/2 keyboard and/or mouse.
|
||||
|
||||
To compile this driver as a module, choose M here: the module will
|
||||
be called apbps2.
|
||||
|
||||
endif
|
||||
|
@ -26,3 +26,4 @@ obj-$(CONFIG_SERIO_AMS_DELTA) += ams_delta_serio.o
|
||||
obj-$(CONFIG_SERIO_XILINX_XPS_PS2) += xilinx_ps2.o
|
||||
obj-$(CONFIG_SERIO_ALTERA_PS2) += altera_ps2.o
|
||||
obj-$(CONFIG_SERIO_ARC_PS2) += arc_ps2.o
|
||||
obj-$(CONFIG_SERIO_APBPS2) += apbps2.o
|
||||
|
228
drivers/input/serio/apbps2.c
Normal file
228
drivers/input/serio/apbps2.c
Normal file
@ -0,0 +1,228 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Aeroflex Gaisler
|
||||
*
|
||||
* This driver supports the APBPS2 PS/2 core available in the GRLIB
|
||||
* VHDL IP core library.
|
||||
*
|
||||
* Full documentation of the APBPS2 core can be found here:
|
||||
* http://www.gaisler.com/products/grlib/grip.pdf
|
||||
*
|
||||
* See "Documentation/devicetree/bindings/input/ps2keyb-mouse-apbps2.txt" for
|
||||
* information on open firmware properties.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Contributors: Daniel Hellstrom <daniel@gaisler.com>
|
||||
*/
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/serio.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
struct apbps2_regs {
|
||||
u32 __iomem data; /* 0x00 */
|
||||
u32 __iomem status; /* 0x04 */
|
||||
u32 __iomem ctrl; /* 0x08 */
|
||||
u32 __iomem reload; /* 0x0c */
|
||||
};
|
||||
|
||||
#define APBPS2_STATUS_DR (1<<0)
|
||||
#define APBPS2_STATUS_PE (1<<1)
|
||||
#define APBPS2_STATUS_FE (1<<2)
|
||||
#define APBPS2_STATUS_KI (1<<3)
|
||||
#define APBPS2_STATUS_RF (1<<4)
|
||||
#define APBPS2_STATUS_TF (1<<5)
|
||||
#define APBPS2_STATUS_TCNT (0x1f<<22)
|
||||
#define APBPS2_STATUS_RCNT (0x1f<<27)
|
||||
|
||||
#define APBPS2_CTRL_RE (1<<0)
|
||||
#define APBPS2_CTRL_TE (1<<1)
|
||||
#define APBPS2_CTRL_RI (1<<2)
|
||||
#define APBPS2_CTRL_TI (1<<3)
|
||||
|
||||
struct apbps2_priv {
|
||||
struct serio *io;
|
||||
struct apbps2_regs *regs;
|
||||
};
|
||||
|
||||
static int apbps2_idx;
|
||||
|
||||
static irqreturn_t apbps2_isr(int irq, void *dev_id)
|
||||
{
|
||||
struct apbps2_priv *priv = dev_id;
|
||||
unsigned long status, data, rxflags;
|
||||
irqreturn_t ret = IRQ_NONE;
|
||||
|
||||
while ((status = ioread32be(&priv->regs->status)) & APBPS2_STATUS_DR) {
|
||||
data = ioread32be(&priv->regs->data);
|
||||
rxflags = (status & APBPS2_STATUS_PE) ? SERIO_PARITY : 0;
|
||||
rxflags |= (status & APBPS2_STATUS_FE) ? SERIO_FRAME : 0;
|
||||
|
||||
/* clear error bits? */
|
||||
if (rxflags)
|
||||
iowrite32be(0, &priv->regs->status);
|
||||
|
||||
serio_interrupt(priv->io, data, rxflags);
|
||||
|
||||
ret = IRQ_HANDLED;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int apbps2_write(struct serio *io, unsigned char val)
|
||||
{
|
||||
struct apbps2_priv *priv = io->port_data;
|
||||
unsigned int tleft = 10000; /* timeout in 100ms */
|
||||
|
||||
/* delay until PS/2 controller has room for more chars */
|
||||
while ((ioread32be(&priv->regs->status) & APBPS2_STATUS_TF) && tleft--)
|
||||
udelay(10);
|
||||
|
||||
if ((ioread32be(&priv->regs->status) & APBPS2_STATUS_TF) == 0) {
|
||||
iowrite32be(val, &priv->regs->data);
|
||||
|
||||
iowrite32be(APBPS2_CTRL_RE | APBPS2_CTRL_RI | APBPS2_CTRL_TE,
|
||||
&priv->regs->ctrl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
static int apbps2_open(struct serio *io)
|
||||
{
|
||||
struct apbps2_priv *priv = io->port_data;
|
||||
int limit;
|
||||
unsigned long tmp;
|
||||
|
||||
/* clear error flags */
|
||||
iowrite32be(0, &priv->regs->status);
|
||||
|
||||
/* Clear old data if available (unlikely) */
|
||||
limit = 1024;
|
||||
while ((ioread32be(&priv->regs->status) & APBPS2_STATUS_DR) && --limit)
|
||||
tmp = ioread32be(&priv->regs->data);
|
||||
|
||||
/* Enable reciever and it's interrupt */
|
||||
iowrite32be(APBPS2_CTRL_RE | APBPS2_CTRL_RI, &priv->regs->ctrl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void apbps2_close(struct serio *io)
|
||||
{
|
||||
struct apbps2_priv *priv = io->port_data;
|
||||
|
||||
/* stop interrupts at PS/2 HW level */
|
||||
iowrite32be(0, &priv->regs->ctrl);
|
||||
}
|
||||
|
||||
/* Initialize one APBPS2 PS/2 core */
|
||||
static int apbps2_of_probe(struct platform_device *ofdev)
|
||||
{
|
||||
struct apbps2_priv *priv;
|
||||
int irq, err;
|
||||
u32 freq_hz;
|
||||
struct resource *res;
|
||||
|
||||
priv = devm_kzalloc(&ofdev->dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv) {
|
||||
dev_err(&ofdev->dev, "memory allocation failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* Find Device Address */
|
||||
res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
|
||||
priv->regs = devm_ioremap_resource(&ofdev->dev, res);
|
||||
if (IS_ERR(priv->regs))
|
||||
return PTR_ERR(priv->regs);
|
||||
|
||||
/* Reset hardware, disable interrupt */
|
||||
iowrite32be(0, &priv->regs->ctrl);
|
||||
|
||||
/* IRQ */
|
||||
irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
|
||||
err = devm_request_irq(&ofdev->dev, irq, apbps2_isr,
|
||||
IRQF_SHARED, "apbps2", priv);
|
||||
if (err) {
|
||||
dev_err(&ofdev->dev, "request IRQ%d failed\n", irq);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Get core frequency */
|
||||
if (of_property_read_u32(ofdev->dev.of_node, "freq", &freq_hz)) {
|
||||
dev_err(&ofdev->dev, "unable to get core frequency\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Set reload register to core freq in kHz/10 */
|
||||
iowrite32be(freq_hz / 10000, &priv->regs->reload);
|
||||
|
||||
priv->io = kzalloc(sizeof(struct serio), GFP_KERNEL);
|
||||
if (!priv->io)
|
||||
return -ENOMEM;
|
||||
|
||||
priv->io->id.type = SERIO_8042;
|
||||
priv->io->open = apbps2_open;
|
||||
priv->io->close = apbps2_close;
|
||||
priv->io->write = apbps2_write;
|
||||
priv->io->port_data = priv;
|
||||
strlcpy(priv->io->name, "APBPS2 PS/2", sizeof(priv->io->name));
|
||||
snprintf(priv->io->phys, sizeof(priv->io->phys),
|
||||
"apbps2_%d", apbps2_idx++);
|
||||
|
||||
dev_info(&ofdev->dev, "irq = %d, base = 0x%p\n", irq, priv->regs);
|
||||
|
||||
serio_register_port(priv->io);
|
||||
|
||||
platform_set_drvdata(ofdev, priv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int apbps2_of_remove(struct platform_device *of_dev)
|
||||
{
|
||||
struct apbps2_priv *priv = platform_get_drvdata(of_dev);
|
||||
|
||||
serio_unregister_port(priv->io);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct of_device_id apbps2_of_match[] = {
|
||||
{ .name = "GAISLER_APBPS2", },
|
||||
{ .name = "01_060", },
|
||||
{}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(of, apbps2_of_match);
|
||||
|
||||
static struct platform_driver apbps2_of_driver = {
|
||||
.driver = {
|
||||
.name = "grlib-apbps2",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = apbps2_of_match,
|
||||
},
|
||||
.probe = apbps2_of_probe,
|
||||
.remove = apbps2_of_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(apbps2_of_driver);
|
||||
|
||||
MODULE_AUTHOR("Aeroflex Gaisler AB.");
|
||||
MODULE_DESCRIPTION("GRLIB APBPS2 PS/2 serial I/O");
|
||||
MODULE_LICENSE("GPL");
|
@ -14,6 +14,7 @@
|
||||
#include <linux/input.h>
|
||||
#include <linux/serio.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
@ -259,10 +260,19 @@ static int arc_ps2_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static const struct of_device_id arc_ps2_match[] = {
|
||||
{ .compatible = "snps,arc_ps2" },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, arc_ps2_match);
|
||||
#endif
|
||||
|
||||
static struct platform_driver arc_ps2_driver = {
|
||||
.driver = {
|
||||
.name = "arc_ps2",
|
||||
.owner = THIS_MODULE,
|
||||
.name = "arc_ps2",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = of_match_ptr(arc_ps2_match),
|
||||
},
|
||||
.probe = arc_ps2_probe,
|
||||
.remove = arc_ps2_remove,
|
||||
|
@ -359,18 +359,7 @@ static struct platform_driver psif_driver = {
|
||||
},
|
||||
};
|
||||
|
||||
static int __init psif_init(void)
|
||||
{
|
||||
return platform_driver_probe(&psif_driver, psif_probe);
|
||||
}
|
||||
|
||||
static void __exit psif_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&psif_driver);
|
||||
}
|
||||
|
||||
module_init(psif_init);
|
||||
module_exit(psif_exit);
|
||||
module_platform_driver_probe(psif_driver, psif_probe);
|
||||
|
||||
MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>");
|
||||
MODULE_DESCRIPTION("Atmel AVR32 PSIF PS/2 driver");
|
||||
|
@ -193,15 +193,4 @@ static struct platform_driver q40kbd_driver = {
|
||||
.remove = q40kbd_remove,
|
||||
};
|
||||
|
||||
static int __init q40kbd_init(void)
|
||||
{
|
||||
return platform_driver_probe(&q40kbd_driver, q40kbd_probe);
|
||||
}
|
||||
|
||||
static void __exit q40kbd_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&q40kbd_driver);
|
||||
}
|
||||
|
||||
module_init(q40kbd_init);
|
||||
module_exit(q40kbd_exit);
|
||||
module_platform_driver_probe(q40kbd_driver, q40kbd_probe);
|
||||
|
@ -273,7 +273,7 @@ static int ad7877_write(struct spi_device *spi, u16 reg, u16 val)
|
||||
|
||||
static int ad7877_read_adc(struct spi_device *spi, unsigned command)
|
||||
{
|
||||
struct ad7877 *ts = dev_get_drvdata(&spi->dev);
|
||||
struct ad7877 *ts = spi_get_drvdata(spi);
|
||||
struct ser_req *req;
|
||||
int status;
|
||||
int sample;
|
||||
@ -720,7 +720,7 @@ static int ad7877_probe(struct spi_device *spi)
|
||||
goto err_free_mem;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&spi->dev, ts);
|
||||
spi_set_drvdata(spi, ts);
|
||||
ts->spi = spi;
|
||||
ts->input = input_dev;
|
||||
|
||||
@ -806,13 +806,13 @@ err_free_irq:
|
||||
err_free_mem:
|
||||
input_free_device(input_dev);
|
||||
kfree(ts);
|
||||
dev_set_drvdata(&spi->dev, NULL);
|
||||
spi_set_drvdata(spi, NULL);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ad7877_remove(struct spi_device *spi)
|
||||
{
|
||||
struct ad7877 *ts = dev_get_drvdata(&spi->dev);
|
||||
struct ad7877 *ts = spi_get_drvdata(spi);
|
||||
|
||||
sysfs_remove_group(&spi->dev.kobj, &ad7877_attr_group);
|
||||
|
||||
@ -823,7 +823,7 @@ static int ad7877_remove(struct spi_device *spi)
|
||||
kfree(ts);
|
||||
|
||||
dev_dbg(&spi->dev, "unregistered touchscreen\n");
|
||||
dev_set_drvdata(&spi->dev, NULL);
|
||||
spi_set_drvdata(spi, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1245,7 +1245,7 @@ static int ads7846_probe(struct spi_device *spi)
|
||||
goto err_free_mem;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&spi->dev, ts);
|
||||
spi_set_drvdata(spi, ts);
|
||||
|
||||
ts->packet = packet;
|
||||
ts->spi = spi;
|
||||
@ -1397,7 +1397,7 @@ static int ads7846_probe(struct spi_device *spi)
|
||||
|
||||
static int ads7846_remove(struct spi_device *spi)
|
||||
{
|
||||
struct ads7846 *ts = dev_get_drvdata(&spi->dev);
|
||||
struct ads7846 *ts = spi_get_drvdata(spi);
|
||||
|
||||
device_init_wakeup(&spi->dev, false);
|
||||
|
||||
|
@ -432,17 +432,7 @@ static struct platform_driver atmel_wm97xx_driver = {
|
||||
},
|
||||
};
|
||||
|
||||
static int __init atmel_wm97xx_init(void)
|
||||
{
|
||||
return platform_driver_probe(&atmel_wm97xx_driver, atmel_wm97xx_probe);
|
||||
}
|
||||
module_init(atmel_wm97xx_init);
|
||||
|
||||
static void __exit atmel_wm97xx_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&atmel_wm97xx_driver);
|
||||
}
|
||||
module_exit(atmel_wm97xx_exit);
|
||||
module_platform_driver_probe(atmel_wm97xx_driver, atmel_wm97xx_probe);
|
||||
|
||||
MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>");
|
||||
MODULE_DESCRIPTION("wm97xx continuous touch driver for Atmel AT91 and AVR32");
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/input/auo-pixcir-ts.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_gpio.h>
|
||||
|
||||
/*
|
||||
* Coordinate calculation:
|
||||
@ -111,6 +113,7 @@
|
||||
struct auo_pixcir_ts {
|
||||
struct i2c_client *client;
|
||||
struct input_dev *input;
|
||||
const struct auo_pixcir_ts_platdata *pdata;
|
||||
char phys[32];
|
||||
|
||||
/* special handling for touch_indicate interupt mode */
|
||||
@ -132,7 +135,7 @@ static int auo_pixcir_collect_data(struct auo_pixcir_ts *ts,
|
||||
struct auo_point_t *point)
|
||||
{
|
||||
struct i2c_client *client = ts->client;
|
||||
const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data;
|
||||
const struct auo_pixcir_ts_platdata *pdata = ts->pdata;
|
||||
uint8_t raw_coord[8];
|
||||
uint8_t raw_area[4];
|
||||
int i, ret;
|
||||
@ -178,8 +181,7 @@ static int auo_pixcir_collect_data(struct auo_pixcir_ts *ts,
|
||||
static irqreturn_t auo_pixcir_interrupt(int irq, void *dev_id)
|
||||
{
|
||||
struct auo_pixcir_ts *ts = dev_id;
|
||||
struct i2c_client *client = ts->client;
|
||||
const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data;
|
||||
const struct auo_pixcir_ts_platdata *pdata = ts->pdata;
|
||||
struct auo_point_t point[AUO_PIXCIR_REPORT_POINTS];
|
||||
int i;
|
||||
int ret;
|
||||
@ -290,7 +292,7 @@ static int auo_pixcir_int_config(struct auo_pixcir_ts *ts,
|
||||
int int_setting)
|
||||
{
|
||||
struct i2c_client *client = ts->client;
|
||||
struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data;
|
||||
const struct auo_pixcir_ts_platdata *pdata = ts->pdata;
|
||||
int ret;
|
||||
|
||||
ret = i2c_smbus_read_byte_data(client, AUO_PIXCIR_REG_INT_SETTING);
|
||||
@ -479,53 +481,105 @@ unlock:
|
||||
}
|
||||
#endif
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(auo_pixcir_pm_ops, auo_pixcir_suspend,
|
||||
auo_pixcir_resume);
|
||||
static SIMPLE_DEV_PM_OPS(auo_pixcir_pm_ops,
|
||||
auo_pixcir_suspend, auo_pixcir_resume);
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static struct auo_pixcir_ts_platdata *auo_pixcir_parse_dt(struct device *dev)
|
||||
{
|
||||
struct auo_pixcir_ts_platdata *pdata;
|
||||
struct device_node *np = dev->of_node;
|
||||
|
||||
if (!np)
|
||||
return ERR_PTR(-ENOENT);
|
||||
|
||||
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
|
||||
if (!pdata) {
|
||||
dev_err(dev, "failed to allocate platform data\n");
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
pdata->gpio_int = of_get_gpio(np, 0);
|
||||
if (!gpio_is_valid(pdata->gpio_int)) {
|
||||
dev_err(dev, "failed to get interrupt gpio\n");
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
pdata->gpio_rst = of_get_gpio(np, 1);
|
||||
if (!gpio_is_valid(pdata->gpio_rst)) {
|
||||
dev_err(dev, "failed to get reset gpio\n");
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
if (of_property_read_u32(np, "x-size", &pdata->x_max)) {
|
||||
dev_err(dev, "failed to get x-size property\n");
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
if (of_property_read_u32(np, "y-size", &pdata->y_max)) {
|
||||
dev_err(dev, "failed to get y-size property\n");
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
/* default to asserting the interrupt when the screen is touched */
|
||||
pdata->int_setting = AUO_PIXCIR_INT_TOUCH_IND;
|
||||
|
||||
return pdata;
|
||||
}
|
||||
#else
|
||||
static struct auo_pixcir_ts_platdata *auo_pixcir_parse_dt(struct device *dev)
|
||||
{
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void auo_pixcir_reset(void *data)
|
||||
{
|
||||
struct auo_pixcir_ts *ts = data;
|
||||
|
||||
gpio_set_value(ts->pdata->gpio_rst, 0);
|
||||
}
|
||||
|
||||
static int auo_pixcir_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data;
|
||||
const struct auo_pixcir_ts_platdata *pdata;
|
||||
struct auo_pixcir_ts *ts;
|
||||
struct input_dev *input_dev;
|
||||
int ret;
|
||||
int version;
|
||||
int error;
|
||||
|
||||
if (!pdata)
|
||||
return -EINVAL;
|
||||
pdata = dev_get_platdata(&client->dev);
|
||||
if (!pdata) {
|
||||
pdata = auo_pixcir_parse_dt(&client->dev);
|
||||
if (IS_ERR(pdata))
|
||||
return PTR_ERR(pdata);
|
||||
}
|
||||
|
||||
ts = kzalloc(sizeof(struct auo_pixcir_ts), GFP_KERNEL);
|
||||
ts = devm_kzalloc(&client->dev,
|
||||
sizeof(struct auo_pixcir_ts), GFP_KERNEL);
|
||||
if (!ts)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = gpio_request(pdata->gpio_int, "auo_pixcir_ts_int");
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "request of gpio %d failed, %d\n",
|
||||
pdata->gpio_int, ret);
|
||||
goto err_gpio_int;
|
||||
input_dev = devm_input_allocate_device(&client->dev);
|
||||
if (!input_dev) {
|
||||
dev_err(&client->dev, "could not allocate input device\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (pdata->init_hw)
|
||||
pdata->init_hw(client);
|
||||
|
||||
ts->pdata = pdata;
|
||||
ts->client = client;
|
||||
ts->input = input_dev;
|
||||
ts->touch_ind_mode = 0;
|
||||
ts->stopped = true;
|
||||
init_waitqueue_head(&ts->wait);
|
||||
|
||||
snprintf(ts->phys, sizeof(ts->phys),
|
||||
"%s/input0", dev_name(&client->dev));
|
||||
|
||||
input_dev = input_allocate_device();
|
||||
if (!input_dev) {
|
||||
dev_err(&client->dev, "could not allocate input device\n");
|
||||
goto err_input_alloc;
|
||||
}
|
||||
|
||||
ts->input = input_dev;
|
||||
|
||||
input_dev->name = "AUO-Pixcir touchscreen";
|
||||
input_dev->phys = ts->phys;
|
||||
input_dev->id.bustype = BUS_I2C;
|
||||
input_dev->dev.parent = &client->dev;
|
||||
|
||||
input_dev->open = auo_pixcir_input_open;
|
||||
input_dev->close = auo_pixcir_input_close;
|
||||
@ -550,71 +604,71 @@ static int auo_pixcir_probe(struct i2c_client *client,
|
||||
AUO_PIXCIR_MAX_AREA, 0, 0);
|
||||
input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0);
|
||||
|
||||
ret = i2c_smbus_read_byte_data(client, AUO_PIXCIR_REG_VERSION);
|
||||
if (ret < 0)
|
||||
goto err_fw_vers;
|
||||
dev_info(&client->dev, "firmware version 0x%X\n", ret);
|
||||
|
||||
ret = auo_pixcir_int_config(ts, pdata->int_setting);
|
||||
if (ret)
|
||||
goto err_fw_vers;
|
||||
|
||||
input_set_drvdata(ts->input, ts);
|
||||
ts->stopped = true;
|
||||
|
||||
ret = request_threaded_irq(client->irq, NULL, auo_pixcir_interrupt,
|
||||
IRQF_TRIGGER_RISING | IRQF_ONESHOT,
|
||||
input_dev->name, ts);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "irq %d requested failed\n", client->irq);
|
||||
goto err_fw_vers;
|
||||
error = devm_gpio_request_one(&client->dev, pdata->gpio_int,
|
||||
GPIOF_DIR_IN, "auo_pixcir_ts_int");
|
||||
if (error) {
|
||||
dev_err(&client->dev, "request of gpio %d failed, %d\n",
|
||||
pdata->gpio_int, error);
|
||||
return error;
|
||||
}
|
||||
|
||||
error = devm_gpio_request_one(&client->dev, pdata->gpio_rst,
|
||||
GPIOF_DIR_OUT | GPIOF_INIT_HIGH,
|
||||
"auo_pixcir_ts_rst");
|
||||
if (error) {
|
||||
dev_err(&client->dev, "request of gpio %d failed, %d\n",
|
||||
pdata->gpio_rst, error);
|
||||
return error;
|
||||
}
|
||||
|
||||
error = devm_add_action(&client->dev, auo_pixcir_reset, ts);
|
||||
if (error) {
|
||||
auo_pixcir_reset(ts);
|
||||
dev_err(&client->dev, "failed to register reset action, %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
|
||||
msleep(200);
|
||||
|
||||
version = i2c_smbus_read_byte_data(client, AUO_PIXCIR_REG_VERSION);
|
||||
if (version < 0) {
|
||||
error = version;
|
||||
return error;
|
||||
}
|
||||
|
||||
dev_info(&client->dev, "firmware version 0x%X\n", version);
|
||||
|
||||
error = auo_pixcir_int_config(ts, pdata->int_setting);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
error = devm_request_threaded_irq(&client->dev, client->irq,
|
||||
NULL, auo_pixcir_interrupt,
|
||||
IRQF_TRIGGER_RISING | IRQF_ONESHOT,
|
||||
input_dev->name, ts);
|
||||
if (error) {
|
||||
dev_err(&client->dev, "irq %d requested failed, %d\n",
|
||||
client->irq, error);
|
||||
return error;
|
||||
}
|
||||
|
||||
/* stop device and put it into deep sleep until it is opened */
|
||||
ret = auo_pixcir_stop(ts);
|
||||
if (ret < 0)
|
||||
goto err_input_register;
|
||||
error = auo_pixcir_stop(ts);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
ret = input_register_device(input_dev);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "could not register input device\n");
|
||||
goto err_input_register;
|
||||
error = input_register_device(input_dev);
|
||||
if (error) {
|
||||
dev_err(&client->dev, "could not register input device, %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
|
||||
i2c_set_clientdata(client, ts);
|
||||
|
||||
return 0;
|
||||
|
||||
err_input_register:
|
||||
free_irq(client->irq, ts);
|
||||
err_fw_vers:
|
||||
input_free_device(input_dev);
|
||||
err_input_alloc:
|
||||
if (pdata->exit_hw)
|
||||
pdata->exit_hw(client);
|
||||
gpio_free(pdata->gpio_int);
|
||||
err_gpio_int:
|
||||
kfree(ts);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int auo_pixcir_remove(struct i2c_client *client)
|
||||
{
|
||||
struct auo_pixcir_ts *ts = i2c_get_clientdata(client);
|
||||
const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data;
|
||||
|
||||
free_irq(client->irq, ts);
|
||||
|
||||
input_unregister_device(ts->input);
|
||||
|
||||
if (pdata->exit_hw)
|
||||
pdata->exit_hw(client);
|
||||
|
||||
gpio_free(pdata->gpio_int);
|
||||
|
||||
kfree(ts);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -624,14 +678,22 @@ static const struct i2c_device_id auo_pixcir_idtable[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, auo_pixcir_idtable);
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static struct of_device_id auo_pixcir_ts_dt_idtable[] = {
|
||||
{ .compatible = "auo,auo_pixcir_ts" },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, auo_pixcir_ts_dt_idtable);
|
||||
#endif
|
||||
|
||||
static struct i2c_driver auo_pixcir_driver = {
|
||||
.driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "auo_pixcir_ts",
|
||||
.pm = &auo_pixcir_pm_ops,
|
||||
.of_match_table = of_match_ptr(auo_pixcir_ts_dt_idtable),
|
||||
},
|
||||
.probe = auo_pixcir_probe,
|
||||
.remove = auo_pixcir_remove,
|
||||
.id_table = auo_pixcir_idtable,
|
||||
};
|
||||
|
||||
|
@ -440,8 +440,7 @@ static int edt_ft5x06_work_mode(struct edt_ft5x06_ts_data *tsdata)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (tsdata->raw_buffer)
|
||||
kfree(tsdata->raw_buffer);
|
||||
kfree(tsdata->raw_buffer);
|
||||
tsdata->raw_buffer = NULL;
|
||||
|
||||
/* restore parameters */
|
||||
|
@ -206,8 +206,7 @@ static int eeti_ts_probe(struct i2c_client *client,
|
||||
if (err < 0)
|
||||
goto err1;
|
||||
|
||||
if (pdata)
|
||||
priv->irq_active_high = pdata->irq_active_high;
|
||||
priv->irq_active_high = pdata->irq_active_high;
|
||||
|
||||
irq_flags = priv->irq_active_high ?
|
||||
IRQF_TRIGGER_RISING : IRQF_TRIGGER_FALLING;
|
||||
|
@ -250,17 +250,7 @@ static struct platform_driver mc13783_ts_driver = {
|
||||
},
|
||||
};
|
||||
|
||||
static int __init mc13783_ts_init(void)
|
||||
{
|
||||
return platform_driver_probe(&mc13783_ts_driver, &mc13783_ts_probe);
|
||||
}
|
||||
module_init(mc13783_ts_init);
|
||||
|
||||
static void __exit mc13783_ts_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&mc13783_ts_driver);
|
||||
}
|
||||
module_exit(mc13783_ts_exit);
|
||||
module_platform_driver_probe(mc13783_ts_driver, mc13783_ts_probe);
|
||||
|
||||
MODULE_DESCRIPTION("MC13783 input touchscreen driver");
|
||||
MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
|
||||
|
@ -19,13 +19,16 @@
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/pm_qos.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/platform_data/st1232_pdata.h>
|
||||
|
||||
#define ST1232_TS_NAME "st1232-ts"
|
||||
|
||||
@ -48,6 +51,7 @@ struct st1232_ts_data {
|
||||
struct input_dev *input_dev;
|
||||
struct st1232_ts_finger finger[MAX_FINGERS];
|
||||
struct dev_pm_qos_request low_latency_req;
|
||||
int reset_gpio;
|
||||
};
|
||||
|
||||
static int st1232_ts_read_data(struct st1232_ts_data *ts)
|
||||
@ -139,10 +143,17 @@ end:
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static void st1232_ts_power(struct st1232_ts_data *ts, bool poweron)
|
||||
{
|
||||
if (gpio_is_valid(ts->reset_gpio))
|
||||
gpio_direction_output(ts->reset_gpio, poweron);
|
||||
}
|
||||
|
||||
static int st1232_ts_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct st1232_ts_data *ts;
|
||||
struct st1232_pdata *pdata = client->dev.platform_data;
|
||||
struct input_dev *input_dev;
|
||||
int error;
|
||||
|
||||
@ -156,17 +167,36 @@ static int st1232_ts_probe(struct i2c_client *client,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL);
|
||||
if (!ts)
|
||||
return -ENOMEM;
|
||||
|
||||
ts = kzalloc(sizeof(struct st1232_ts_data), GFP_KERNEL);
|
||||
input_dev = input_allocate_device();
|
||||
if (!ts || !input_dev) {
|
||||
error = -ENOMEM;
|
||||
goto err_free_mem;
|
||||
}
|
||||
input_dev = devm_input_allocate_device(&client->dev);
|
||||
if (!input_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
ts->client = client;
|
||||
ts->input_dev = input_dev;
|
||||
|
||||
if (pdata)
|
||||
ts->reset_gpio = pdata->reset_gpio;
|
||||
else if (client->dev.of_node)
|
||||
ts->reset_gpio = of_get_gpio(client->dev.of_node, 0);
|
||||
else
|
||||
ts->reset_gpio = -ENODEV;
|
||||
|
||||
if (gpio_is_valid(ts->reset_gpio)) {
|
||||
error = devm_gpio_request(&client->dev, ts->reset_gpio, NULL);
|
||||
if (error) {
|
||||
dev_err(&client->dev,
|
||||
"Unable to request GPIO pin %d.\n",
|
||||
ts->reset_gpio);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
st1232_ts_power(ts, true);
|
||||
|
||||
input_dev->name = "st1232-touchscreen";
|
||||
input_dev->id.bustype = BUS_I2C;
|
||||
input_dev->dev.parent = &client->dev;
|
||||
@ -179,31 +209,26 @@ static int st1232_ts_probe(struct i2c_client *client,
|
||||
input_set_abs_params(input_dev, ABS_MT_POSITION_X, MIN_X, MAX_X, 0, 0);
|
||||
input_set_abs_params(input_dev, ABS_MT_POSITION_Y, MIN_Y, MAX_Y, 0, 0);
|
||||
|
||||
error = request_threaded_irq(client->irq, NULL, st1232_ts_irq_handler,
|
||||
IRQF_ONESHOT, client->name, ts);
|
||||
error = devm_request_threaded_irq(&client->dev, client->irq,
|
||||
NULL, st1232_ts_irq_handler,
|
||||
IRQF_ONESHOT,
|
||||
client->name, ts);
|
||||
if (error) {
|
||||
dev_err(&client->dev, "Failed to register interrupt\n");
|
||||
goto err_free_mem;
|
||||
return error;
|
||||
}
|
||||
|
||||
error = input_register_device(ts->input_dev);
|
||||
if (error) {
|
||||
dev_err(&client->dev, "Unable to register %s input device\n",
|
||||
input_dev->name);
|
||||
goto err_free_irq;
|
||||
return error;
|
||||
}
|
||||
|
||||
i2c_set_clientdata(client, ts);
|
||||
device_init_wakeup(&client->dev, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
err_free_irq:
|
||||
free_irq(client->irq, ts);
|
||||
err_free_mem:
|
||||
input_free_device(input_dev);
|
||||
kfree(ts);
|
||||
return error;
|
||||
}
|
||||
|
||||
static int st1232_ts_remove(struct i2c_client *client)
|
||||
@ -211,9 +236,7 @@ static int st1232_ts_remove(struct i2c_client *client)
|
||||
struct st1232_ts_data *ts = i2c_get_clientdata(client);
|
||||
|
||||
device_init_wakeup(&client->dev, 0);
|
||||
free_irq(client->irq, ts);
|
||||
input_unregister_device(ts->input_dev);
|
||||
kfree(ts);
|
||||
st1232_ts_power(ts, false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -222,11 +245,14 @@ static int st1232_ts_remove(struct i2c_client *client)
|
||||
static int st1232_ts_suspend(struct device *dev)
|
||||
{
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
struct st1232_ts_data *ts = i2c_get_clientdata(client);
|
||||
|
||||
if (device_may_wakeup(&client->dev))
|
||||
if (device_may_wakeup(&client->dev)) {
|
||||
enable_irq_wake(client->irq);
|
||||
else
|
||||
} else {
|
||||
disable_irq(client->irq);
|
||||
st1232_ts_power(ts, false);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -234,11 +260,14 @@ static int st1232_ts_suspend(struct device *dev)
|
||||
static int st1232_ts_resume(struct device *dev)
|
||||
{
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
struct st1232_ts_data *ts = i2c_get_clientdata(client);
|
||||
|
||||
if (device_may_wakeup(&client->dev))
|
||||
if (device_may_wakeup(&client->dev)) {
|
||||
disable_irq_wake(client->irq);
|
||||
else
|
||||
} else {
|
||||
st1232_ts_power(ts, true);
|
||||
enable_irq(client->irq);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -162,14 +162,14 @@ static void wm9712_phy_init(struct wm97xx *wm)
|
||||
if (rpu) {
|
||||
dig2 &= 0xffc0;
|
||||
dig2 |= WM9712_RPU(rpu);
|
||||
dev_dbg(wm->dev, "setting pen detect pull-up to %d Ohms",
|
||||
dev_dbg(wm->dev, "setting pen detect pull-up to %d Ohms\n",
|
||||
64000 / rpu);
|
||||
}
|
||||
|
||||
/* WM9712 five wire */
|
||||
if (five_wire) {
|
||||
dig2 |= WM9712_45W;
|
||||
dev_dbg(wm->dev, "setting 5-wire touchscreen mode.");
|
||||
dev_dbg(wm->dev, "setting 5-wire touchscreen mode.\n");
|
||||
|
||||
if (pil) {
|
||||
dev_warn(wm->dev, "pressure measurement is not "
|
||||
@ -182,21 +182,21 @@ static void wm9712_phy_init(struct wm97xx *wm)
|
||||
if (pil == 2) {
|
||||
dig2 |= WM9712_PIL;
|
||||
dev_dbg(wm->dev,
|
||||
"setting pressure measurement current to 400uA.");
|
||||
"setting pressure measurement current to 400uA.\n");
|
||||
} else if (pil)
|
||||
dev_dbg(wm->dev,
|
||||
"setting pressure measurement current to 200uA.");
|
||||
"setting pressure measurement current to 200uA.\n");
|
||||
if (!pil)
|
||||
pressure = 0;
|
||||
|
||||
/* polling mode sample settling delay */
|
||||
if (delay < 0 || delay > 15) {
|
||||
dev_dbg(wm->dev, "supplied delay out of range.");
|
||||
dev_dbg(wm->dev, "supplied delay out of range.\n");
|
||||
delay = 4;
|
||||
}
|
||||
dig1 &= 0xff0f;
|
||||
dig1 |= WM97XX_DELAY(delay);
|
||||
dev_dbg(wm->dev, "setting adc sample delay to %d u Secs.",
|
||||
dev_dbg(wm->dev, "setting adc sample delay to %d u Secs.\n",
|
||||
delay_table[delay]);
|
||||
|
||||
/* mask */
|
||||
@ -285,7 +285,7 @@ static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
|
||||
if (is_pden(wm))
|
||||
wm->pen_probably_down = 0;
|
||||
else
|
||||
dev_dbg(wm->dev, "adc sample timeout");
|
||||
dev_dbg(wm->dev, "adc sample timeout\n");
|
||||
return RC_PENUP;
|
||||
}
|
||||
|
||||
@ -295,15 +295,19 @@ static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
|
||||
|
||||
/* check we have correct sample */
|
||||
if ((*sample ^ adcsel) & WM97XX_ADCSEL_MASK) {
|
||||
dev_dbg(wm->dev, "adc wrong sample, wanted %x got %x",
|
||||
dev_dbg(wm->dev, "adc wrong sample, wanted %x got %x\n",
|
||||
adcsel & WM97XX_ADCSEL_MASK,
|
||||
*sample & WM97XX_ADCSEL_MASK);
|
||||
return RC_PENUP;
|
||||
return RC_AGAIN;
|
||||
}
|
||||
|
||||
if (wants_pen && !(*sample & WM97XX_PEN_DOWN)) {
|
||||
wm->pen_probably_down = 0;
|
||||
return RC_PENUP;
|
||||
/* Sometimes it reads a wrong value the first time. */
|
||||
*sample = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD);
|
||||
if (!(*sample & WM97XX_PEN_DOWN)) {
|
||||
wm->pen_probably_down = 0;
|
||||
return RC_PENUP;
|
||||
}
|
||||
}
|
||||
|
||||
return RC_VALID;
|
||||
@ -345,7 +349,7 @@ static int wm9712_poll_coord(struct wm97xx *wm, struct wm97xx_data *data)
|
||||
if (is_pden(wm))
|
||||
wm->pen_probably_down = 0;
|
||||
else
|
||||
dev_dbg(wm->dev, "adc sample timeout");
|
||||
dev_dbg(wm->dev, "adc sample timeout\n");
|
||||
return RC_PENUP;
|
||||
}
|
||||
|
||||
|
@ -442,6 +442,16 @@ static int wm97xx_read_samples(struct wm97xx *wm)
|
||||
"pen down: x=%x:%d, y=%x:%d, pressure=%x:%d\n",
|
||||
data.x >> 12, data.x & 0xfff, data.y >> 12,
|
||||
data.y & 0xfff, data.p >> 12, data.p & 0xfff);
|
||||
|
||||
if (abs_x[0] > (data.x & 0xfff) ||
|
||||
abs_x[1] < (data.x & 0xfff) ||
|
||||
abs_y[0] > (data.y & 0xfff) ||
|
||||
abs_y[1] < (data.y & 0xfff)) {
|
||||
dev_dbg(wm->dev, "Measurement out of range, dropping it\n");
|
||||
rc = RC_AGAIN;
|
||||
goto out;
|
||||
}
|
||||
|
||||
input_report_abs(wm->input_dev, ABS_X, data.x & 0xfff);
|
||||
input_report_abs(wm->input_dev, ABS_Y, data.y & 0xfff);
|
||||
input_report_abs(wm->input_dev, ABS_PRESSURE, data.p & 0xfff);
|
||||
@ -455,6 +465,7 @@ static int wm97xx_read_samples(struct wm97xx *wm)
|
||||
wm->ts_reader_interval = wm->ts_reader_min_interval;
|
||||
}
|
||||
|
||||
out:
|
||||
mutex_unlock(&wm->codec_mutex);
|
||||
return rc;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <linux/input.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <asm/ptrace.h>
|
||||
#include <asm/irq_regs.h>
|
||||
@ -51,6 +52,9 @@
|
||||
static int __read_mostly sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
|
||||
static bool __read_mostly sysrq_always_enabled;
|
||||
|
||||
unsigned short platform_sysrq_reset_seq[] __weak = { KEY_RESERVED };
|
||||
int sysrq_reset_downtime_ms __weak;
|
||||
|
||||
static bool sysrq_on(void)
|
||||
{
|
||||
return sysrq_enabled || sysrq_always_enabled;
|
||||
@ -586,6 +590,7 @@ struct sysrq_state {
|
||||
int reset_seq_len;
|
||||
int reset_seq_cnt;
|
||||
int reset_seq_version;
|
||||
struct timer_list keyreset_timer;
|
||||
};
|
||||
|
||||
#define SYSRQ_KEY_RESET_MAX 20 /* Should be plenty */
|
||||
@ -619,29 +624,51 @@ static void sysrq_parse_reset_sequence(struct sysrq_state *state)
|
||||
state->reset_seq_version = sysrq_reset_seq_version;
|
||||
}
|
||||
|
||||
static bool sysrq_detect_reset_sequence(struct sysrq_state *state,
|
||||
static void sysrq_do_reset(unsigned long dummy)
|
||||
{
|
||||
__handle_sysrq(sysrq_xlate[KEY_B], false);
|
||||
}
|
||||
|
||||
static void sysrq_handle_reset_request(struct sysrq_state *state)
|
||||
{
|
||||
if (sysrq_reset_downtime_ms)
|
||||
mod_timer(&state->keyreset_timer,
|
||||
jiffies + msecs_to_jiffies(sysrq_reset_downtime_ms));
|
||||
else
|
||||
sysrq_do_reset(0);
|
||||
}
|
||||
|
||||
static void sysrq_detect_reset_sequence(struct sysrq_state *state,
|
||||
unsigned int code, int value)
|
||||
{
|
||||
if (!test_bit(code, state->reset_keybit)) {
|
||||
/*
|
||||
* Pressing any key _not_ in reset sequence cancels
|
||||
* the reset sequence.
|
||||
* the reset sequence. Also cancelling the timer in
|
||||
* case additional keys were pressed after a reset
|
||||
* has been requested.
|
||||
*/
|
||||
if (value && state->reset_seq_cnt)
|
||||
if (value && state->reset_seq_cnt) {
|
||||
state->reset_canceled = true;
|
||||
del_timer(&state->keyreset_timer);
|
||||
}
|
||||
} else if (value == 0) {
|
||||
/* key release */
|
||||
/*
|
||||
* Key release - all keys in the reset sequence need
|
||||
* to be pressed and held for the reset timeout
|
||||
* to hold.
|
||||
*/
|
||||
del_timer(&state->keyreset_timer);
|
||||
|
||||
if (--state->reset_seq_cnt == 0)
|
||||
state->reset_canceled = false;
|
||||
} else if (value == 1) {
|
||||
/* key press, not autorepeat */
|
||||
if (++state->reset_seq_cnt == state->reset_seq_len &&
|
||||
!state->reset_canceled) {
|
||||
return true;
|
||||
sysrq_handle_reset_request(state);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void sysrq_reinject_alt_sysrq(struct work_struct *work)
|
||||
@ -748,10 +775,8 @@ static bool sysrq_handle_keypress(struct sysrq_state *sysrq,
|
||||
if (was_active)
|
||||
schedule_work(&sysrq->reinject_work);
|
||||
|
||||
if (sysrq_detect_reset_sequence(sysrq, code, value)) {
|
||||
/* Force emergency reboot */
|
||||
__handle_sysrq(sysrq_xlate[KEY_B], false);
|
||||
}
|
||||
/* Check for reset sequence */
|
||||
sysrq_detect_reset_sequence(sysrq, code, value);
|
||||
|
||||
} else if (value == 0 && test_and_clear_bit(code, sysrq->key_down)) {
|
||||
/*
|
||||
@ -812,6 +837,7 @@ static int sysrq_connect(struct input_handler *handler,
|
||||
sysrq->handle.handler = handler;
|
||||
sysrq->handle.name = "sysrq";
|
||||
sysrq->handle.private = sysrq;
|
||||
setup_timer(&sysrq->keyreset_timer, sysrq_do_reset, 0);
|
||||
|
||||
error = input_register_handle(&sysrq->handle);
|
||||
if (error) {
|
||||
@ -841,6 +867,7 @@ static void sysrq_disconnect(struct input_handle *handle)
|
||||
|
||||
input_close_device(handle);
|
||||
cancel_work_sync(&sysrq->reinject_work);
|
||||
del_timer_sync(&sysrq->keyreset_timer);
|
||||
input_unregister_handle(handle);
|
||||
kfree(sysrq);
|
||||
}
|
||||
@ -870,8 +897,6 @@ static struct input_handler sysrq_handler = {
|
||||
|
||||
static bool sysrq_handler_registered;
|
||||
|
||||
unsigned short platform_sysrq_reset_seq[] __weak = { KEY_RESERVED };
|
||||
|
||||
static inline void sysrq_register_handler(void)
|
||||
{
|
||||
unsigned short key;
|
||||
@ -931,6 +956,8 @@ static struct kernel_param_ops param_ops_sysrq_reset_seq = {
|
||||
module_param_array_named(reset_seq, sysrq_reset_seq, sysrq_reset_seq,
|
||||
&sysrq_reset_seq_len, 0644);
|
||||
|
||||
module_param_named(sysrq_downtime_ms, sysrq_reset_downtime_ms, int, 0644);
|
||||
|
||||
#else
|
||||
|
||||
static inline void sysrq_register_handler(void)
|
||||
|
@ -962,6 +962,10 @@ static int acm_probe(struct usb_interface *intf,
|
||||
|
||||
/* normal quirks */
|
||||
quirks = (unsigned long)id->driver_info;
|
||||
|
||||
if (quirks == IGNORE_DEVICE)
|
||||
return -ENODEV;
|
||||
|
||||
num_rx_buf = (quirks == SINGLE_RX_URB) ? 1 : ACM_NR;
|
||||
|
||||
/* handle quirks deadly to normal probing*/
|
||||
@ -1675,6 +1679,15 @@ static const struct usb_device_id acm_ids[] = {
|
||||
.driver_info = NO_DATA_INTERFACE,
|
||||
},
|
||||
|
||||
#if IS_ENABLED(CONFIG_INPUT_IMS_PCU)
|
||||
{ USB_DEVICE(0x04d8, 0x0082), /* Application mode */
|
||||
.driver_info = IGNORE_DEVICE,
|
||||
},
|
||||
{ USB_DEVICE(0x04d8, 0x0083), /* Bootloader mode */
|
||||
.driver_info = IGNORE_DEVICE,
|
||||
},
|
||||
#endif
|
||||
|
||||
/* control interfaces without any protocol set */
|
||||
{ USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
|
||||
USB_CDC_PROTO_NONE) },
|
||||
|
@ -128,3 +128,4 @@ struct acm {
|
||||
#define NO_CAP_LINE 4
|
||||
#define NOT_A_MODEM 8
|
||||
#define NO_DATA_INTERFACE 16
|
||||
#define IGNORE_DEVICE 32
|
||||
|
@ -576,6 +576,10 @@ void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
|
||||
void __iomem *devm_request_and_ioremap(struct device *dev,
|
||||
struct resource *res);
|
||||
|
||||
/* allows to add/remove a custom action to devres stack */
|
||||
int devm_add_action(struct device *dev, void (*action)(void *), void *data);
|
||||
void devm_remove_action(struct device *dev, void (*action)(void *), void *data);
|
||||
|
||||
struct device_dma_parameters {
|
||||
/*
|
||||
* a low level driver may set these to teach IOMMU code about
|
||||
|
@ -43,12 +43,10 @@
|
||||
*/
|
||||
struct auo_pixcir_ts_platdata {
|
||||
int gpio_int;
|
||||
int gpio_rst;
|
||||
|
||||
int int_setting;
|
||||
|
||||
void (*init_hw)(struct i2c_client *);
|
||||
void (*exit_hw)(struct i2c_client *);
|
||||
|
||||
unsigned int x_max;
|
||||
unsigned int y_max;
|
||||
};
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define INPUT_MT_DIRECT 0x0002 /* direct device, e.g. touchscreen */
|
||||
#define INPUT_MT_DROP_UNUSED 0x0004 /* drop contacts not seen in frame */
|
||||
#define INPUT_MT_TRACK 0x0008 /* use in-kernel tracking */
|
||||
#define INPUT_MT_SEMI_MT 0x0010 /* semi-mt device, finger count handled manually */
|
||||
|
||||
/**
|
||||
* struct input_mt_slot - represents the state of an input MT slot
|
||||
|
13
include/linux/platform_data/st1232_pdata.h
Normal file
13
include/linux/platform_data/st1232_pdata.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef _LINUX_ST1232_PDATA_H
|
||||
#define _LINUX_ST1232_PDATA_H
|
||||
|
||||
/*
|
||||
* Optional platform data
|
||||
*
|
||||
* Use this if you want the driver to drive the reset pin.
|
||||
*/
|
||||
struct st1232_pdata {
|
||||
int reset_gpio;
|
||||
};
|
||||
|
||||
#endif
|
@ -702,6 +702,11 @@ struct input_keymap_entry {
|
||||
#define KEY_CAMERA_LEFT 0x219
|
||||
#define KEY_CAMERA_RIGHT 0x21a
|
||||
|
||||
#define KEY_ATTENDANT_ON 0x21b
|
||||
#define KEY_ATTENDANT_OFF 0x21c
|
||||
#define KEY_ATTENDANT_TOGGLE 0x21d /* Attendant call on or off */
|
||||
#define KEY_LIGHTS_TOGGLE 0x21e /* Reading light on or off */
|
||||
|
||||
#define BTN_TRIGGER_HAPPY 0x2c0
|
||||
#define BTN_TRIGGER_HAPPY1 0x2c0
|
||||
#define BTN_TRIGGER_HAPPY2 0x2c1
|
||||
|
Loading…
Reference in New Issue
Block a user