Merge tag 'v4.8' into next
Sync up with mainline to bring in I2C host notify changes and other updates.
This commit is contained in:
@@ -946,6 +946,12 @@ static const struct input_device_id joydev_ids[] = {
|
||||
.evbit = { BIT_MASK(EV_ABS) },
|
||||
.absbit = { BIT_MASK(ABS_X) },
|
||||
},
|
||||
{
|
||||
.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
|
||||
INPUT_DEVICE_ID_MATCH_ABSBIT,
|
||||
.evbit = { BIT_MASK(EV_ABS) },
|
||||
.absbit = { BIT_MASK(ABS_Z) },
|
||||
},
|
||||
{
|
||||
.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
|
||||
INPUT_DEVICE_ID_MATCH_ABSBIT,
|
||||
|
@@ -143,9 +143,9 @@ struct analog_port {
|
||||
|
||||
#include <linux/i8253.h>
|
||||
|
||||
#define GET_TIME(x) do { if (cpu_has_tsc) x = (unsigned int)rdtsc(); else x = get_time_pit(); } while (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")
|
||||
#define GET_TIME(x) do { if (boot_cpu_has(X86_FEATURE_TSC)) x = (unsigned int)rdtsc(); else x = get_time_pit(); } while (0)
|
||||
#define DELTA(x,y) (boot_cpu_has(X86_FEATURE_TSC) ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? PIT_TICK_RATE / HZ : 0)))
|
||||
#define TIME_NAME (boot_cpu_has(X86_FEATURE_TSC)?"TSC":"PIT")
|
||||
static unsigned int get_time_pit(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
@@ -73,7 +73,7 @@ static int adp5588_write(struct i2c_client *client, u8 reg, u8 val)
|
||||
#ifdef CONFIG_GPIOLIB
|
||||
static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off)
|
||||
{
|
||||
struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc);
|
||||
struct adp5588_kpad *kpad = gpiochip_get_data(chip);
|
||||
unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
|
||||
unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
|
||||
int val;
|
||||
@@ -93,7 +93,7 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off)
|
||||
static void adp5588_gpio_set_value(struct gpio_chip *chip,
|
||||
unsigned off, int val)
|
||||
{
|
||||
struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc);
|
||||
struct adp5588_kpad *kpad = gpiochip_get_data(chip);
|
||||
unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
|
||||
unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
|
||||
|
||||
@@ -112,7 +112,7 @@ static void adp5588_gpio_set_value(struct gpio_chip *chip,
|
||||
|
||||
static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off)
|
||||
{
|
||||
struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc);
|
||||
struct adp5588_kpad *kpad = gpiochip_get_data(chip);
|
||||
unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
|
||||
unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
|
||||
int ret;
|
||||
@@ -130,7 +130,7 @@ static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off)
|
||||
static int adp5588_gpio_direction_output(struct gpio_chip *chip,
|
||||
unsigned off, int val)
|
||||
{
|
||||
struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc);
|
||||
struct adp5588_kpad *kpad = gpiochip_get_data(chip);
|
||||
unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
|
||||
unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
|
||||
int ret;
|
||||
@@ -210,7 +210,7 @@ static int adp5588_gpio_add(struct adp5588_kpad *kpad)
|
||||
|
||||
mutex_init(&kpad->gpio_lock);
|
||||
|
||||
error = gpiochip_add(&kpad->gc);
|
||||
error = gpiochip_add_data(&kpad->gc, kpad);
|
||||
if (error) {
|
||||
dev_err(dev, "gpiochip_add failed, err: %d\n", error);
|
||||
return error;
|
||||
|
@@ -387,7 +387,7 @@ static int adp5589_write(struct i2c_client *client, u8 reg, u8 val)
|
||||
#ifdef CONFIG_GPIOLIB
|
||||
static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off)
|
||||
{
|
||||
struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
|
||||
struct adp5589_kpad *kpad = gpiochip_get_data(chip);
|
||||
unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
|
||||
unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
|
||||
|
||||
@@ -399,7 +399,7 @@ static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off)
|
||||
static void adp5589_gpio_set_value(struct gpio_chip *chip,
|
||||
unsigned off, int val)
|
||||
{
|
||||
struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
|
||||
struct adp5589_kpad *kpad = gpiochip_get_data(chip);
|
||||
unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
|
||||
unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
|
||||
|
||||
@@ -418,7 +418,7 @@ static void adp5589_gpio_set_value(struct gpio_chip *chip,
|
||||
|
||||
static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off)
|
||||
{
|
||||
struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
|
||||
struct adp5589_kpad *kpad = gpiochip_get_data(chip);
|
||||
unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
|
||||
unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
|
||||
int ret;
|
||||
@@ -438,7 +438,7 @@ static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off)
|
||||
static int adp5589_gpio_direction_output(struct gpio_chip *chip,
|
||||
unsigned off, int val)
|
||||
{
|
||||
struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
|
||||
struct adp5589_kpad *kpad = gpiochip_get_data(chip);
|
||||
unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
|
||||
unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
|
||||
int ret;
|
||||
@@ -525,9 +525,9 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad)
|
||||
|
||||
mutex_init(&kpad->gpio_lock);
|
||||
|
||||
error = gpiochip_add(&kpad->gc);
|
||||
error = gpiochip_add_data(&kpad->gc, kpad);
|
||||
if (error) {
|
||||
dev_err(dev, "gpiochip_add failed, err: %d\n", error);
|
||||
dev_err(dev, "gpiochip_add_data() failed, err: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@@ -101,7 +101,7 @@ static int clps711x_keypad_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
priv->syscon =
|
||||
syscon_regmap_lookup_by_compatible("cirrus,clps711x-syscon1");
|
||||
syscon_regmap_lookup_by_compatible("cirrus,ep7209-syscon1");
|
||||
if (IS_ERR(priv->syscon))
|
||||
return PTR_ERR(priv->syscon);
|
||||
|
||||
@@ -181,7 +181,7 @@ static int clps711x_keypad_remove(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
static const struct of_device_id clps711x_keypad_of_match[] = {
|
||||
{ .compatible = "cirrus,clps711x-keypad", },
|
||||
{ .compatible = "cirrus,ep7209-keypad", },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, clps711x_keypad_of_match);
|
||||
|
@@ -376,7 +376,7 @@ static int tegra_kbc_start(struct tegra_kbc *kbc)
|
||||
/* Reset the KBC controller to clear all previous status.*/
|
||||
reset_control_assert(kbc->rst);
|
||||
udelay(100);
|
||||
reset_control_assert(kbc->rst);
|
||||
reset_control_deassert(kbc->rst);
|
||||
udelay(100);
|
||||
|
||||
tegra_kbc_config_pins(kbc);
|
||||
|
@@ -70,10 +70,13 @@ struct max77693_haptic {
|
||||
|
||||
static int max77693_haptic_set_duty_cycle(struct max77693_haptic *haptic)
|
||||
{
|
||||
int delta = (haptic->pwm_dev->period + haptic->pwm_duty) / 2;
|
||||
struct pwm_args pargs;
|
||||
int delta;
|
||||
int error;
|
||||
|
||||
error = pwm_config(haptic->pwm_dev, delta, haptic->pwm_dev->period);
|
||||
pwm_get_args(haptic->pwm_dev, &pargs);
|
||||
delta = (pargs.period + haptic->pwm_duty) / 2;
|
||||
error = pwm_config(haptic->pwm_dev, delta, pargs.period);
|
||||
if (error) {
|
||||
dev_err(haptic->dev, "failed to configure pwm: %d\n", error);
|
||||
return error;
|
||||
@@ -234,6 +237,7 @@ static int max77693_haptic_play_effect(struct input_dev *dev, void *data,
|
||||
struct ff_effect *effect)
|
||||
{
|
||||
struct max77693_haptic *haptic = input_get_drvdata(dev);
|
||||
struct pwm_args pargs;
|
||||
u64 period_mag_multi;
|
||||
|
||||
haptic->magnitude = effect->u.rumble.strong_magnitude;
|
||||
@@ -245,7 +249,8 @@ static int max77693_haptic_play_effect(struct input_dev *dev, void *data,
|
||||
* The formula to convert magnitude to pwm_duty as follows:
|
||||
* - pwm_duty = (magnitude * pwm_period) / MAX_MAGNITUDE(0xFFFF)
|
||||
*/
|
||||
period_mag_multi = (u64)haptic->pwm_dev->period * haptic->magnitude;
|
||||
pwm_get_args(haptic->pwm_dev, &pargs);
|
||||
period_mag_multi = (u64)pargs.period * haptic->magnitude;
|
||||
haptic->pwm_duty = (unsigned int)(period_mag_multi >>
|
||||
MAX_MAGNITUDE_SHIFT);
|
||||
|
||||
@@ -329,6 +334,12 @@ static int max77693_haptic_probe(struct platform_device *pdev)
|
||||
return PTR_ERR(haptic->pwm_dev);
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME: pwm_apply_args() should be removed when switching to the
|
||||
* atomic PWM API.
|
||||
*/
|
||||
pwm_apply_args(haptic->pwm_dev);
|
||||
|
||||
haptic->motor_reg = devm_regulator_get(&pdev->dev, "haptic");
|
||||
if (IS_ERR(haptic->motor_reg)) {
|
||||
dev_err(&pdev->dev, "failed to get regulator\n");
|
||||
|
@@ -306,6 +306,12 @@ static int max8997_haptic_probe(struct platform_device *pdev)
|
||||
error);
|
||||
goto err_free_mem;
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME: pwm_apply_args() should be removed when switching to
|
||||
* the atomic PWM API.
|
||||
*/
|
||||
pwm_apply_args(chip->pwm);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@@ -115,6 +115,12 @@ static int pwm_beeper_probe(struct platform_device *pdev)
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME: pwm_apply_args() should be removed when switching to
|
||||
* the atomic PWM API.
|
||||
*/
|
||||
pwm_apply_args(beeper->pwm);
|
||||
|
||||
INIT_WORK(&beeper->work, pwm_beeper_work);
|
||||
|
||||
beeper->input = input_allocate_device();
|
||||
|
@@ -553,7 +553,6 @@ int rmi_read_register_desc(struct rmi_device *d, u16 addr,
|
||||
goto free_struct_buff;
|
||||
|
||||
reg = find_first_bit(rdesc->presense_map, RMI_REG_DESC_PRESENSE_BITS);
|
||||
map_offset = 0;
|
||||
for (i = 0; i < rdesc->num_registers; i++) {
|
||||
struct rmi_register_desc_item *item = &rdesc->registers[i];
|
||||
int reg_size = struct_buf[offset];
|
||||
@@ -576,6 +575,8 @@ int rmi_read_register_desc(struct rmi_device *d, u16 addr,
|
||||
item->reg = reg;
|
||||
item->reg_size = reg_size;
|
||||
|
||||
map_offset = 0;
|
||||
|
||||
do {
|
||||
for (b = 0; b < 7; b++) {
|
||||
if (struct_buf[offset] & (0x1 << b))
|
||||
|
@@ -65,7 +65,7 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12)
|
||||
struct rmi_device *rmi_dev = fn->rmi_dev;
|
||||
int ret;
|
||||
int offset;
|
||||
u8 buf[14];
|
||||
u8 buf[15];
|
||||
int pitch_x = 0;
|
||||
int pitch_y = 0;
|
||||
int clip_x_low = 0;
|
||||
@@ -85,9 +85,10 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12)
|
||||
|
||||
offset = rmi_register_desc_calc_reg_offset(&f12->control_reg_desc, 8);
|
||||
|
||||
if (item->reg_size > 14) {
|
||||
dev_err(&fn->dev, "F12 control8 should be 14 bytes, not: %ld\n",
|
||||
item->reg_size);
|
||||
if (item->reg_size > sizeof(buf)) {
|
||||
dev_err(&fn->dev,
|
||||
"F12 control8 should be no bigger than %zd bytes, not: %ld\n",
|
||||
sizeof(buf), item->reg_size);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
@@ -1338,6 +1338,7 @@ static int __init i8042_create_aux_port(int idx)
|
||||
serio->write = i8042_aux_write;
|
||||
serio->start = i8042_start;
|
||||
serio->stop = i8042_stop;
|
||||
serio->ps2_cmd_mutex = &i8042_mutex;
|
||||
serio->port_data = port;
|
||||
serio->dev.parent = &i8042_platform_device->dev;
|
||||
if (idx < 0) {
|
||||
|
@@ -1073,6 +1073,7 @@ config TOUCHSCREEN_SILEAD
|
||||
config TOUCHSCREEN_SIS_I2C
|
||||
tristate "SiS 9200 family I2C touchscreen"
|
||||
depends on I2C
|
||||
select CRC_ITU_T
|
||||
depends on GPIOLIB || COMPILE_TEST
|
||||
help
|
||||
This enables support for SiS 9200 family over I2C based touchscreens.
|
||||
|
@@ -379,7 +379,7 @@ static const struct attribute_group ad7879_attr_group = {
|
||||
static int ad7879_gpio_direction_input(struct gpio_chip *chip,
|
||||
unsigned gpio)
|
||||
{
|
||||
struct ad7879 *ts = container_of(chip, struct ad7879, gc);
|
||||
struct ad7879 *ts = gpiochip_get_data(chip);
|
||||
int err;
|
||||
|
||||
mutex_lock(&ts->mutex);
|
||||
@@ -393,7 +393,7 @@ static int ad7879_gpio_direction_input(struct gpio_chip *chip,
|
||||
static int ad7879_gpio_direction_output(struct gpio_chip *chip,
|
||||
unsigned gpio, int level)
|
||||
{
|
||||
struct ad7879 *ts = container_of(chip, struct ad7879, gc);
|
||||
struct ad7879 *ts = gpiochip_get_data(chip);
|
||||
int err;
|
||||
|
||||
mutex_lock(&ts->mutex);
|
||||
@@ -412,7 +412,7 @@ static int ad7879_gpio_direction_output(struct gpio_chip *chip,
|
||||
|
||||
static int ad7879_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
|
||||
{
|
||||
struct ad7879 *ts = container_of(chip, struct ad7879, gc);
|
||||
struct ad7879 *ts = gpiochip_get_data(chip);
|
||||
u16 val;
|
||||
|
||||
mutex_lock(&ts->mutex);
|
||||
@@ -425,7 +425,7 @@ static int ad7879_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
|
||||
static void ad7879_gpio_set_value(struct gpio_chip *chip,
|
||||
unsigned gpio, int value)
|
||||
{
|
||||
struct ad7879 *ts = container_of(chip, struct ad7879, gc);
|
||||
struct ad7879 *ts = gpiochip_get_data(chip);
|
||||
|
||||
mutex_lock(&ts->mutex);
|
||||
if (value)
|
||||
@@ -456,7 +456,7 @@ static int ad7879_gpio_add(struct ad7879 *ts,
|
||||
ts->gc.owner = THIS_MODULE;
|
||||
ts->gc.parent = ts->dev;
|
||||
|
||||
ret = gpiochip_add(&ts->gc);
|
||||
ret = gpiochip_add_data(&ts->gc, ts);
|
||||
if (ret)
|
||||
dev_err(ts->dev, "failed to register gpio %d\n",
|
||||
ts->gc.base);
|
||||
|
@@ -1473,7 +1473,6 @@ static int ads7846_remove(struct spi_device *spi)
|
||||
|
||||
ads784x_hwmon_unregister(spi, ts);
|
||||
|
||||
regulator_disable(ts->reg);
|
||||
regulator_put(ts->reg);
|
||||
|
||||
if (!ts->get_pendown_state) {
|
||||
|
@@ -1499,7 +1499,7 @@ static int cyttsp4_core_sleep_(struct cyttsp4 *cd)
|
||||
|
||||
if (IS_BOOTLOADER(mode[0], mode[1])) {
|
||||
mutex_unlock(&cd->system_lock);
|
||||
dev_err(cd->dev, "%s: Device in BOOTLADER mode.\n", __func__);
|
||||
dev_err(cd->dev, "%s: Device in BOOTLOADER mode.\n", __func__);
|
||||
rc = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
|
@@ -147,9 +147,6 @@ static void silead_ts_read_data(struct i2c_client *client)
|
||||
}
|
||||
|
||||
touch_nr = buf[0];
|
||||
if (touch_nr < 0)
|
||||
return;
|
||||
|
||||
if (touch_nr > data->max_fingers) {
|
||||
dev_warn(dev, "More touches reported then supported %d > %d\n",
|
||||
touch_nr, data->max_fingers);
|
||||
@@ -393,9 +390,10 @@ static void silead_ts_read_props(struct i2c_client *client)
|
||||
data->max_fingers = 5; /* Most devices handle up-to 5 fingers */
|
||||
}
|
||||
|
||||
error = device_property_read_string(dev, "touchscreen-fw-name", &str);
|
||||
error = device_property_read_string(dev, "firmware-name", &str);
|
||||
if (!error)
|
||||
snprintf(data->fw_name, sizeof(data->fw_name), "%s", str);
|
||||
snprintf(data->fw_name, sizeof(data->fw_name),
|
||||
"silead/%s", str);
|
||||
else
|
||||
dev_dbg(dev, "Firmware file name read error. Using default.");
|
||||
}
|
||||
@@ -413,14 +411,14 @@ static int silead_ts_set_default_fw_name(struct silead_ts_data *data,
|
||||
if (!acpi_id)
|
||||
return -ENODEV;
|
||||
|
||||
snprintf(data->fw_name, sizeof(data->fw_name), "%s.fw",
|
||||
acpi_id->id);
|
||||
snprintf(data->fw_name, sizeof(data->fw_name),
|
||||
"silead/%s.fw", acpi_id->id);
|
||||
|
||||
for (i = 0; i < strlen(data->fw_name); i++)
|
||||
data->fw_name[i] = tolower(data->fw_name[i]);
|
||||
} else {
|
||||
snprintf(data->fw_name, sizeof(data->fw_name), "%s.fw",
|
||||
id->name);
|
||||
snprintf(data->fw_name, sizeof(data->fw_name),
|
||||
"silead/%s.fw", id->name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -429,7 +427,8 @@ static int silead_ts_set_default_fw_name(struct silead_ts_data *data,
|
||||
static int silead_ts_set_default_fw_name(struct silead_ts_data *data,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
snprintf(data->fw_name, sizeof(data->fw_name), "%s.fw", id->name);
|
||||
snprintf(data->fw_name, sizeof(data->fw_name),
|
||||
"silead/%s.fw", id->name);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -467,7 +466,7 @@ static int silead_ts_probe(struct i2c_client *client,
|
||||
return -ENODEV;
|
||||
|
||||
/* Power GPIO pin */
|
||||
data->gpio_power = gpiod_get_optional(dev, "power", GPIOD_OUT_LOW);
|
||||
data->gpio_power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW);
|
||||
if (IS_ERR(data->gpio_power)) {
|
||||
if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER)
|
||||
dev_err(dev, "Shutdown GPIO request failed\n");
|
||||
|
@@ -115,7 +115,6 @@
|
||||
struct sun4i_ts_data {
|
||||
struct device *dev;
|
||||
struct input_dev *input;
|
||||
struct thermal_zone_device *tz;
|
||||
void __iomem *base;
|
||||
unsigned int irq;
|
||||
bool ignore_fifo_data;
|
||||
@@ -366,10 +365,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(hwmon))
|
||||
return PTR_ERR(hwmon);
|
||||
|
||||
ts->tz = thermal_zone_of_sensor_register(ts->dev, 0, ts,
|
||||
&sun4i_ts_tz_ops);
|
||||
if (IS_ERR(ts->tz))
|
||||
ts->tz = NULL;
|
||||
devm_thermal_zone_of_sensor_register(ts->dev, 0, ts, &sun4i_ts_tz_ops);
|
||||
|
||||
writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
|
||||
|
||||
@@ -377,7 +373,6 @@ static int sun4i_ts_probe(struct platform_device *pdev)
|
||||
error = input_register_device(ts->input);
|
||||
if (error) {
|
||||
writel(0, ts->base + TP_INT_FIFOC);
|
||||
thermal_zone_of_sensor_unregister(ts->dev, ts->tz);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
@@ -394,8 +389,6 @@ static int sun4i_ts_remove(struct platform_device *pdev)
|
||||
if (ts->input)
|
||||
input_unregister_device(ts->input);
|
||||
|
||||
thermal_zone_of_sensor_unregister(ts->dev, ts->tz);
|
||||
|
||||
/* Deactivate all IRQs */
|
||||
writel(0, ts->base + TP_INT_FIFOC);
|
||||
|
||||
|
@@ -126,7 +126,7 @@ struct sur40_image_header {
|
||||
#define VIDEO_PACKET_SIZE 16384
|
||||
|
||||
/* polling interval (ms) */
|
||||
#define POLL_INTERVAL 4
|
||||
#define POLL_INTERVAL 1
|
||||
|
||||
/* maximum number of contacts FIXME: this is a guess? */
|
||||
#define MAX_CONTACTS 64
|
||||
@@ -151,7 +151,6 @@ struct sur40_state {
|
||||
struct mutex lock;
|
||||
|
||||
struct vb2_queue queue;
|
||||
struct vb2_alloc_ctx *alloc_ctx;
|
||||
struct list_head buf_list;
|
||||
spinlock_t qlock;
|
||||
int sequence;
|
||||
@@ -448,7 +447,7 @@ static void sur40_process_video(struct sur40_state *sur40)
|
||||
|
||||
/* return error if streaming was stopped in the meantime */
|
||||
if (sur40->sequence == -1)
|
||||
goto err_poll;
|
||||
return;
|
||||
|
||||
/* mark as finished */
|
||||
new_buf->vb.vb2_buf.timestamp = ktime_get_ns();
|
||||
@@ -580,19 +579,13 @@ static int sur40_probe(struct usb_interface *interface,
|
||||
sur40->queue = sur40_queue;
|
||||
sur40->queue.drv_priv = sur40;
|
||||
sur40->queue.lock = &sur40->lock;
|
||||
sur40->queue.dev = sur40->dev;
|
||||
|
||||
/* initialize the queue */
|
||||
error = vb2_queue_init(&sur40->queue);
|
||||
if (error)
|
||||
goto err_unreg_v4l2;
|
||||
|
||||
sur40->alloc_ctx = vb2_dma_sg_init_ctx(sur40->dev);
|
||||
if (IS_ERR(sur40->alloc_ctx)) {
|
||||
dev_err(sur40->dev, "Can't allocate buffer context");
|
||||
error = PTR_ERR(sur40->alloc_ctx);
|
||||
goto err_unreg_v4l2;
|
||||
}
|
||||
|
||||
sur40->vdev = sur40_video_device;
|
||||
sur40->vdev.v4l2_dev = &sur40->v4l2;
|
||||
sur40->vdev.lock = &sur40->lock;
|
||||
@@ -633,7 +626,6 @@ static void sur40_disconnect(struct usb_interface *interface)
|
||||
|
||||
video_unregister_device(&sur40->vdev);
|
||||
v4l2_device_unregister(&sur40->v4l2);
|
||||
vb2_dma_sg_cleanup_ctx(sur40->alloc_ctx);
|
||||
|
||||
input_unregister_polled_device(sur40->input);
|
||||
input_free_polled_device(sur40->input);
|
||||
@@ -653,13 +645,10 @@ static void sur40_disconnect(struct usb_interface *interface)
|
||||
*/
|
||||
static int sur40_queue_setup(struct vb2_queue *q,
|
||||
unsigned int *nbuffers, unsigned int *nplanes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
unsigned int sizes[], struct device *alloc_devs[])
|
||||
{
|
||||
struct sur40_state *sur40 = vb2_get_drv_priv(q);
|
||||
|
||||
if (q->num_buffers + *nbuffers < 3)
|
||||
*nbuffers = 3 - q->num_buffers;
|
||||
alloc_ctxs[0] = sur40->alloc_ctx;
|
||||
|
||||
if (*nplanes)
|
||||
return sizes[0] < sur40_video_format.sizeimage ? -EINVAL : 0;
|
||||
@@ -736,6 +725,7 @@ static int sur40_start_streaming(struct vb2_queue *vq, unsigned int count)
|
||||
static void sur40_stop_streaming(struct vb2_queue *vq)
|
||||
{
|
||||
struct sur40_state *sur40 = vb2_get_drv_priv(vq);
|
||||
vb2_wait_for_all_buffers(vq);
|
||||
sur40->sequence = -1;
|
||||
|
||||
/* Release all active buffers */
|
||||
@@ -793,7 +783,6 @@ static int sur40_vidioc_enum_fmt(struct file *file, void *priv,
|
||||
{
|
||||
if (f->index != 0)
|
||||
return -EINVAL;
|
||||
strlcpy(f->description, "8-bit greyscale", sizeof(f->description));
|
||||
f->pixelformat = V4L2_PIX_FMT_GREY;
|
||||
f->flags = 0;
|
||||
return 0;
|
||||
|
@@ -22,6 +22,11 @@
|
||||
#include <linux/regmap.h>
|
||||
#include "tsc200x-core.h"
|
||||
|
||||
static const struct input_id tsc2004_input_id = {
|
||||
.bustype = BUS_I2C,
|
||||
.product = 2004,
|
||||
};
|
||||
|
||||
static int tsc2004_cmd(struct device *dev, u8 cmd)
|
||||
{
|
||||
u8 tx = TSC200X_CMD | TSC200X_CMD_12BIT | cmd;
|
||||
@@ -42,7 +47,7 @@ static int tsc2004_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
|
||||
{
|
||||
return tsc200x_probe(&i2c->dev, i2c->irq, BUS_I2C,
|
||||
return tsc200x_probe(&i2c->dev, i2c->irq, &tsc2004_input_id,
|
||||
devm_regmap_init_i2c(i2c, &tsc200x_regmap_config),
|
||||
tsc2004_cmd);
|
||||
}
|
||||
|
@@ -24,6 +24,11 @@
|
||||
#include <linux/regmap.h>
|
||||
#include "tsc200x-core.h"
|
||||
|
||||
static const struct input_id tsc2005_input_id = {
|
||||
.bustype = BUS_SPI,
|
||||
.product = 2005,
|
||||
};
|
||||
|
||||
static int tsc2005_cmd(struct device *dev, u8 cmd)
|
||||
{
|
||||
u8 tx = TSC200X_CMD | TSC200X_CMD_12BIT | cmd;
|
||||
@@ -62,7 +67,7 @@ static int tsc2005_probe(struct spi_device *spi)
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
return tsc200x_probe(&spi->dev, spi->irq, BUS_SPI,
|
||||
return tsc200x_probe(&spi->dev, spi->irq, &tsc2005_input_id,
|
||||
devm_regmap_init_spi(spi, &tsc200x_regmap_config),
|
||||
tsc2005_cmd);
|
||||
}
|
||||
|
@@ -450,7 +450,7 @@ static void tsc200x_close(struct input_dev *input)
|
||||
mutex_unlock(&ts->mutex);
|
||||
}
|
||||
|
||||
int tsc200x_probe(struct device *dev, int irq, __u16 bustype,
|
||||
int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
|
||||
struct regmap *regmap,
|
||||
int (*tsc200x_cmd)(struct device *dev, u8 cmd))
|
||||
{
|
||||
@@ -547,9 +547,18 @@ int tsc200x_probe(struct device *dev, int irq, __u16 bustype,
|
||||
snprintf(ts->phys, sizeof(ts->phys),
|
||||
"%s/input-ts", dev_name(dev));
|
||||
|
||||
input_dev->name = "TSC200X touchscreen";
|
||||
if (tsc_id->product == 2004) {
|
||||
input_dev->name = "TSC200X touchscreen";
|
||||
} else {
|
||||
input_dev->name = devm_kasprintf(dev, GFP_KERNEL,
|
||||
"TSC%04d touchscreen",
|
||||
tsc_id->product);
|
||||
if (!input_dev->name)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
input_dev->phys = ts->phys;
|
||||
input_dev->id.bustype = bustype;
|
||||
input_dev->id = *tsc_id;
|
||||
input_dev->dev.parent = dev;
|
||||
input_dev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY);
|
||||
input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
|
||||
|
@@ -70,7 +70,7 @@
|
||||
extern const struct regmap_config tsc200x_regmap_config;
|
||||
extern const struct dev_pm_ops tsc200x_pm_ops;
|
||||
|
||||
int tsc200x_probe(struct device *dev, int irq, __u16 bustype,
|
||||
int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
|
||||
struct regmap *regmap,
|
||||
int (*tsc200x_cmd)(struct device *dev, u8 cmd));
|
||||
int tsc200x_remove(struct device *dev);
|
||||
|
Reference in New Issue
Block a user