Commit 12dbbfad authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input fixes from Dmitry Torokhov:

 - a new product ID for the xpad joystick driver

 - fixes to resistive-adc-touch and snvs_pwrkey drivers

 - a change to touchscreen helpers to make clang happier

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: touchscreen - avoid bitwise vs logical OR warning
  Input: xpad - add support for another USB ID of Nacon GC-100
  Input: resistive-adc-touch - fix division by zero error on z1 == 0
  Input: snvs_pwrkey - add clk handling
parents d999ade1 a02dcde5
...@@ -334,6 +334,7 @@ static const struct xpad_device { ...@@ -334,6 +334,7 @@ static const struct xpad_device {
{ 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 },
{ 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 },
{ 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, { 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
{ 0x3285, 0x0607, "Nacon GC-100", 0, XTYPE_XBOX360 },
{ 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX }, { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX },
{ 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX },
{ 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN }
...@@ -451,6 +452,7 @@ static const struct usb_device_id xpad_table[] = { ...@@ -451,6 +452,7 @@ static const struct usb_device_id xpad_table[] = {
XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */
XPAD_XBOXONE_VENDOR(0x2e24), /* Hyperkin Duke X-Box One pad */ XPAD_XBOXONE_VENDOR(0x2e24), /* Hyperkin Duke X-Box One pad */
XPAD_XBOX360_VENDOR(0x2f24), /* GameSir Controllers */ XPAD_XBOX360_VENDOR(0x2f24), /* GameSir Controllers */
XPAD_XBOX360_VENDOR(0x3285), /* Nacon GC-100 */
{ } { }
}; };
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// Driver for the IMX SNVS ON/OFF Power Key // Driver for the IMX SNVS ON/OFF Power Key
// Copyright (C) 2015 Freescale Semiconductor, Inc. All Rights Reserved. // Copyright (C) 2015 Freescale Semiconductor, Inc. All Rights Reserved.
#include <linux/clk.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -99,6 +100,11 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id) ...@@ -99,6 +100,11 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void imx_snvs_pwrkey_disable_clk(void *data)
{
clk_disable_unprepare(data);
}
static void imx_snvs_pwrkey_act(void *pdata) static void imx_snvs_pwrkey_act(void *pdata)
{ {
struct pwrkey_drv_data *pd = pdata; struct pwrkey_drv_data *pd = pdata;
...@@ -111,6 +117,7 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) ...@@ -111,6 +117,7 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
struct pwrkey_drv_data *pdata; struct pwrkey_drv_data *pdata;
struct input_dev *input; struct input_dev *input;
struct device_node *np; struct device_node *np;
struct clk *clk;
int error; int error;
u32 vid; u32 vid;
...@@ -134,6 +141,28 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) ...@@ -134,6 +141,28 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
dev_warn(&pdev->dev, "KEY_POWER without setting in dts\n"); dev_warn(&pdev->dev, "KEY_POWER without setting in dts\n");
} }
clk = devm_clk_get_optional(&pdev->dev, NULL);
if (IS_ERR(clk)) {
dev_err(&pdev->dev, "Failed to get snvs clock (%pe)\n", clk);
return PTR_ERR(clk);
}
error = clk_prepare_enable(clk);
if (error) {
dev_err(&pdev->dev, "Failed to enable snvs clock (%pe)\n",
ERR_PTR(error));
return error;
}
error = devm_add_action_or_reset(&pdev->dev,
imx_snvs_pwrkey_disable_clk, clk);
if (error) {
dev_err(&pdev->dev,
"Failed to register clock cleanup handler (%pe)\n",
ERR_PTR(error));
return error;
}
pdata->wakeup = of_property_read_bool(np, "wakeup-source"); pdata->wakeup = of_property_read_bool(np, "wakeup-source");
pdata->irq = platform_get_irq(pdev, 0); pdata->irq = platform_get_irq(pdev, 0);
......
...@@ -80,27 +80,27 @@ void touchscreen_parse_properties(struct input_dev *input, bool multitouch, ...@@ -80,27 +80,27 @@ void touchscreen_parse_properties(struct input_dev *input, bool multitouch,
data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-x", data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-x",
input_abs_get_min(input, axis_x), input_abs_get_min(input, axis_x),
&minimum) | &minimum);
touchscreen_get_prop_u32(dev, "touchscreen-size-x", data_present |= touchscreen_get_prop_u32(dev, "touchscreen-size-x",
input_abs_get_max(input, input_abs_get_max(input,
axis_x) + 1, axis_x) + 1,
&maximum) | &maximum);
touchscreen_get_prop_u32(dev, "touchscreen-fuzz-x", data_present |= touchscreen_get_prop_u32(dev, "touchscreen-fuzz-x",
input_abs_get_fuzz(input, axis_x), input_abs_get_fuzz(input, axis_x),
&fuzz); &fuzz);
if (data_present) if (data_present)
touchscreen_set_params(input, axis_x, minimum, maximum - 1, fuzz); touchscreen_set_params(input, axis_x, minimum, maximum - 1, fuzz);
data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-y", data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-y",
input_abs_get_min(input, axis_y), input_abs_get_min(input, axis_y),
&minimum) | &minimum);
touchscreen_get_prop_u32(dev, "touchscreen-size-y", data_present |= touchscreen_get_prop_u32(dev, "touchscreen-size-y",
input_abs_get_max(input, input_abs_get_max(input,
axis_y) + 1, axis_y) + 1,
&maximum) | &maximum);
touchscreen_get_prop_u32(dev, "touchscreen-fuzz-y", data_present |= touchscreen_get_prop_u32(dev, "touchscreen-fuzz-y",
input_abs_get_fuzz(input, axis_y), input_abs_get_fuzz(input, axis_y),
&fuzz); &fuzz);
if (data_present) if (data_present)
touchscreen_set_params(input, axis_y, minimum, maximum - 1, fuzz); touchscreen_set_params(input, axis_y, minimum, maximum - 1, fuzz);
...@@ -108,11 +108,11 @@ void touchscreen_parse_properties(struct input_dev *input, bool multitouch, ...@@ -108,11 +108,11 @@ void touchscreen_parse_properties(struct input_dev *input, bool multitouch,
data_present = touchscreen_get_prop_u32(dev, data_present = touchscreen_get_prop_u32(dev,
"touchscreen-max-pressure", "touchscreen-max-pressure",
input_abs_get_max(input, axis), input_abs_get_max(input, axis),
&maximum) | &maximum);
touchscreen_get_prop_u32(dev, data_present |= touchscreen_get_prop_u32(dev,
"touchscreen-fuzz-pressure", "touchscreen-fuzz-pressure",
input_abs_get_fuzz(input, axis), input_abs_get_fuzz(input, axis),
&fuzz); &fuzz);
if (data_present) if (data_present)
touchscreen_set_params(input, axis, 0, maximum, fuzz); touchscreen_set_params(input, axis, 0, maximum, fuzz);
......
...@@ -71,19 +71,22 @@ static int grts_cb(const void *data, void *private) ...@@ -71,19 +71,22 @@ static int grts_cb(const void *data, void *private)
unsigned int z2 = touch_info[st->ch_map[GRTS_CH_Z2]]; unsigned int z2 = touch_info[st->ch_map[GRTS_CH_Z2]];
unsigned int Rt; unsigned int Rt;
Rt = z2; if (likely(x && z1)) {
Rt -= z1; Rt = z2;
Rt *= st->x_plate_ohms; Rt -= z1;
Rt = DIV_ROUND_CLOSEST(Rt, 16); Rt *= st->x_plate_ohms;
Rt *= x; Rt = DIV_ROUND_CLOSEST(Rt, 16);
Rt /= z1; Rt *= x;
Rt = DIV_ROUND_CLOSEST(Rt, 256); Rt /= z1;
/* Rt = DIV_ROUND_CLOSEST(Rt, 256);
* On increased pressure the resistance (Rt) is decreasing /*
* so, convert values to make it looks as real pressure. * On increased pressure the resistance (Rt) is
*/ * decreasing so, convert values to make it looks as
if (Rt < GRTS_DEFAULT_PRESSURE_MAX) * real pressure.
press = GRTS_DEFAULT_PRESSURE_MAX - Rt; */
if (Rt < GRTS_DEFAULT_PRESSURE_MAX)
press = GRTS_DEFAULT_PRESSURE_MAX - Rt;
}
} }
if ((!x && !y) || (st->pressure && (press < st->pressure_min))) { if ((!x && !y) || (st->pressure && (press < st->pressure_min))) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment