Skip to content

Commit 8554cc1

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: ad714x - read the interrupt status registers in a row Input: ad714x - use DMA-safe buffers for spi_write() Input: ad714x - fix endianness issues Input: ad714xx-spi - force SPI bus into the default 8-bit mode Input: ep93xx_keypad - add missing include of linux/module.h Input: tnetv107x-ts - add missing include of linux/module.h Input: max11801_ts - correct license statement Input: atmel_mxt_ts - report pressure information from the driver Input: bcm5974 - Add support for newer MacBookPro8,2 Input: wacom - report id 3 returns 4 bytes of data Input: wacom - add WAC_MSG_RETRIES define Input: wacom - add support for the Wacom Bamboo Pen (CTL-660/K) Input: tegra-kbc - correct call to input_free_device Input: mpu3050 - correct call to input_free_device Input: bcm5974 - add support for touchpads found in MacBookAir4,2 Input: mma8450 - fix module device table type Input: remove CLOCK_TICK_RATE from analog joystick driver
2 parents 051732b + 9eff794 commit 8554cc1

15 files changed

Lines changed: 241 additions & 145 deletions

File tree

‎drivers/input/joystick/analog.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ struct analog_port {
139139
#include <linux/i8253.h>
140140

141141
#define GET_TIME(x) do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0)
142-
#define DELTA(x,y) (cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? CLOCK_TICK_RATE / HZ : 0)))
142+
#define DELTA(x,y) (cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? PIT_TICK_RATE / HZ : 0)))
143143
#define TIME_NAME (cpu_has_tsc?"TSC":"PIT")
144144
static unsigned int get_time_pit(void)
145145
{

‎drivers/input/keyboard/ep93xx_keypad.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* flag.
2121
*/
2222

23+
#include <linux/module.h>
2324
#include <linux/platform_device.h>
2425
#include <linux/interrupt.h>
2526
#include <linux/clk.h>

‎drivers/input/keyboard/tegra-kbc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ static int __devinit tegra_kbc_probe(struct platform_device *pdev)
702702
err_free_mem_region:
703703
release_mem_region(res->start, resource_size(res));
704704
err_free_mem:
705-
input_free_device(kbc->idev);
705+
input_free_device(input_dev);
706706
kfree(kbc);
707707

708708
return err;

‎drivers/input/misc/ad714x-i2c.c‎

Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* AD714X CapTouch Programmable Controller driver (I2C bus)
33
*
4-
* Copyright 2009 Analog Devices Inc.
4+
* Copyright 2009-2011 Analog Devices Inc.
55
*
66
* Licensed under the GPL-2 or later.
77
*/
@@ -27,54 +27,49 @@ static int ad714x_i2c_resume(struct device *dev)
2727

2828
static SIMPLE_DEV_PM_OPS(ad714x_i2c_pm, ad714x_i2c_suspend, ad714x_i2c_resume);
2929

30-
static int ad714x_i2c_write(struct device *dev, unsigned short reg,
31-
unsigned short data)
30+
static int ad714x_i2c_write(struct ad714x_chip *chip,
31+
unsigned short reg, unsigned short data)
3232
{
33-
struct i2c_client *client = to_i2c_client(dev);
34-
int ret = 0;
35-
u8 *_reg = (u8 *)&reg;
36-
u8 *_data = (u8 *)&data;
37-
38-
u8 tx[4] = {
39-
_reg[1],
40-
_reg[0],
41-
_data[1],
42-
_data[0]
43-
};
44-
45-
ret = i2c_master_send(client, tx, 4);
46-
if (ret < 0)
47-
dev_err(&client->dev, "I2C write error\n");
48-
49-
return ret;
33+
struct i2c_client *client = to_i2c_client(chip->dev);
34+
int error;
35+
36+
chip->xfer_buf[0] = cpu_to_be16(reg);
37+
chip->xfer_buf[1] = cpu_to_be16(data);
38+
39+
error = i2c_master_send(client, (u8 *)chip->xfer_buf,
40+
2 * sizeof(*chip->xfer_buf));
41+
if (unlikely(error < 0)) {
42+
dev_err(&client->dev, "I2C write error: %d\n", error);
43+
return error;
44+
}
45+
46+
return 0;
5047
}
5148

52-
static int ad714x_i2c_read(struct device *dev, unsigned short reg,
53-
unsigned short *data)
49+
static int ad714x_i2c_read(struct ad714x_chip *chip,
50+
unsigned short reg, unsigned short *data, size_t len)
5451
{
55-
struct i2c_client *client = to_i2c_client(dev);
56-
int ret = 0;
57-
u8 *_reg = (u8 *)&reg;
58-
u8 *_data = (u8 *)data;
59-
60-
u8 tx[2] = {
61-
_reg[1],
62-
_reg[0]
63-
};
64-
u8 rx[2];
65-
66-
ret = i2c_master_send(client, tx, 2);
67-
if (ret >= 0)
68-
ret = i2c_master_recv(client, rx, 2);
69-
70-
if (unlikely(ret < 0)) {
71-
dev_err(&client->dev, "I2C read error\n");
72-
} else {
73-
_data[0] = rx[1];
74-
_data[1] = rx[0];
52+
struct i2c_client *client = to_i2c_client(chip->dev);
53+
int i;
54+
int error;
55+
56+
chip->xfer_buf[0] = cpu_to_be16(reg);
57+
58+
error = i2c_master_send(client, (u8 *)chip->xfer_buf,
59+
sizeof(*chip->xfer_buf));
60+
if (error >= 0)
61+
error = i2c_master_recv(client, (u8 *)chip->xfer_buf,
62+
len * sizeof(*chip->xfer_buf));
63+
64+
if (unlikely(error < 0)) {
65+
dev_err(&client->dev, "I2C read error: %d\n", error);
66+
return error;
7567
}
7668

77-
return ret;
69+
for (i = 0; i < len; i++)
70+
data[i] = be16_to_cpu(chip->xfer_buf[i]);
71+
72+
return 0;
7873
}
7974

8075
static int __devinit ad714x_i2c_probe(struct i2c_client *client,

‎drivers/input/misc/ad714x-spi.c‎

Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
* AD714X CapTouch Programmable Controller driver (SPI bus)
33
*
4-
* Copyright 2009 Analog Devices Inc.
4+
* Copyright 2009-2011 Analog Devices Inc.
55
*
66
* Licensed under the GPL-2 or later.
77
*/
88

9-
#include <linux/input.h> /* BUS_I2C */
9+
#include <linux/input.h> /* BUS_SPI */
1010
#include <linux/module.h>
1111
#include <linux/spi/spi.h>
1212
#include <linux/pm.h>
@@ -30,30 +30,68 @@ static int ad714x_spi_resume(struct device *dev)
3030

3131
static SIMPLE_DEV_PM_OPS(ad714x_spi_pm, ad714x_spi_suspend, ad714x_spi_resume);
3232

33-
static int ad714x_spi_read(struct device *dev, unsigned short reg,
34-
unsigned short *data)
33+
static int ad714x_spi_read(struct ad714x_chip *chip,
34+
unsigned short reg, unsigned short *data, size_t len)
3535
{
36-
struct spi_device *spi = to_spi_device(dev);
37-
unsigned short tx = AD714x_SPI_CMD_PREFIX | AD714x_SPI_READ | reg;
36+
struct spi_device *spi = to_spi_device(chip->dev);
37+
struct spi_message message;
38+
struct spi_transfer xfer[2];
39+
int i;
40+
int error;
41+
42+
spi_message_init(&message);
43+
memset(xfer, 0, sizeof(xfer));
44+
45+
chip->xfer_buf[0] = cpu_to_be16(AD714x_SPI_CMD_PREFIX |
46+
AD714x_SPI_READ | reg);
47+
xfer[0].tx_buf = &chip->xfer_buf[0];
48+
xfer[0].len = sizeof(chip->xfer_buf[0]);
49+
spi_message_add_tail(&xfer[0], &message);
50+
51+
xfer[1].rx_buf = &chip->xfer_buf[1];
52+
xfer[1].len = sizeof(chip->xfer_buf[1]) * len;
53+
spi_message_add_tail(&xfer[1], &message);
54+
55+
error = spi_sync(spi, &message);
56+
if (unlikely(error)) {
57+
dev_err(chip->dev, "SPI read error: %d\n", error);
58+
return error;
59+
}
60+
61+
for (i = 0; i < len; i++)
62+
data[i] = be16_to_cpu(chip->xfer_buf[i + 1]);
3863

39-
return spi_write_then_read(spi, (u8 *)&tx, 2, (u8 *)data, 2);
64+
return 0;
4065
}
4166

42-
static int ad714x_spi_write(struct device *dev, unsigned short reg,
43-
unsigned short data)
67+
static int ad714x_spi_write(struct ad714x_chip *chip,
68+
unsigned short reg, unsigned short data)
4469
{
45-
struct spi_device *spi = to_spi_device(dev);
46-
unsigned short tx[2] = {
47-
AD714x_SPI_CMD_PREFIX | reg,
48-
data
49-
};
70+
struct spi_device *spi = to_spi_device(chip->dev);
71+
int error;
72+
73+
chip->xfer_buf[0] = cpu_to_be16(AD714x_SPI_CMD_PREFIX | reg);
74+
chip->xfer_buf[1] = cpu_to_be16(data);
75+
76+
error = spi_write(spi, (u8 *)chip->xfer_buf,
77+
2 * sizeof(*chip->xfer_buf));
78+
if (unlikely(error)) {
79+
dev_err(chip->dev, "SPI write error: %d\n", error);
80+
return error;
81+
}
5082

51-
return spi_write(spi, (u8 *)tx, 4);
83+
return 0;
5284
}
5385

5486
static int __devinit ad714x_spi_probe(struct spi_device *spi)
5587
{
5688
struct ad714x_chip *chip;
89+
int err;
90+
91+
spi->bits_per_word = 8;
92+
err = spi_setup(spi);
93+
if (err < 0)
94+
return err;
5795

5896
chip = ad714x_probe(&spi->dev, BUS_SPI, spi->irq,
5997
ad714x_spi_read, ad714x_spi_write);

0 commit comments

Comments
 (0)