Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+68 -34
+2
drivers/input/joystick/xpad.c
··· 334 334 { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, 335 335 { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, 336 336 { 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, 337 + { 0x3285, 0x0607, "Nacon GC-100", 0, XTYPE_XBOX360 }, 337 338 { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX }, 338 339 { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, 339 340 { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } ··· 452 451 XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ 453 452 XPAD_XBOXONE_VENDOR(0x2e24), /* Hyperkin Duke X-Box One pad */ 454 453 XPAD_XBOX360_VENDOR(0x2f24), /* GameSir Controllers */ 454 + XPAD_XBOX360_VENDOR(0x3285), /* Nacon GC-100 */ 455 455 { } 456 456 }; 457 457
+29
drivers/input/keyboard/snvs_pwrkey.c
··· 3 3 // Driver for the IMX SNVS ON/OFF Power Key 4 4 // Copyright (C) 2015 Freescale Semiconductor, Inc. All Rights Reserved. 5 5 6 + #include <linux/clk.h> 6 7 #include <linux/device.h> 7 8 #include <linux/err.h> 8 9 #include <linux/init.h> ··· 100 99 return IRQ_HANDLED; 101 100 } 102 101 102 + static void imx_snvs_pwrkey_disable_clk(void *data) 103 + { 104 + clk_disable_unprepare(data); 105 + } 106 + 103 107 static void imx_snvs_pwrkey_act(void *pdata) 104 108 { 105 109 struct pwrkey_drv_data *pd = pdata; ··· 117 111 struct pwrkey_drv_data *pdata; 118 112 struct input_dev *input; 119 113 struct device_node *np; 114 + struct clk *clk; 120 115 int error; 121 116 u32 vid; 122 117 ··· 139 132 if (of_property_read_u32(np, "linux,keycode", &pdata->keycode)) { 140 133 pdata->keycode = KEY_POWER; 141 134 dev_warn(&pdev->dev, "KEY_POWER without setting in dts\n"); 135 + } 136 + 137 + clk = devm_clk_get_optional(&pdev->dev, NULL); 138 + if (IS_ERR(clk)) { 139 + dev_err(&pdev->dev, "Failed to get snvs clock (%pe)\n", clk); 140 + return PTR_ERR(clk); 141 + } 142 + 143 + error = clk_prepare_enable(clk); 144 + if (error) { 145 + dev_err(&pdev->dev, "Failed to enable snvs clock (%pe)\n", 146 + ERR_PTR(error)); 147 + return error; 148 + } 149 + 150 + error = devm_add_action_or_reset(&pdev->dev, 151 + imx_snvs_pwrkey_disable_clk, clk); 152 + if (error) { 153 + dev_err(&pdev->dev, 154 + "Failed to register clock cleanup handler (%pe)\n", 155 + ERR_PTR(error)); 156 + return error; 142 157 } 143 158 144 159 pdata->wakeup = of_property_read_bool(np, "wakeup-source");
+21 -21
drivers/input/touchscreen.c
··· 80 80 81 81 data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-x", 82 82 input_abs_get_min(input, axis_x), 83 - &minimum) | 84 - touchscreen_get_prop_u32(dev, "touchscreen-size-x", 85 - input_abs_get_max(input, 86 - axis_x) + 1, 87 - &maximum) | 88 - touchscreen_get_prop_u32(dev, "touchscreen-fuzz-x", 89 - input_abs_get_fuzz(input, axis_x), 90 - &fuzz); 83 + &minimum); 84 + data_present |= touchscreen_get_prop_u32(dev, "touchscreen-size-x", 85 + input_abs_get_max(input, 86 + axis_x) + 1, 87 + &maximum); 88 + data_present |= touchscreen_get_prop_u32(dev, "touchscreen-fuzz-x", 89 + input_abs_get_fuzz(input, axis_x), 90 + &fuzz); 91 91 if (data_present) 92 92 touchscreen_set_params(input, axis_x, minimum, maximum - 1, fuzz); 93 93 94 94 data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-y", 95 95 input_abs_get_min(input, axis_y), 96 - &minimum) | 97 - touchscreen_get_prop_u32(dev, "touchscreen-size-y", 98 - input_abs_get_max(input, 99 - axis_y) + 1, 100 - &maximum) | 101 - touchscreen_get_prop_u32(dev, "touchscreen-fuzz-y", 102 - input_abs_get_fuzz(input, axis_y), 103 - &fuzz); 96 + &minimum); 97 + data_present |= touchscreen_get_prop_u32(dev, "touchscreen-size-y", 98 + input_abs_get_max(input, 99 + axis_y) + 1, 100 + &maximum); 101 + data_present |= touchscreen_get_prop_u32(dev, "touchscreen-fuzz-y", 102 + input_abs_get_fuzz(input, axis_y), 103 + &fuzz); 104 104 if (data_present) 105 105 touchscreen_set_params(input, axis_y, minimum, maximum - 1, fuzz); 106 106 ··· 108 108 data_present = touchscreen_get_prop_u32(dev, 109 109 "touchscreen-max-pressure", 110 110 input_abs_get_max(input, axis), 111 - &maximum) | 112 - touchscreen_get_prop_u32(dev, 113 - "touchscreen-fuzz-pressure", 114 - input_abs_get_fuzz(input, axis), 115 - &fuzz); 111 + &maximum); 112 + data_present |= touchscreen_get_prop_u32(dev, 113 + "touchscreen-fuzz-pressure", 114 + input_abs_get_fuzz(input, axis), 115 + &fuzz); 116 116 if (data_present) 117 117 touchscreen_set_params(input, axis, 0, maximum, fuzz); 118 118
+16 -13
drivers/input/touchscreen/resistive-adc-touch.c
··· 71 71 unsigned int z2 = touch_info[st->ch_map[GRTS_CH_Z2]]; 72 72 unsigned int Rt; 73 73 74 - Rt = z2; 75 - Rt -= z1; 76 - Rt *= st->x_plate_ohms; 77 - Rt = DIV_ROUND_CLOSEST(Rt, 16); 78 - Rt *= x; 79 - Rt /= z1; 80 - Rt = DIV_ROUND_CLOSEST(Rt, 256); 81 - /* 82 - * On increased pressure the resistance (Rt) is decreasing 83 - * so, convert values to make it looks as real pressure. 84 - */ 85 - if (Rt < GRTS_DEFAULT_PRESSURE_MAX) 86 - press = GRTS_DEFAULT_PRESSURE_MAX - Rt; 74 + if (likely(x && z1)) { 75 + Rt = z2; 76 + Rt -= z1; 77 + Rt *= st->x_plate_ohms; 78 + Rt = DIV_ROUND_CLOSEST(Rt, 16); 79 + Rt *= x; 80 + Rt /= z1; 81 + Rt = DIV_ROUND_CLOSEST(Rt, 256); 82 + /* 83 + * On increased pressure the resistance (Rt) is 84 + * decreasing so, convert values to make it looks as 85 + * real pressure. 86 + */ 87 + if (Rt < GRTS_DEFAULT_PRESSURE_MAX) 88 + press = GRTS_DEFAULT_PRESSURE_MAX - Rt; 89 + } 87 90 } 88 91 89 92 if ((!x && !y) || (st->pressure && (press < st->pressure_min))) {