Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8554cc18 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* '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
parents 051732bc 9eff794b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ struct analog_port {
#include <linux/i8253.h>

#define GET_TIME(x)	do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0)
#define DELTA(x,y)	(cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? CLOCK_TICK_RATE / HZ : 0)))
#define DELTA(x,y)	(cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? PIT_TICK_RATE / HZ : 0)))
#define TIME_NAME	(cpu_has_tsc?"TSC":"PIT")
static unsigned int get_time_pit(void)
{
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
 * flag.
 */

#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/clk.h>
+1 −1
Original line number Diff line number Diff line
@@ -702,7 +702,7 @@ static int __devinit tegra_kbc_probe(struct platform_device *pdev)
err_free_mem_region:
	release_mem_region(res->start, resource_size(res));
err_free_mem:
	input_free_device(kbc->idev);
	input_free_device(input_dev);
	kfree(kbc);

	return err;
+38 −43
Original line number Diff line number Diff line
/*
 * AD714X CapTouch Programmable Controller driver (I2C bus)
 *
 * Copyright 2009 Analog Devices Inc.
 * Copyright 2009-2011 Analog Devices Inc.
 *
 * Licensed under the GPL-2 or later.
 */
@@ -27,54 +27,49 @@ static int ad714x_i2c_resume(struct device *dev)

static SIMPLE_DEV_PM_OPS(ad714x_i2c_pm, ad714x_i2c_suspend, ad714x_i2c_resume);

static int ad714x_i2c_write(struct device *dev, unsigned short reg,
				unsigned short data)
static int ad714x_i2c_write(struct ad714x_chip *chip,
			    unsigned short reg, unsigned short data)
{
	struct i2c_client *client = to_i2c_client(dev);
	int ret = 0;
	u8 *_reg = (u8 *)&reg;
	u8 *_data = (u8 *)&data;

	u8 tx[4] = {
		_reg[1],
		_reg[0],
		_data[1],
		_data[0]
	};
	struct i2c_client *client = to_i2c_client(chip->dev);
	int error;

	chip->xfer_buf[0] = cpu_to_be16(reg);
	chip->xfer_buf[1] = cpu_to_be16(data);

	ret = i2c_master_send(client, tx, 4);
	if (ret < 0)
		dev_err(&client->dev, "I2C write error\n");
	error = i2c_master_send(client, (u8 *)chip->xfer_buf,
				2 * sizeof(*chip->xfer_buf));
	if (unlikely(error < 0)) {
		dev_err(&client->dev, "I2C write error: %d\n", error);
		return error;
	}

	return ret;
	return 0;
}

static int ad714x_i2c_read(struct device *dev, unsigned short reg,
				unsigned short *data)
static int ad714x_i2c_read(struct ad714x_chip *chip,
			   unsigned short reg, unsigned short *data, size_t len)
{
	struct i2c_client *client = to_i2c_client(dev);
	int ret = 0;
	u8 *_reg = (u8 *)&reg;
	u8 *_data = (u8 *)data;

	u8 tx[2] = {
		_reg[1],
		_reg[0]
	};
	u8 rx[2];
	struct i2c_client *client = to_i2c_client(chip->dev);
	int i;
	int error;

	chip->xfer_buf[0] = cpu_to_be16(reg);

	ret = i2c_master_send(client, tx, 2);
	if (ret >= 0)
		ret = i2c_master_recv(client, rx, 2);
	error = i2c_master_send(client, (u8 *)chip->xfer_buf,
				sizeof(*chip->xfer_buf));
	if (error >= 0)
		error = i2c_master_recv(client, (u8 *)chip->xfer_buf,
					len * sizeof(*chip->xfer_buf));

	if (unlikely(ret < 0)) {
		dev_err(&client->dev, "I2C read error\n");
	} else {
		_data[0] = rx[1];
		_data[1] = rx[0];
	if (unlikely(error < 0)) {
		dev_err(&client->dev, "I2C read error: %d\n", error);
		return error;
	}

	return ret;
	for (i = 0; i < len; i++)
		data[i] = be16_to_cpu(chip->xfer_buf[i]);

	return 0;
}

static int __devinit ad714x_i2c_probe(struct i2c_client *client,
+53 −15
Original line number Diff line number Diff line
/*
 * AD714X CapTouch Programmable Controller driver (SPI bus)
 *
 * Copyright 2009 Analog Devices Inc.
 * Copyright 2009-2011 Analog Devices Inc.
 *
 * Licensed under the GPL-2 or later.
 */

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

static SIMPLE_DEV_PM_OPS(ad714x_spi_pm, ad714x_spi_suspend, ad714x_spi_resume);

static int ad714x_spi_read(struct device *dev, unsigned short reg,
		unsigned short *data)
static int ad714x_spi_read(struct ad714x_chip *chip,
			   unsigned short reg, unsigned short *data, size_t len)
{
	struct spi_device *spi = to_spi_device(dev);
	unsigned short tx = AD714x_SPI_CMD_PREFIX | AD714x_SPI_READ | reg;
	struct spi_device *spi = to_spi_device(chip->dev);
	struct spi_message message;
	struct spi_transfer xfer[2];
	int i;
	int error;

	spi_message_init(&message);
	memset(xfer, 0, sizeof(xfer));

	chip->xfer_buf[0] = cpu_to_be16(AD714x_SPI_CMD_PREFIX |
					AD714x_SPI_READ | reg);
	xfer[0].tx_buf = &chip->xfer_buf[0];
	xfer[0].len = sizeof(chip->xfer_buf[0]);
	spi_message_add_tail(&xfer[0], &message);

	xfer[1].rx_buf = &chip->xfer_buf[1];
	xfer[1].len = sizeof(chip->xfer_buf[1]) * len;
	spi_message_add_tail(&xfer[1], &message);

	error = spi_sync(spi, &message);
	if (unlikely(error)) {
		dev_err(chip->dev, "SPI read error: %d\n", error);
		return error;
	}

	for (i = 0; i < len; i++)
		data[i] = be16_to_cpu(chip->xfer_buf[i + 1]);

	return spi_write_then_read(spi, (u8 *)&tx, 2, (u8 *)data, 2);
	return 0;
}

static int ad714x_spi_write(struct device *dev, unsigned short reg,
		unsigned short data)
static int ad714x_spi_write(struct ad714x_chip *chip,
			    unsigned short reg, unsigned short data)
{
	struct spi_device *spi = to_spi_device(dev);
	unsigned short tx[2] = {
		AD714x_SPI_CMD_PREFIX | reg,
		data
	};
	struct spi_device *spi = to_spi_device(chip->dev);
	int error;

	chip->xfer_buf[0] = cpu_to_be16(AD714x_SPI_CMD_PREFIX | reg);
	chip->xfer_buf[1] = cpu_to_be16(data);

	return spi_write(spi, (u8 *)tx, 4);
	error = spi_write(spi, (u8 *)chip->xfer_buf,
			  2 * sizeof(*chip->xfer_buf));
	if (unlikely(error)) {
		dev_err(chip->dev, "SPI write error: %d\n", error);
		return error;
	}

	return 0;
}

static int __devinit ad714x_spi_probe(struct spi_device *spi)
{
	struct ad714x_chip *chip;
	int err;

	spi->bits_per_word = 8;
	err = spi_setup(spi);
	if (err < 0)
		return err;

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