Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/dtor/input

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: add driver for Atmel integrated touchscreen controller
  Input: ads7846 - optimize order of calculating Rt in ads7846_rx()
  Input: ads7846 - fix sparse endian warnings
  Input: uinput - remove duplicate include
  Input: serio - offload resume to kseriod
  Input: serio - mark serio_register_driver() __must_check
  • Loading branch information
Linus Torvalds committed Jul 28, 2008
2 parents 3988ba0 + 72d18a7 commit f934fb1
Show file tree
Hide file tree
Showing 7 changed files with 390 additions and 30 deletions.
1 change: 0 additions & 1 deletion drivers/input/misc/uinput.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/uinput.h>
#include <linux/smp_lock.h>

static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
{
Expand Down
55 changes: 37 additions & 18 deletions drivers/input/serio/serio.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ static LIST_HEAD(serio_list);
static struct bus_type serio_bus;

static void serio_add_port(struct serio *serio);
static void serio_reconnect_port(struct serio *serio);
static int serio_reconnect_port(struct serio *serio);
static void serio_disconnect_port(struct serio *serio);
static void serio_reconnect_chain(struct serio *serio);
static void serio_attach_driver(struct serio_driver *drv);

static int serio_connect_driver(struct serio *serio, struct serio_driver *drv)
Expand Down Expand Up @@ -161,6 +162,7 @@ static void serio_find_driver(struct serio *serio)
enum serio_event_type {
SERIO_RESCAN_PORT,
SERIO_RECONNECT_PORT,
SERIO_RECONNECT_CHAIN,
SERIO_REGISTER_PORT,
SERIO_ATTACH_DRIVER,
};
Expand Down Expand Up @@ -315,6 +317,10 @@ static void serio_handle_event(void)
serio_find_driver(event->object);
break;

case SERIO_RECONNECT_CHAIN:
serio_reconnect_chain(event->object);
break;

case SERIO_ATTACH_DRIVER:
serio_attach_driver(event->object);
break;
Expand Down Expand Up @@ -470,7 +476,7 @@ static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *
if (!strncmp(buf, "none", count)) {
serio_disconnect_port(serio);
} else if (!strncmp(buf, "reconnect", count)) {
serio_reconnect_port(serio);
serio_reconnect_chain(serio);
} else if (!strncmp(buf, "rescan", count)) {
serio_disconnect_port(serio);
serio_find_driver(serio);
Expand Down Expand Up @@ -619,15 +625,31 @@ static void serio_destroy_port(struct serio *serio)
put_device(&serio->dev);
}

/*
* Reconnect serio port (re-initialize attached device).
* If reconnect fails (old device is no longer attached or
* there was no device to begin with) we do full rescan in
* hope of finding a driver for the port.
*/
static int serio_reconnect_port(struct serio *serio)
{
int error = serio_reconnect_driver(serio);

if (error) {
serio_disconnect_port(serio);
serio_find_driver(serio);
}

return error;
}

/*
* Reconnect serio port and all its children (re-initialize attached devices)
*/
static void serio_reconnect_port(struct serio *serio)
static void serio_reconnect_chain(struct serio *serio)
{
do {
if (serio_reconnect_driver(serio)) {
serio_disconnect_port(serio);
serio_find_driver(serio);
if (serio_reconnect_port(serio)) {
/* Ok, old children are now gone, we are done */
break;
}
Expand Down Expand Up @@ -673,7 +695,7 @@ void serio_rescan(struct serio *serio)

void serio_reconnect(struct serio *serio)
{
serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT);
serio_queue_event(serio, NULL, SERIO_RECONNECT_CHAIN);
}

/*
Expand Down Expand Up @@ -927,19 +949,16 @@ static int serio_suspend(struct device *dev, pm_message_t state)

static int serio_resume(struct device *dev)
{
struct serio *serio = to_serio_port(dev);

if (dev->power.power_state.event != PM_EVENT_ON &&
serio_reconnect_driver(serio)) {
/*
* Driver re-probing can take a while, so better let kseriod
* deal with it.
*/
serio_rescan(serio);
/*
* Driver reconnect can take a while, so better let kseriod
* deal with it.
*/
if (dev->power.power_state.event != PM_EVENT_ON) {
dev->power.power_state = PMSG_ON;
serio_queue_event(to_serio_port(dev), NULL,
SERIO_RECONNECT_PORT);
}

dev->power.power_state = PMSG_ON;

return 0;
}
#endif /* CONFIG_PM */
Expand Down
12 changes: 12 additions & 0 deletions drivers/input/touchscreen/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ config TOUCHSCREEN_TOUCHWIN
To compile this driver as a module, choose M here: the
module will be called touchwin.

config TOUCHSCREEN_ATMEL_TSADCC
tristate "Atmel Touchscreen Interface"
depends on ARCH_AT91SAM9RL
help
Say Y here if you have a 4-wire touchscreen connected to the
ADC Controller on your Atmel SoC (such as the AT91SAM9RL).

If unsure, say N.

To compile this driver as a module, choose M here: the
module will be called atmel_tsadcc.

config TOUCHSCREEN_UCB1400
tristate "Philips UCB1400 touchscreen"
select AC97_BUS
Expand Down
1 change: 1 addition & 0 deletions drivers/input/touchscreen/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
wm97xx-ts-y := wm97xx-core.o

obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o
obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) += atmel_tsadcc.o
obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o
obj-$(CONFIG_TOUCHSCREEN_CORGI) += corgi_ts.o
obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o
Expand Down
16 changes: 7 additions & 9 deletions drivers/input/touchscreen/ads7846.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,19 +517,19 @@ static void ads7846_rx(void *ads)
if (x == MAX_12BIT)
x = 0;

if (likely(x && z1)) {
if (ts->model == 7843) {
Rt = ts->pressure_max / 2;
} else if (likely(x && z1)) {
/* compute touch pressure resistance using equation #2 */
Rt = z2;
Rt -= z1;
Rt *= x;
Rt *= ts->x_plate_ohms;
Rt /= z1;
Rt = (Rt + 2047) >> 12;
} else
} else {
Rt = 0;

if (ts->model == 7843)
Rt = ts->pressure_max / 2;
}

/* Sample found inconsistent by debouncing or pressure is beyond
* the maximum. Don't report it to user space, repeat at least
Expand Down Expand Up @@ -633,19 +633,17 @@ static void ads7846_rx_val(void *ads)
struct ads7846 *ts = ads;
struct spi_message *m;
struct spi_transfer *t;
u16 *rx_val;
int val;
int action;
int status;

m = &ts->msg[ts->msg_idx];
t = list_entry(m->transfers.prev, struct spi_transfer, transfer_list);
rx_val = t->rx_buf;

/* adjust: on-wire is a must-ignore bit, a BE12 value, then padding;
* built from two 8 bit values written msb-first.
*/
val = be16_to_cpu(*rx_val) >> 3;
val = be16_to_cpup((__be16 *)t->rx_buf) >> 3;

action = ts->filter(ts->filter_data, ts->msg_idx, &val);
switch (action) {
Expand All @@ -659,7 +657,7 @@ static void ads7846_rx_val(void *ads)
m = ts->last_msg;
break;
case ADS7846_FILTER_OK:
*rx_val = val;
*(u16 *)t->rx_buf = val;
ts->tc.ignore = 0;
m = &ts->msg[++ts->msg_idx];
break;
Expand Down
Loading

0 comments on commit f934fb1

Please sign in to comment.