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 more input updates from Dmitry Torokhov:
"The second round of updates for the input subsystem.

Updates to ALPS an bfin_roraty drivers and a couple oother fixups"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: psmouse - use IS_ENABLED instead of homegrown code
Input: bfin_rotary - introduce open and close methods
Input: bfin_rotary - convert to use managed resources
Input: bfin_rotary - use generic IO functions
Input: bfin_rotary - move pin lists into into platform data
Input: bfin_rotary - move platform header to linux/platform_data
Input: bfin_rotary - mark suspend and resume code as __maybe_unused
Input: bfin_rotary - fix potential oops in interrupt handler
Input: ALPS - move v7 packet info to Documentation and v6 packet info
Input: ALPS - fix confusing comment in protocol data
Input: ALPS - do not mix trackstick and external PS/2 mouse data
Input: ALPS - fix trackstick detection on some Dell Latitudes
Input: ALPS - consolidate setting protocol parameters
Input: ALPS - split protocol data from model info
Input: ALPS - make Rushmore a separate protocol
Input: ALPS - renumber protocol numbers
Input: adi - remove an unnecessary check
Input: pxa27x_keypad - remove an unneeded NULL check
Input: soc_button_array - use "Windows" key for "Home"

+577 -372
+66 -2
Documentation/input/alps.txt
··· 3 3 4 4 Introduction 5 5 ------------ 6 - Currently the ALPS touchpad driver supports five protocol versions in use by 7 - ALPS touchpads, called versions 1, 2, 3, 4 and 5. 6 + Currently the ALPS touchpad driver supports seven protocol versions in use by 7 + ALPS touchpads, called versions 1, 2, 3, 4, 5, 6 and 7. 8 8 9 9 Since roughly mid-2010 several new ALPS touchpads have been released and 10 10 integrated into a variety of laptops and netbooks. These new touchpads ··· 240 240 byte 3: 0 x23 x22 x21 x20 x19 x18 x17 241 241 byte 4: 0 x9 x8 x7 x6 x5 x4 x3 242 242 byte 5: 0 x16 x15 x14 x13 x12 x11 x10 243 + 244 + ALPS Absolute Mode - Protocol Version 6 245 + --------------------------------------- 246 + 247 + For trackstick packet, the format is: 248 + 249 + byte 0: 1 1 1 1 1 1 1 1 250 + byte 1: 0 X6 X5 X4 X3 X2 X1 X0 251 + byte 2: 0 Y6 Y5 Y4 Y3 Y2 Y1 Y0 252 + byte 3: ? Y7 X7 ? ? M R L 253 + byte 4: Z7 Z6 Z5 Z4 Z3 Z2 Z1 Z0 254 + byte 5: 0 1 1 1 1 1 1 1 255 + 256 + For touchpad packet, the format is: 257 + 258 + byte 0: 1 1 1 1 1 1 1 1 259 + byte 1: 0 0 0 0 x3 x2 x1 x0 260 + byte 2: 0 0 0 0 y3 y2 y1 y0 261 + byte 3: ? x7 x6 x5 x4 ? r l 262 + byte 4: ? y7 y6 y5 y4 ? ? ? 263 + byte 5: z7 z6 z5 z4 z3 z2 z1 z0 264 + 265 + (v6 touchpad does not have middle button) 266 + 267 + ALPS Absolute Mode - Protocol Version 7 268 + --------------------------------------- 269 + 270 + For trackstick packet, the format is: 271 + 272 + byte 0: 0 1 0 0 1 0 0 0 273 + byte 1: 1 1 * * 1 M R L 274 + byte 2: X7 1 X5 X4 X3 X2 X1 X0 275 + byte 3: Z6 1 Y6 X6 1 Y2 Y1 Y0 276 + byte 4: Y7 0 Y5 Y4 Y3 1 1 0 277 + byte 5: T&P 0 Z5 Z4 Z3 Z2 Z1 Z0 278 + 279 + For touchpad packet, the format is: 280 + 281 + packet-fmt b7 b6 b5 b4 b3 b2 b1 b0 282 + byte 0: TWO & MULTI L 1 R M 1 Y0-2 Y0-1 Y0-0 283 + byte 0: NEW L 1 X1-5 1 1 Y0-2 Y0-1 Y0-0 284 + byte 1: Y0-10 Y0-9 Y0-8 Y0-7 Y0-6 Y0-5 Y0-4 Y0-3 285 + byte 2: X0-11 1 X0-10 X0-9 X0-8 X0-7 X0-6 X0-5 286 + byte 3: X1-11 1 X0-4 X0-3 1 X0-2 X0-1 X0-0 287 + byte 4: TWO X1-10 TWO X1-9 X1-8 X1-7 X1-6 X1-5 X1-4 288 + byte 4: MULTI X1-10 TWO X1-9 X1-8 X1-7 X1-6 Y1-5 1 289 + byte 4: NEW X1-10 TWO X1-9 X1-8 X1-7 X1-6 0 0 290 + byte 5: TWO & NEW Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 Y1-5 Y1-4 291 + byte 5: MULTI Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 F-1 F-0 292 + 293 + L: Left button 294 + R / M: Non-clickpads: Right / Middle button 295 + Clickpads: When > 2 fingers are down, and some fingers 296 + are in the button area, then the 2 coordinates reported 297 + are for fingers outside the button area and these report 298 + extra fingers being present in the right / left button 299 + area. Note these fingers are not added to the F field! 300 + so if a TWO packet is received and R = 1 then there are 301 + 3 fingers down, etc. 302 + TWO: 1: Two touches present, byte 0/4/5 are in TWO fmt 303 + 0: If byte 4 bit 0 is 1, then byte 0/4/5 are in MULTI fmt 304 + otherwise byte 0 bit 4 must be set and byte 0/4/5 are 305 + in NEW fmt 306 + F: Number of fingers - 3, 0 means 3 fingers, 1 means 4 ...
+1
arch/blackfin/include/asm/bfin_rotary.h include/linux/platform_data/bfin_rotary.h
··· 40 40 unsigned short debounce; /* 0..17 */ 41 41 unsigned short mode; 42 42 unsigned short pm_wakeup; 43 + unsigned short *pin_list; 43 44 }; 44 45 45 46 /* CNT_CONFIG bitmasks */
+14 -1
arch/blackfin/mach-bf527/boards/ad7160eval.c
··· 666 666 #endif 667 667 668 668 #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) 669 - #include <asm/bfin_rotary.h> 669 + #include <linux/platform_data/bfin_rotary.h> 670 + 671 + static const u16 per_cnt[] = { 672 + P_CNT_CUD, 673 + P_CNT_CDG, 674 + P_CNT_CZM, 675 + 0 676 + }; 670 677 671 678 static struct bfin_rotary_platform_data bfin_rotary_data = { 672 679 /*.rotary_up_key = KEY_UP,*/ ··· 683 676 .debounce = 10, /* 0..17 */ 684 677 .mode = ROT_QUAD_ENC | ROT_DEBE, 685 678 .pm_wakeup = 1, 679 + .pin_list = per_cnt, 686 680 }; 687 681 688 682 static struct resource bfin_rotary_resources[] = { 683 + { 684 + .start = CNT_CONFIG, 685 + .end = CNT_CONFIG + 0xff, 686 + .flags = IORESOURCE_MEM, 687 + }, 689 688 { 690 689 .start = IRQ_CNT, 691 690 .end = IRQ_CNT,
+14 -1
arch/blackfin/mach-bf527/boards/ezkit.c
··· 1092 1092 #endif 1093 1093 1094 1094 #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) 1095 - #include <asm/bfin_rotary.h> 1095 + #include <linux/platform_data/bfin_rotary.h> 1096 + 1097 + static const u16 per_cnt[] = { 1098 + P_CNT_CUD, 1099 + P_CNT_CDG, 1100 + P_CNT_CZM, 1101 + 0 1102 + }; 1096 1103 1097 1104 static struct bfin_rotary_platform_data bfin_rotary_data = { 1098 1105 /*.rotary_up_key = KEY_UP,*/ ··· 1109 1102 .debounce = 10, /* 0..17 */ 1110 1103 .mode = ROT_QUAD_ENC | ROT_DEBE, 1111 1104 .pm_wakeup = 1, 1105 + .pin_list = per_cnt, 1112 1106 }; 1113 1107 1114 1108 static struct resource bfin_rotary_resources[] = { 1109 + { 1110 + .start = CNT_CONFIG, 1111 + .end = CNT_CONFIG + 0xff, 1112 + .flags = IORESOURCE_MEM, 1113 + }, 1115 1114 { 1116 1115 .start = IRQ_CNT, 1117 1116 .end = IRQ_CNT,
+6 -1
arch/blackfin/mach-bf548/boards/ezkit.c
··· 159 159 #endif 160 160 161 161 #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) 162 - #include <asm/bfin_rotary.h> 162 + #include <linux/platform_data/bfin_rotary.h> 163 163 164 164 static struct bfin_rotary_platform_data bfin_rotary_data = { 165 165 /*.rotary_up_key = KEY_UP,*/ ··· 172 172 }; 173 173 174 174 static struct resource bfin_rotary_resources[] = { 175 + { 176 + .start = CNT_CONFIG, 177 + .end = CNT_CONFIG + 0xff, 178 + .flags = IORESOURCE_MEM, 179 + }, 175 180 { 176 181 .start = IRQ_CNT, 177 182 .end = IRQ_CNT,
+6 -1
arch/blackfin/mach-bf609/boards/ezkit.c
··· 75 75 #endif 76 76 77 77 #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) 78 - #include <asm/bfin_rotary.h> 78 + #include <linux/platform_data/bfin_rotary.h> 79 79 80 80 static struct bfin_rotary_platform_data bfin_rotary_data = { 81 81 /*.rotary_up_key = KEY_UP,*/ ··· 87 87 }; 88 88 89 89 static struct resource bfin_rotary_resources[] = { 90 + { 91 + .start = CNT_CONFIG, 92 + .end = CNT_CONFIG + 0xff, 93 + .flags = IORESOURCE_MEM, 94 + }, 90 95 { 91 96 .start = IRQ_CNT, 92 97 .end = IRQ_CNT,
+1 -2
drivers/input/joystick/adi.c
··· 535 535 } 536 536 } 537 537 fail2: for (i = 0; i < 2; i++) 538 - if (port->adi[i].dev) 539 - input_free_device(port->adi[i].dev); 538 + input_free_device(port->adi[i].dev); 540 539 gameport_close(gameport); 541 540 fail1: gameport_set_drvdata(gameport, NULL); 542 541 kfree(port);
+1 -3
drivers/input/keyboard/pxa27x_keypad.c
··· 345 345 { 346 346 const struct pxa27x_keypad_platform_data *pdata = keypad->pdata; 347 347 struct input_dev *input_dev = keypad->input_dev; 348 - const struct matrix_keymap_data *keymap_data = 349 - pdata ? pdata->matrix_keymap_data : NULL; 350 348 unsigned short keycode; 351 349 int i; 352 350 int error; 353 351 354 - error = matrix_keypad_build_keymap(keymap_data, NULL, 352 + error = matrix_keypad_build_keymap(pdata->matrix_keymap_data, NULL, 355 353 pdata->matrix_key_rows, 356 354 pdata->matrix_key_cols, 357 355 keypad->keycodes, input_dev);
+117 -91
drivers/input/misc/bfin_rotary.c
··· 7 7 8 8 #include <linux/module.h> 9 9 #include <linux/interrupt.h> 10 + #include <linux/io.h> 10 11 #include <linux/irq.h> 11 12 #include <linux/pm.h> 12 13 #include <linux/platform_device.h> 13 14 #include <linux/input.h> 14 15 #include <linux/slab.h> 16 + #include <linux/platform_data/bfin_rotary.h> 15 17 16 18 #include <asm/portmux.h> 17 - #include <asm/bfin_rotary.h> 18 19 19 - static const u16 per_cnt[] = { 20 - P_CNT_CUD, 21 - P_CNT_CDG, 22 - P_CNT_CZM, 23 - 0 24 - }; 20 + #define CNT_CONFIG_OFF 0 /* CNT Config Offset */ 21 + #define CNT_IMASK_OFF 4 /* CNT Interrupt Mask Offset */ 22 + #define CNT_STATUS_OFF 8 /* CNT Status Offset */ 23 + #define CNT_COMMAND_OFF 12 /* CNT Command Offset */ 24 + #define CNT_DEBOUNCE_OFF 16 /* CNT Debounce Offset */ 25 + #define CNT_COUNTER_OFF 20 /* CNT Counter Offset */ 26 + #define CNT_MAX_OFF 24 /* CNT Maximum Count Offset */ 27 + #define CNT_MIN_OFF 28 /* CNT Minimum Count Offset */ 25 28 26 29 struct bfin_rot { 27 30 struct input_dev *input; 31 + void __iomem *base; 28 32 int irq; 29 33 unsigned int up_key; 30 34 unsigned int down_key; 31 35 unsigned int button_key; 32 36 unsigned int rel_code; 37 + 38 + unsigned short mode; 39 + unsigned short debounce; 40 + 33 41 unsigned short cnt_config; 34 42 unsigned short cnt_imask; 35 43 unsigned short cnt_debounce; ··· 67 59 68 60 static irqreturn_t bfin_rotary_isr(int irq, void *dev_id) 69 61 { 70 - struct platform_device *pdev = dev_id; 71 - struct bfin_rot *rotary = platform_get_drvdata(pdev); 62 + struct bfin_rot *rotary = dev_id; 72 63 int delta; 73 64 74 - switch (bfin_read_CNT_STATUS()) { 65 + switch (readw(rotary->base + CNT_STATUS_OFF)) { 75 66 76 67 case ICII: 77 68 break; 78 69 79 70 case UCII: 80 71 case DCII: 81 - delta = bfin_read_CNT_COUNTER(); 72 + delta = readl(rotary->base + CNT_COUNTER_OFF); 82 73 if (delta) 83 74 report_rotary_event(rotary, delta); 84 75 break; ··· 90 83 break; 91 84 } 92 85 93 - bfin_write_CNT_COMMAND(W1LCNT_ZERO); /* Clear COUNTER */ 94 - bfin_write_CNT_STATUS(-1); /* Clear STATUS */ 86 + writew(W1LCNT_ZERO, rotary->base + CNT_COMMAND_OFF); /* Clear COUNTER */ 87 + writew(-1, rotary->base + CNT_STATUS_OFF); /* Clear STATUS */ 95 88 96 89 return IRQ_HANDLED; 97 90 } 98 91 92 + static int bfin_rotary_open(struct input_dev *input) 93 + { 94 + struct bfin_rot *rotary = input_get_drvdata(input); 95 + unsigned short val; 96 + 97 + if (rotary->mode & ROT_DEBE) 98 + writew(rotary->debounce & DPRESCALE, 99 + rotary->base + CNT_DEBOUNCE_OFF); 100 + 101 + writew(rotary->mode & ~CNTE, rotary->base + CNT_CONFIG_OFF); 102 + 103 + val = UCIE | DCIE; 104 + if (rotary->button_key) 105 + val |= CZMIE; 106 + writew(val, rotary->base + CNT_IMASK_OFF); 107 + 108 + writew(rotary->mode | CNTE, rotary->base + CNT_CONFIG_OFF); 109 + 110 + return 0; 111 + } 112 + 113 + static void bfin_rotary_close(struct input_dev *input) 114 + { 115 + struct bfin_rot *rotary = input_get_drvdata(input); 116 + 117 + writew(0, rotary->base + CNT_CONFIG_OFF); 118 + writew(0, rotary->base + CNT_IMASK_OFF); 119 + } 120 + 121 + static void bfin_rotary_free_action(void *data) 122 + { 123 + peripheral_free_list(data); 124 + } 125 + 99 126 static int bfin_rotary_probe(struct platform_device *pdev) 100 127 { 101 - struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); 128 + struct device *dev = &pdev->dev; 129 + const struct bfin_rotary_platform_data *pdata = dev_get_platdata(dev); 102 130 struct bfin_rot *rotary; 131 + struct resource *res; 103 132 struct input_dev *input; 104 133 int error; 105 134 ··· 145 102 return -EINVAL; 146 103 } 147 104 148 - error = peripheral_request_list(per_cnt, dev_name(&pdev->dev)); 149 - if (error) { 150 - dev_err(&pdev->dev, "requesting peripherals failed\n"); 151 - return error; 105 + if (pdata->pin_list) { 106 + error = peripheral_request_list(pdata->pin_list, 107 + dev_name(&pdev->dev)); 108 + if (error) { 109 + dev_err(dev, "requesting peripherals failed: %d\n", 110 + error); 111 + return error; 112 + } 113 + 114 + error = devm_add_action(dev, bfin_rotary_free_action, 115 + pdata->pin_list); 116 + if (error) { 117 + dev_err(dev, "setting cleanup action failed: %d\n", 118 + error); 119 + peripheral_free_list(pdata->pin_list); 120 + return error; 121 + } 152 122 } 153 123 154 - rotary = kzalloc(sizeof(struct bfin_rot), GFP_KERNEL); 155 - input = input_allocate_device(); 156 - if (!rotary || !input) { 157 - error = -ENOMEM; 158 - goto out1; 159 - } 124 + rotary = devm_kzalloc(dev, sizeof(struct bfin_rot), GFP_KERNEL); 125 + if (!rotary) 126 + return -ENOMEM; 127 + 128 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 129 + rotary->base = devm_ioremap_resource(dev, res); 130 + if (IS_ERR(rotary->base)) 131 + return PTR_ERR(rotary->base); 132 + 133 + input = devm_input_allocate_device(dev); 134 + if (!input) 135 + return -ENOMEM; 160 136 161 137 rotary->input = input; 162 138 ··· 184 122 rotary->button_key = pdata->rotary_button_key; 185 123 rotary->rel_code = pdata->rotary_rel_code; 186 124 187 - error = rotary->irq = platform_get_irq(pdev, 0); 188 - if (error < 0) 189 - goto out1; 125 + rotary->mode = pdata->mode; 126 + rotary->debounce = pdata->debounce; 190 127 191 128 input->name = pdev->name; 192 129 input->phys = "bfin-rotary/input0"; ··· 197 136 input->id.vendor = 0x0001; 198 137 input->id.product = 0x0001; 199 138 input->id.version = 0x0100; 139 + 140 + input->open = bfin_rotary_open; 141 + input->close = bfin_rotary_close; 200 142 201 143 if (rotary->up_key) { 202 144 __set_bit(EV_KEY, input->evbit); ··· 215 151 __set_bit(rotary->button_key, input->keybit); 216 152 } 217 153 218 - error = request_irq(rotary->irq, bfin_rotary_isr, 219 - 0, dev_name(&pdev->dev), pdev); 154 + /* Quiesce the device before requesting irq */ 155 + bfin_rotary_close(input); 156 + 157 + rotary->irq = platform_get_irq(pdev, 0); 158 + if (rotary->irq < 0) { 159 + dev_err(dev, "No rotary IRQ specified\n"); 160 + return -ENOENT; 161 + } 162 + 163 + error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr, 164 + 0, dev_name(dev), rotary); 220 165 if (error) { 221 - dev_err(&pdev->dev, 222 - "unable to claim irq %d; error %d\n", 166 + dev_err(dev, "unable to claim irq %d; error %d\n", 223 167 rotary->irq, error); 224 - goto out1; 168 + return error; 225 169 } 226 170 227 171 error = input_register_device(input); 228 172 if (error) { 229 - dev_err(&pdev->dev, 230 - "unable to register input device (%d)\n", error); 231 - goto out2; 173 + dev_err(dev, "unable to register input device (%d)\n", error); 174 + return error; 232 175 } 233 - 234 - if (pdata->rotary_button_key) 235 - bfin_write_CNT_IMASK(CZMIE); 236 - 237 - if (pdata->mode & ROT_DEBE) 238 - bfin_write_CNT_DEBOUNCE(pdata->debounce & DPRESCALE); 239 - 240 - if (pdata->mode) 241 - bfin_write_CNT_CONFIG(bfin_read_CNT_CONFIG() | 242 - (pdata->mode & ~CNTE)); 243 - 244 - bfin_write_CNT_IMASK(bfin_read_CNT_IMASK() | UCIE | DCIE); 245 - bfin_write_CNT_CONFIG(bfin_read_CNT_CONFIG() | CNTE); 246 176 247 177 platform_set_drvdata(pdev, rotary); 248 178 device_init_wakeup(&pdev->dev, 1); 249 179 250 180 return 0; 251 - 252 - out2: 253 - free_irq(rotary->irq, pdev); 254 - out1: 255 - input_free_device(input); 256 - kfree(rotary); 257 - peripheral_free_list(per_cnt); 258 - 259 - return error; 260 181 } 261 182 262 - static int bfin_rotary_remove(struct platform_device *pdev) 263 - { 264 - struct bfin_rot *rotary = platform_get_drvdata(pdev); 265 - 266 - bfin_write_CNT_CONFIG(0); 267 - bfin_write_CNT_IMASK(0); 268 - 269 - free_irq(rotary->irq, pdev); 270 - input_unregister_device(rotary->input); 271 - peripheral_free_list(per_cnt); 272 - 273 - kfree(rotary); 274 - 275 - return 0; 276 - } 277 - 278 - #ifdef CONFIG_PM 279 - static int bfin_rotary_suspend(struct device *dev) 183 + static int __maybe_unused bfin_rotary_suspend(struct device *dev) 280 184 { 281 185 struct platform_device *pdev = to_platform_device(dev); 282 186 struct bfin_rot *rotary = platform_get_drvdata(pdev); 283 187 284 - rotary->cnt_config = bfin_read_CNT_CONFIG(); 285 - rotary->cnt_imask = bfin_read_CNT_IMASK(); 286 - rotary->cnt_debounce = bfin_read_CNT_DEBOUNCE(); 188 + rotary->cnt_config = readw(rotary->base + CNT_CONFIG_OFF); 189 + rotary->cnt_imask = readw(rotary->base + CNT_IMASK_OFF); 190 + rotary->cnt_debounce = readw(rotary->base + CNT_DEBOUNCE_OFF); 287 191 288 192 if (device_may_wakeup(&pdev->dev)) 289 193 enable_irq_wake(rotary->irq); ··· 259 227 return 0; 260 228 } 261 229 262 - static int bfin_rotary_resume(struct device *dev) 230 + static int __maybe_unused bfin_rotary_resume(struct device *dev) 263 231 { 264 232 struct platform_device *pdev = to_platform_device(dev); 265 233 struct bfin_rot *rotary = platform_get_drvdata(pdev); 266 234 267 - bfin_write_CNT_DEBOUNCE(rotary->cnt_debounce); 268 - bfin_write_CNT_IMASK(rotary->cnt_imask); 269 - bfin_write_CNT_CONFIG(rotary->cnt_config & ~CNTE); 235 + writew(rotary->cnt_debounce, rotary->base + CNT_DEBOUNCE_OFF); 236 + writew(rotary->cnt_imask, rotary->base + CNT_IMASK_OFF); 237 + writew(rotary->cnt_config & ~CNTE, rotary->base + CNT_CONFIG_OFF); 270 238 271 239 if (device_may_wakeup(&pdev->dev)) 272 240 disable_irq_wake(rotary->irq); 273 241 274 242 if (rotary->cnt_config & CNTE) 275 - bfin_write_CNT_CONFIG(rotary->cnt_config); 243 + writew(rotary->cnt_config, rotary->base + CNT_CONFIG_OFF); 276 244 277 245 return 0; 278 246 } 279 247 280 - static const struct dev_pm_ops bfin_rotary_pm_ops = { 281 - .suspend = bfin_rotary_suspend, 282 - .resume = bfin_rotary_resume, 283 - }; 284 - #endif 248 + static SIMPLE_DEV_PM_OPS(bfin_rotary_pm_ops, 249 + bfin_rotary_suspend, bfin_rotary_resume); 285 250 286 251 static struct platform_driver bfin_rotary_device_driver = { 287 252 .probe = bfin_rotary_probe, 288 - .remove = bfin_rotary_remove, 289 253 .driver = { 290 254 .name = "bfin-rotary", 291 - #ifdef CONFIG_PM 292 255 .pm = &bfin_rotary_pm_ops, 293 - #endif 294 256 }, 295 257 }; 296 258 module_platform_driver(bfin_rotary_device_driver);
+1 -1
drivers/input/misc/soc_button_array.c
··· 195 195 196 196 static struct soc_button_info soc_button_PNP0C40[] = { 197 197 { "power", 0, EV_KEY, KEY_POWER, false, true }, 198 - { "home", 1, EV_KEY, KEY_HOME, false, true }, 198 + { "home", 1, EV_KEY, KEY_LEFTMETA, false, true }, 199 199 { "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false }, 200 200 { "volume_down", 3, EV_KEY, KEY_VOLUMEDOWN, true, false }, 201 201 { "rotation_lock", 4, EV_SW, SW_ROTATE_LOCK, false, false },
+306 -210
drivers/input/mouse/alps.c
··· 99 99 #define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */ 100 100 #define ALPS_PS2_INTERLEAVED 0x80 /* 3-byte PS/2 packet interleaved with 101 101 6-byte ALPS packet */ 102 - #define ALPS_IS_RUSHMORE 0x100 /* device is a rushmore */ 103 102 #define ALPS_BUTTONPAD 0x200 /* device is a clickpad */ 104 103 105 104 static const struct alps_model_info alps_model_data[] = { 106 - { { 0x32, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Toshiba Salellite Pro M10 */ 107 - { { 0x33, 0x02, 0x0a }, 0x00, ALPS_PROTO_V1, 0x88, 0xf8, 0 }, /* UMAX-530T */ 108 - { { 0x53, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, 109 - { { 0x53, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, 110 - { { 0x60, 0x03, 0xc8 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, /* HP ze1115 */ 111 - { { 0x63, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, 112 - { { 0x63, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, 113 - { { 0x63, 0x02, 0x28 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 }, /* Fujitsu Siemens S6010 */ 114 - { { 0x63, 0x02, 0x3c }, 0x00, ALPS_PROTO_V2, 0x8f, 0x8f, ALPS_WHEEL }, /* Toshiba Satellite S2400-103 */ 115 - { { 0x63, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xef, 0xef, ALPS_FW_BK_1 }, /* NEC Versa L320 */ 116 - { { 0x63, 0x02, 0x64 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, 117 - { { 0x63, 0x03, 0xc8 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D800 */ 118 - { { 0x73, 0x00, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_DUALPOINT }, /* ThinkPad R61 8918-5QG */ 119 - { { 0x73, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, 120 - { { 0x73, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 }, /* Ahtec Laptop */ 121 - { { 0x20, 0x02, 0x0e }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */ 122 - { { 0x22, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, 123 - { { 0x22, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */ 105 + { { 0x32, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } }, /* Toshiba Salellite Pro M10 */ 106 + { { 0x33, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V1, 0x88, 0xf8, 0 } }, /* UMAX-530T */ 107 + { { 0x53, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } }, 108 + { { 0x53, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } }, 109 + { { 0x60, 0x03, 0xc8 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } }, /* HP ze1115 */ 110 + { { 0x63, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } }, 111 + { { 0x63, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } }, 112 + { { 0x63, 0x02, 0x28 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 } }, /* Fujitsu Siemens S6010 */ 113 + { { 0x63, 0x02, 0x3c }, 0x00, { ALPS_PROTO_V2, 0x8f, 0x8f, ALPS_WHEEL } }, /* Toshiba Satellite S2400-103 */ 114 + { { 0x63, 0x02, 0x50 }, 0x00, { ALPS_PROTO_V2, 0xef, 0xef, ALPS_FW_BK_1 } }, /* NEC Versa L320 */ 115 + { { 0x63, 0x02, 0x64 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } }, 116 + { { 0x63, 0x03, 0xc8 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } }, /* Dell Latitude D800 */ 117 + { { 0x73, 0x00, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_DUALPOINT } }, /* ThinkPad R61 8918-5QG */ 118 + { { 0x73, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } }, 119 + { { 0x73, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 } }, /* Ahtec Laptop */ 120 + 121 + /* 122 + * XXX This entry is suspicious. First byte has zero lower nibble, 123 + * which is what a normal mouse would report. Also, the value 0x0e 124 + * isn't valid per PS/2 spec. 125 + */ 126 + { { 0x20, 0x02, 0x0e }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } }, 127 + 128 + { { 0x22, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } }, 129 + { { 0x22, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT } }, /* Dell Latitude D600 */ 124 130 /* Dell Latitude E5500, E6400, E6500, Precision M4400 */ 125 - { { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, 126 - ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, 127 - { { 0x73, 0x00, 0x14 }, 0x00, ALPS_PROTO_V6, 0xff, 0xff, ALPS_DUALPOINT }, /* Dell XT2 */ 128 - { { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ 129 - { { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, 130 - ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ 131 - { { 0x73, 0x02, 0x64 }, 0x8a, ALPS_PROTO_V4, 0x8f, 0x8f, 0 }, 131 + { { 0x62, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xcf, 0xcf, 132 + ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED } }, 133 + { { 0x73, 0x00, 0x14 }, 0x00, { ALPS_PROTO_V6, 0xff, 0xff, ALPS_DUALPOINT } }, /* Dell XT2 */ 134 + { { 0x73, 0x02, 0x50 }, 0x00, { ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS } }, /* Dell Vostro 1400 */ 135 + { { 0x52, 0x01, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xff, 0xff, 136 + ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED } }, /* Toshiba Tecra A11-11L */ 137 + { { 0x73, 0x02, 0x64 }, 0x8a, { ALPS_PROTO_V4, 0x8f, 0x8f, 0 } }, 138 + }; 139 + 140 + static const struct alps_protocol_info alps_v3_protocol_data = { 141 + ALPS_PROTO_V3, 0x8f, 0x8f, ALPS_DUALPOINT 142 + }; 143 + 144 + static const struct alps_protocol_info alps_v3_rushmore_data = { 145 + ALPS_PROTO_V3_RUSHMORE, 0x8f, 0x8f, ALPS_DUALPOINT 146 + }; 147 + 148 + static const struct alps_protocol_info alps_v5_protocol_data = { 149 + ALPS_PROTO_V5, 0xc8, 0xd8, 0 150 + }; 151 + 152 + static const struct alps_protocol_info alps_v7_protocol_data = { 153 + ALPS_PROTO_V7, 0x48, 0x48, ALPS_DUALPOINT 132 154 }; 133 155 134 156 static void alps_set_abs_params_st(struct alps_data *priv, 135 157 struct input_dev *dev1); 136 158 static void alps_set_abs_params_mt(struct alps_data *priv, 137 159 struct input_dev *dev1); 138 - 139 - /* 140 - * XXX - this entry is suspicious. First byte has zero lower nibble, 141 - * which is what a normal mouse would report. Also, the value 0x0e 142 - * isn't valid per PS/2 spec. 143 - */ 144 160 145 161 /* Packet formats are described in Documentation/input/alps.txt */ 146 162 ··· 166 150 return (data & priv->mask0) == priv->byte0; 167 151 } 168 152 169 - static void alps_report_buttons(struct psmouse *psmouse, 170 - struct input_dev *dev1, struct input_dev *dev2, 153 + static void alps_report_buttons(struct input_dev *dev1, struct input_dev *dev2, 171 154 int left, int right, int middle) 172 155 { 173 156 struct input_dev *dev; ··· 176 161 * other device (dev2) then this event should be also 177 162 * sent through that device. 178 163 */ 179 - dev = test_bit(BTN_LEFT, dev2->key) ? dev2 : dev1; 164 + dev = (dev2 && test_bit(BTN_LEFT, dev2->key)) ? dev2 : dev1; 180 165 input_report_key(dev, BTN_LEFT, left); 181 166 182 - dev = test_bit(BTN_RIGHT, dev2->key) ? dev2 : dev1; 167 + dev = (dev2 && test_bit(BTN_RIGHT, dev2->key)) ? dev2 : dev1; 183 168 input_report_key(dev, BTN_RIGHT, right); 184 169 185 - dev = test_bit(BTN_MIDDLE, dev2->key) ? dev2 : dev1; 170 + dev = (dev2 && test_bit(BTN_MIDDLE, dev2->key)) ? dev2 : dev1; 186 171 input_report_key(dev, BTN_MIDDLE, middle); 187 172 188 173 /* 189 174 * Sync the _other_ device now, we'll do the first 190 175 * device later once we report the rest of the events. 191 176 */ 192 - input_sync(dev2); 177 + if (dev2) 178 + input_sync(dev2); 193 179 } 194 180 195 181 static void alps_process_packet_v1_v2(struct psmouse *psmouse) ··· 237 221 input_report_rel(dev2, REL_X, (x > 383 ? (x - 768) : x)); 238 222 input_report_rel(dev2, REL_Y, -(y > 255 ? (y - 512) : y)); 239 223 240 - alps_report_buttons(psmouse, dev2, dev, left, right, middle); 224 + alps_report_buttons(dev2, dev, left, right, middle); 241 225 242 226 input_sync(dev2); 243 227 return; 244 228 } 245 229 246 - alps_report_buttons(psmouse, dev, dev2, left, right, middle); 230 + alps_report_buttons(dev, dev2, left, right, middle); 247 231 248 232 /* Convert hardware tap to a reasonable Z value */ 249 233 if (ges && !fin) ··· 428 412 (2 * (priv->y_bits - 1)); 429 413 430 414 /* y-bitmap order is reversed, except on rushmore */ 431 - if (!(priv->flags & ALPS_IS_RUSHMORE)) { 415 + if (priv->proto_version != ALPS_PROTO_V3_RUSHMORE) { 432 416 fields->mt[0].y = priv->y_max - fields->mt[0].y; 433 417 fields->mt[1].y = priv->y_max - fields->mt[1].y; 434 418 } ··· 664 648 */ 665 649 if (f->is_mp) { 666 650 fingers = f->fingers; 667 - if (priv->proto_version == ALPS_PROTO_V3) { 651 + if (priv->proto_version == ALPS_PROTO_V3 || 652 + priv->proto_version == ALPS_PROTO_V3_RUSHMORE) { 668 653 if (alps_process_bitmap(priv, f) == 0) 669 654 fingers = 0; /* Use st data */ 670 655 ··· 909 892 unsigned char *pkt, 910 893 unsigned char pkt_id) 911 894 { 912 - /* 913 - * packet-fmt b7 b6 b5 b4 b3 b2 b1 b0 914 - * Byte0 TWO & MULTI L 1 R M 1 Y0-2 Y0-1 Y0-0 915 - * Byte0 NEW L 1 X1-5 1 1 Y0-2 Y0-1 Y0-0 916 - * Byte1 Y0-10 Y0-9 Y0-8 Y0-7 Y0-6 Y0-5 Y0-4 Y0-3 917 - * Byte2 X0-11 1 X0-10 X0-9 X0-8 X0-7 X0-6 X0-5 918 - * Byte3 X1-11 1 X0-4 X0-3 1 X0-2 X0-1 X0-0 919 - * Byte4 TWO X1-10 TWO X1-9 X1-8 X1-7 X1-6 X1-5 X1-4 920 - * Byte4 MULTI X1-10 TWO X1-9 X1-8 X1-7 X1-6 Y1-5 1 921 - * Byte4 NEW X1-10 TWO X1-9 X1-8 X1-7 X1-6 0 0 922 - * Byte5 TWO & NEW Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 Y1-5 Y1-4 923 - * Byte5 MULTI Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 F-1 F-0 924 - * L: Left button 925 - * R / M: Non-clickpads: Right / Middle button 926 - * Clickpads: When > 2 fingers are down, and some fingers 927 - * are in the button area, then the 2 coordinates reported 928 - * are for fingers outside the button area and these report 929 - * extra fingers being present in the right / left button 930 - * area. Note these fingers are not added to the F field! 931 - * so if a TWO packet is received and R = 1 then there are 932 - * 3 fingers down, etc. 933 - * TWO: 1: Two touches present, byte 0/4/5 are in TWO fmt 934 - * 0: If byte 4 bit 0 is 1, then byte 0/4/5 are in MULTI fmt 935 - * otherwise byte 0 bit 4 must be set and byte 0/4/5 are 936 - * in NEW fmt 937 - * F: Number of fingers - 3, 0 means 3 fingers, 1 means 4 ... 938 - */ 939 - 940 895 mt[0].x = ((pkt[2] & 0x80) << 4); 941 896 mt[0].x |= ((pkt[2] & 0x3F) << 5); 942 897 mt[0].x |= ((pkt[3] & 0x30) >> 1); ··· 1033 1044 return; 1034 1045 } 1035 1046 1036 - /* 1037 - * b7 b6 b5 b4 b3 b2 b1 b0 1038 - * Byte0 0 1 0 0 1 0 0 0 1039 - * Byte1 1 1 * * 1 M R L 1040 - * Byte2 X7 1 X5 X4 X3 X2 X1 X0 1041 - * Byte3 Z6 1 Y6 X6 1 Y2 Y1 Y0 1042 - * Byte4 Y7 0 Y5 Y4 Y3 1 1 0 1043 - * Byte5 T&P 0 Z5 Z4 Z3 Z2 Z1 Z0 1044 - * M / R / L: Middle / Right / Left button 1045 - */ 1046 - 1047 1047 x = ((packet[2] & 0xbf)) | ((packet[3] & 0x10) << 2); 1048 1048 y = (packet[3] & 0x07) | (packet[4] & 0xb8) | 1049 1049 ((packet[3] & 0x20) << 1); ··· 1085 1107 alps_process_touchpad_packet_v7(psmouse); 1086 1108 } 1087 1109 1088 - static void alps_report_bare_ps2_packet(struct psmouse *psmouse, 1110 + static DEFINE_MUTEX(alps_mutex); 1111 + 1112 + static void alps_register_bare_ps2_mouse(struct work_struct *work) 1113 + { 1114 + struct alps_data *priv = 1115 + container_of(work, struct alps_data, dev3_register_work.work); 1116 + struct psmouse *psmouse = priv->psmouse; 1117 + struct input_dev *dev3; 1118 + int error = 0; 1119 + 1120 + mutex_lock(&alps_mutex); 1121 + 1122 + if (priv->dev3) 1123 + goto out; 1124 + 1125 + dev3 = input_allocate_device(); 1126 + if (!dev3) { 1127 + psmouse_err(psmouse, "failed to allocate secondary device\n"); 1128 + error = -ENOMEM; 1129 + goto out; 1130 + } 1131 + 1132 + snprintf(priv->phys3, sizeof(priv->phys3), "%s/%s", 1133 + psmouse->ps2dev.serio->phys, 1134 + (priv->dev2 ? "input2" : "input1")); 1135 + dev3->phys = priv->phys3; 1136 + 1137 + /* 1138 + * format of input device name is: "protocol vendor name" 1139 + * see function psmouse_switch_protocol() in psmouse-base.c 1140 + */ 1141 + dev3->name = "PS/2 ALPS Mouse"; 1142 + 1143 + dev3->id.bustype = BUS_I8042; 1144 + dev3->id.vendor = 0x0002; 1145 + dev3->id.product = PSMOUSE_PS2; 1146 + dev3->id.version = 0x0000; 1147 + dev3->dev.parent = &psmouse->ps2dev.serio->dev; 1148 + 1149 + input_set_capability(dev3, EV_REL, REL_X); 1150 + input_set_capability(dev3, EV_REL, REL_Y); 1151 + input_set_capability(dev3, EV_KEY, BTN_LEFT); 1152 + input_set_capability(dev3, EV_KEY, BTN_RIGHT); 1153 + input_set_capability(dev3, EV_KEY, BTN_MIDDLE); 1154 + 1155 + __set_bit(INPUT_PROP_POINTER, dev3->propbit); 1156 + 1157 + error = input_register_device(dev3); 1158 + if (error) { 1159 + psmouse_err(psmouse, 1160 + "failed to register secondary device: %d\n", 1161 + error); 1162 + input_free_device(dev3); 1163 + goto out; 1164 + } 1165 + 1166 + priv->dev3 = dev3; 1167 + 1168 + out: 1169 + /* 1170 + * Save the error code so that we can detect that we 1171 + * already tried to create the device. 1172 + */ 1173 + if (error) 1174 + priv->dev3 = ERR_PTR(error); 1175 + 1176 + mutex_unlock(&alps_mutex); 1177 + } 1178 + 1179 + static void alps_report_bare_ps2_packet(struct input_dev *dev, 1089 1180 unsigned char packet[], 1090 1181 bool report_buttons) 1091 1182 { 1092 - struct alps_data *priv = psmouse->private; 1093 - struct input_dev *dev2 = priv->dev2; 1094 - 1095 1183 if (report_buttons) 1096 - alps_report_buttons(psmouse, dev2, psmouse->dev, 1184 + alps_report_buttons(dev, NULL, 1097 1185 packet[0] & 1, packet[0] & 2, packet[0] & 4); 1098 1186 1099 - input_report_rel(dev2, REL_X, 1187 + input_report_rel(dev, REL_X, 1100 1188 packet[1] ? packet[1] - ((packet[0] << 4) & 0x100) : 0); 1101 - input_report_rel(dev2, REL_Y, 1189 + input_report_rel(dev, REL_Y, 1102 1190 packet[2] ? ((packet[0] << 3) & 0x100) - packet[2] : 0); 1103 1191 1104 - input_sync(dev2); 1192 + input_sync(dev); 1105 1193 } 1106 1194 1107 1195 static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse) ··· 1232 1188 * de-synchronization. 1233 1189 */ 1234 1190 1235 - alps_report_bare_ps2_packet(psmouse, &psmouse->packet[3], 1236 - false); 1191 + alps_report_bare_ps2_packet(priv->dev2, 1192 + &psmouse->packet[3], false); 1237 1193 1238 1194 /* 1239 1195 * Continue with the standard ALPS protocol handling, ··· 1289 1245 * properly we only do this if the device is fully synchronized. 1290 1246 */ 1291 1247 if (!psmouse->out_of_sync_cnt && (psmouse->packet[0] & 0xc8) == 0x08) { 1248 + 1249 + /* Register dev3 mouse if we received PS/2 packet first time */ 1250 + if (unlikely(!priv->dev3)) 1251 + psmouse_queue_work(psmouse, 1252 + &priv->dev3_register_work, 0); 1253 + 1292 1254 if (psmouse->pktcnt == 3) { 1293 - alps_report_bare_ps2_packet(psmouse, psmouse->packet, 1294 - true); 1255 + /* Once dev3 mouse device is registered report data */ 1256 + if (likely(!IS_ERR_OR_NULL(priv->dev3))) 1257 + alps_report_bare_ps2_packet(priv->dev3, 1258 + psmouse->packet, 1259 + true); 1295 1260 return PSMOUSE_FULL_PACKET; 1296 1261 } 1297 1262 return PSMOUSE_GOOD_DATA; ··· 1328 1275 psmouse->pktcnt - 1, 1329 1276 psmouse->packet[psmouse->pktcnt - 1]); 1330 1277 1331 - if (priv->proto_version == ALPS_PROTO_V3 && 1278 + if (priv->proto_version == ALPS_PROTO_V3_RUSHMORE && 1332 1279 psmouse->pktcnt == psmouse->pktsize) { 1333 1280 /* 1334 1281 * Some Dell boxes, such as Latitude E6440 or E7440 ··· 1833 1780 * all. 1834 1781 */ 1835 1782 if (alps_rpt_cmd(psmouse, 0, PSMOUSE_CMD_SETSCALE21, param)) { 1836 - psmouse_warn(psmouse, "trackstick E7 report failed\n"); 1783 + psmouse_warn(psmouse, "Failed to initialize trackstick (E7 report failed)\n"); 1837 1784 ret = -ENODEV; 1838 1785 } else { 1839 1786 psmouse_dbg(psmouse, "trackstick E7 report: %3ph\n", param); ··· 1998 1945 ALPS_REG_BASE_RUSHMORE); 1999 1946 if (reg_val == -EIO) 2000 1947 goto error; 2001 - if (reg_val == -ENODEV) 2002 - priv->flags &= ~ALPS_DUALPOINT; 2003 1948 } 2004 1949 2005 1950 if (alps_enter_command_mode(psmouse) || ··· 2213 2162 return ret; 2214 2163 } 2215 2164 2216 - static void alps_set_defaults(struct alps_data *priv) 2165 + static int alps_set_protocol(struct psmouse *psmouse, 2166 + struct alps_data *priv, 2167 + const struct alps_protocol_info *protocol) 2217 2168 { 2218 - priv->byte0 = 0x8f; 2219 - priv->mask0 = 0x8f; 2220 - priv->flags = ALPS_DUALPOINT; 2169 + psmouse->private = priv; 2170 + 2171 + setup_timer(&priv->timer, alps_flush_packet, (unsigned long)psmouse); 2172 + 2173 + priv->proto_version = protocol->version; 2174 + priv->byte0 = protocol->byte0; 2175 + priv->mask0 = protocol->mask0; 2176 + priv->flags = protocol->flags; 2221 2177 2222 2178 priv->x_max = 2000; 2223 2179 priv->y_max = 1400; ··· 2240 2182 priv->x_max = 1023; 2241 2183 priv->y_max = 767; 2242 2184 break; 2185 + 2243 2186 case ALPS_PROTO_V3: 2244 2187 priv->hw_init = alps_hw_init_v3; 2245 2188 priv->process_packet = alps_process_packet_v3; ··· 2249 2190 priv->nibble_commands = alps_v3_nibble_commands; 2250 2191 priv->addr_command = PSMOUSE_CMD_RESET_WRAP; 2251 2192 break; 2193 + 2194 + case ALPS_PROTO_V3_RUSHMORE: 2195 + priv->hw_init = alps_hw_init_rushmore_v3; 2196 + priv->process_packet = alps_process_packet_v3; 2197 + priv->set_abs_params = alps_set_abs_params_mt; 2198 + priv->decode_fields = alps_decode_rushmore; 2199 + priv->nibble_commands = alps_v3_nibble_commands; 2200 + priv->addr_command = PSMOUSE_CMD_RESET_WRAP; 2201 + priv->x_bits = 16; 2202 + priv->y_bits = 12; 2203 + 2204 + if (alps_probe_trackstick_v3(psmouse, 2205 + ALPS_REG_BASE_RUSHMORE) < 0) 2206 + priv->flags &= ~ALPS_DUALPOINT; 2207 + 2208 + break; 2209 + 2252 2210 case ALPS_PROTO_V4: 2253 2211 priv->hw_init = alps_hw_init_v4; 2254 2212 priv->process_packet = alps_process_packet_v4; ··· 2273 2197 priv->nibble_commands = alps_v4_nibble_commands; 2274 2198 priv->addr_command = PSMOUSE_CMD_DISABLE; 2275 2199 break; 2200 + 2276 2201 case ALPS_PROTO_V5: 2277 2202 priv->hw_init = alps_hw_init_dolphin_v1; 2278 2203 priv->process_packet = alps_process_touchpad_packet_v3_v5; ··· 2281 2204 priv->set_abs_params = alps_set_abs_params_mt; 2282 2205 priv->nibble_commands = alps_v3_nibble_commands; 2283 2206 priv->addr_command = PSMOUSE_CMD_RESET_WRAP; 2284 - priv->byte0 = 0xc8; 2285 - priv->mask0 = 0xd8; 2286 - priv->flags = 0; 2287 2207 priv->x_max = 1360; 2288 2208 priv->y_max = 660; 2289 2209 priv->x_bits = 23; 2290 2210 priv->y_bits = 12; 2291 2211 break; 2212 + 2292 2213 case ALPS_PROTO_V6: 2293 2214 priv->hw_init = alps_hw_init_v6; 2294 2215 priv->process_packet = alps_process_packet_v6; ··· 2295 2220 priv->x_max = 2047; 2296 2221 priv->y_max = 1535; 2297 2222 break; 2223 + 2298 2224 case ALPS_PROTO_V7: 2299 2225 priv->hw_init = alps_hw_init_v7; 2300 2226 priv->process_packet = alps_process_packet_v7; ··· 2303 2227 priv->set_abs_params = alps_set_abs_params_mt; 2304 2228 priv->nibble_commands = alps_v3_nibble_commands; 2305 2229 priv->addr_command = PSMOUSE_CMD_RESET_WRAP; 2306 - priv->x_max = 0xfff; 2307 - priv->y_max = 0x7ff; 2308 - priv->byte0 = 0x48; 2309 - priv->mask0 = 0x48; 2230 + 2231 + if (alps_dolphin_get_device_area(psmouse, priv)) 2232 + return -EIO; 2310 2233 2311 2234 if (priv->fw_ver[1] != 0xba) 2312 2235 priv->flags |= ALPS_BUTTONPAD; 2236 + 2313 2237 break; 2314 2238 } 2239 + 2240 + return 0; 2315 2241 } 2316 2242 2317 - static int alps_match_table(struct psmouse *psmouse, struct alps_data *priv, 2318 - unsigned char *e7, unsigned char *ec) 2243 + static const struct alps_protocol_info *alps_match_table(unsigned char *e7, 2244 + unsigned char *ec) 2319 2245 { 2320 2246 const struct alps_model_info *model; 2321 2247 int i; ··· 2329 2251 (!model->command_mode_resp || 2330 2252 model->command_mode_resp == ec[2])) { 2331 2253 2332 - priv->proto_version = model->proto_version; 2333 - alps_set_defaults(priv); 2334 - 2335 - priv->flags = model->flags; 2336 - priv->byte0 = model->byte0; 2337 - priv->mask0 = model->mask0; 2338 - 2339 - return 0; 2254 + return &model->protocol_info; 2340 2255 } 2341 2256 } 2342 2257 2343 - return -EINVAL; 2258 + return NULL; 2344 2259 } 2345 2260 2346 2261 static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) 2347 2262 { 2263 + const struct alps_protocol_info *protocol; 2348 2264 unsigned char e6[4], e7[4], ec[4]; 2265 + int error; 2349 2266 2350 2267 /* 2351 2268 * First try "E6 report". ··· 2366 2293 alps_exit_command_mode(psmouse)) 2367 2294 return -EIO; 2368 2295 2369 - /* Save the Firmware version */ 2370 - memcpy(priv->fw_ver, ec, 3); 2371 - 2372 - if (alps_match_table(psmouse, priv, e7, ec) == 0) { 2373 - return 0; 2374 - } else if (e7[0] == 0x73 && e7[1] == 0x03 && e7[2] == 0x50 && 2375 - ec[0] == 0x73 && (ec[1] == 0x01 || ec[1] == 0x02)) { 2376 - priv->proto_version = ALPS_PROTO_V5; 2377 - alps_set_defaults(priv); 2378 - if (alps_dolphin_get_device_area(psmouse, priv)) 2379 - return -EIO; 2380 - else 2381 - return 0; 2382 - } else if (ec[0] == 0x88 && 2383 - ((ec[1] & 0xf0) == 0xb0 || (ec[1] & 0xf0) == 0xc0)) { 2384 - priv->proto_version = ALPS_PROTO_V7; 2385 - alps_set_defaults(priv); 2386 - 2387 - return 0; 2388 - } else if (ec[0] == 0x88 && ec[1] == 0x08) { 2389 - priv->proto_version = ALPS_PROTO_V3; 2390 - alps_set_defaults(priv); 2391 - 2392 - priv->hw_init = alps_hw_init_rushmore_v3; 2393 - priv->decode_fields = alps_decode_rushmore; 2394 - priv->x_bits = 16; 2395 - priv->y_bits = 12; 2396 - priv->flags |= ALPS_IS_RUSHMORE; 2397 - 2398 - /* hack to make addr_command, nibble_command available */ 2399 - psmouse->private = priv; 2400 - 2401 - if (alps_probe_trackstick_v3(psmouse, ALPS_REG_BASE_RUSHMORE)) 2402 - priv->flags &= ~ALPS_DUALPOINT; 2403 - 2404 - return 0; 2405 - } else if (ec[0] == 0x88 && ec[1] == 0x07 && 2406 - ec[2] >= 0x90 && ec[2] <= 0x9d) { 2407 - priv->proto_version = ALPS_PROTO_V3; 2408 - alps_set_defaults(priv); 2409 - 2410 - return 0; 2296 + protocol = alps_match_table(e7, ec); 2297 + if (!protocol) { 2298 + if (e7[0] == 0x73 && e7[1] == 0x03 && e7[2] == 0x50 && 2299 + ec[0] == 0x73 && (ec[1] == 0x01 || ec[1] == 0x02)) { 2300 + protocol = &alps_v5_protocol_data; 2301 + } else if (ec[0] == 0x88 && 2302 + ((ec[1] & 0xf0) == 0xb0 || (ec[1] & 0xf0) == 0xc0)) { 2303 + protocol = &alps_v7_protocol_data; 2304 + } else if (ec[0] == 0x88 && ec[1] == 0x08) { 2305 + protocol = &alps_v3_rushmore_data; 2306 + } else if (ec[0] == 0x88 && ec[1] == 0x07 && 2307 + ec[2] >= 0x90 && ec[2] <= 0x9d) { 2308 + protocol = &alps_v3_protocol_data; 2309 + } else { 2310 + psmouse_dbg(psmouse, 2311 + "Likely not an ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec); 2312 + return -EINVAL; 2313 + } 2411 2314 } 2412 2315 2413 - psmouse_dbg(psmouse, 2414 - "Likely not an ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec); 2316 + if (priv) { 2317 + /* Save the Firmware version */ 2318 + memcpy(priv->fw_ver, ec, 3); 2319 + error = alps_set_protocol(psmouse, priv, protocol); 2320 + if (error) 2321 + return error; 2322 + } 2415 2323 2416 - return -EINVAL; 2324 + return 0; 2417 2325 } 2418 2326 2419 2327 static int alps_reconnect(struct psmouse *psmouse) ··· 2415 2361 2416 2362 psmouse_reset(psmouse); 2417 2363 del_timer_sync(&priv->timer); 2418 - input_unregister_device(priv->dev2); 2364 + if (priv->dev2) 2365 + input_unregister_device(priv->dev2); 2366 + if (!IS_ERR_OR_NULL(priv->dev3)) 2367 + input_unregister_device(priv->dev3); 2419 2368 kfree(priv); 2420 2369 } 2421 2370 ··· 2451 2394 2452 2395 int alps_init(struct psmouse *psmouse) 2453 2396 { 2454 - struct alps_data *priv; 2455 - struct input_dev *dev1 = psmouse->dev, *dev2; 2397 + struct alps_data *priv = psmouse->private; 2398 + struct input_dev *dev1 = psmouse->dev; 2399 + int error; 2456 2400 2457 - priv = kzalloc(sizeof(struct alps_data), GFP_KERNEL); 2458 - dev2 = input_allocate_device(); 2459 - if (!priv || !dev2) 2460 - goto init_fail; 2461 - 2462 - priv->dev2 = dev2; 2463 - setup_timer(&priv->timer, alps_flush_packet, (unsigned long)psmouse); 2464 - 2465 - psmouse->private = priv; 2466 - 2467 - psmouse_reset(psmouse); 2468 - 2469 - if (alps_identify(psmouse, priv) < 0) 2470 - goto init_fail; 2471 - 2472 - if (priv->hw_init(psmouse)) 2401 + error = priv->hw_init(psmouse); 2402 + if (error) 2473 2403 goto init_fail; 2474 2404 2475 2405 /* ··· 2506 2462 } 2507 2463 2508 2464 if (priv->flags & ALPS_DUALPOINT) { 2465 + struct input_dev *dev2; 2466 + 2467 + dev2 = input_allocate_device(); 2468 + if (!dev2) { 2469 + psmouse_err(psmouse, 2470 + "failed to allocate trackstick device\n"); 2471 + error = -ENOMEM; 2472 + goto init_fail; 2473 + } 2474 + 2475 + snprintf(priv->phys2, sizeof(priv->phys2), "%s/input1", 2476 + psmouse->ps2dev.serio->phys); 2477 + dev2->phys = priv->phys2; 2478 + 2509 2479 /* 2510 2480 * format of input device name is: "protocol vendor name" 2511 2481 * see function psmouse_switch_protocol() in psmouse-base.c 2512 2482 */ 2513 2483 dev2->name = "AlpsPS/2 ALPS DualPoint Stick"; 2484 + 2485 + dev2->id.bustype = BUS_I8042; 2486 + dev2->id.vendor = 0x0002; 2514 2487 dev2->id.product = PSMOUSE_ALPS; 2515 2488 dev2->id.version = priv->proto_version; 2516 - } else { 2517 - dev2->name = "PS/2 ALPS Mouse"; 2518 - dev2->id.product = PSMOUSE_PS2; 2519 - dev2->id.version = 0x0000; 2520 - } 2489 + dev2->dev.parent = &psmouse->ps2dev.serio->dev; 2521 2490 2522 - snprintf(priv->phys, sizeof(priv->phys), "%s/input1", psmouse->ps2dev.serio->phys); 2523 - dev2->phys = priv->phys; 2524 - dev2->id.bustype = BUS_I8042; 2525 - dev2->id.vendor = 0x0002; 2526 - dev2->dev.parent = &psmouse->ps2dev.serio->dev; 2491 + input_set_capability(dev2, EV_REL, REL_X); 2492 + input_set_capability(dev2, EV_REL, REL_Y); 2493 + input_set_capability(dev2, EV_KEY, BTN_LEFT); 2494 + input_set_capability(dev2, EV_KEY, BTN_RIGHT); 2495 + input_set_capability(dev2, EV_KEY, BTN_MIDDLE); 2527 2496 2528 - dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); 2529 - dev2->relbit[BIT_WORD(REL_X)] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); 2530 - dev2->keybit[BIT_WORD(BTN_LEFT)] = 2531 - BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); 2532 - 2533 - __set_bit(INPUT_PROP_POINTER, dev2->propbit); 2534 - if (priv->flags & ALPS_DUALPOINT) 2497 + __set_bit(INPUT_PROP_POINTER, dev2->propbit); 2535 2498 __set_bit(INPUT_PROP_POINTING_STICK, dev2->propbit); 2536 2499 2537 - if (input_register_device(priv->dev2)) 2538 - goto init_fail; 2500 + error = input_register_device(dev2); 2501 + if (error) { 2502 + psmouse_err(psmouse, 2503 + "failed to register trackstick device: %d\n", 2504 + error); 2505 + input_free_device(dev2); 2506 + goto init_fail; 2507 + } 2508 + 2509 + priv->dev2 = dev2; 2510 + } 2511 + 2512 + priv->psmouse = psmouse; 2513 + 2514 + INIT_DELAYED_WORK(&priv->dev3_register_work, 2515 + alps_register_bare_ps2_mouse); 2539 2516 2540 2517 psmouse->protocol_handler = alps_process_byte; 2541 2518 psmouse->poll = alps_poll; ··· 2574 2509 2575 2510 init_fail: 2576 2511 psmouse_reset(psmouse); 2577 - input_free_device(dev2); 2578 - kfree(priv); 2512 + /* 2513 + * Even though we did not allocate psmouse->private we do free 2514 + * it here. 2515 + */ 2516 + kfree(psmouse->private); 2579 2517 psmouse->private = NULL; 2580 - return -1; 2518 + return error; 2581 2519 } 2582 2520 2583 2521 int alps_detect(struct psmouse *psmouse, bool set_properties) 2584 2522 { 2585 - struct alps_data dummy; 2523 + struct alps_data *priv; 2524 + int error; 2586 2525 2587 - if (alps_identify(psmouse, &dummy) < 0) 2588 - return -1; 2526 + error = alps_identify(psmouse, NULL); 2527 + if (error) 2528 + return error; 2529 + 2530 + /* 2531 + * Reset the device to make sure it is fully operational: 2532 + * on some laptops, like certain Dell Latitudes, we may 2533 + * fail to properly detect presence of trackstick if device 2534 + * has not been reset. 2535 + */ 2536 + psmouse_reset(psmouse); 2537 + 2538 + priv = kzalloc(sizeof(struct alps_data), GFP_KERNEL); 2539 + if (!priv) 2540 + return -ENOMEM; 2541 + 2542 + error = alps_identify(psmouse, priv); 2543 + if (error) 2544 + return error; 2589 2545 2590 2546 if (set_properties) { 2591 2547 psmouse->vendor = "ALPS"; 2592 - psmouse->name = dummy.flags & ALPS_DUALPOINT ? 2548 + psmouse->name = priv->flags & ALPS_DUALPOINT ? 2593 2549 "DualPoint TouchPad" : "GlidePoint"; 2594 - psmouse->model = dummy.proto_version << 8; 2550 + psmouse->model = priv->proto_version; 2551 + } else { 2552 + /* 2553 + * Destroy alps_data structure we allocated earlier since 2554 + * this was just a "trial run". Otherwise we'll keep it 2555 + * to be used by alps_init() which has to be called if 2556 + * we succeed and set_properties is true. 2557 + */ 2558 + kfree(priv); 2559 + psmouse->private = NULL; 2595 2560 } 2561 + 2596 2562 return 0; 2597 2563 } 2598 2564
+41 -24
drivers/input/mouse/alps.h
··· 14 14 15 15 #include <linux/input/mt.h> 16 16 17 - #define ALPS_PROTO_V1 1 18 - #define ALPS_PROTO_V2 2 19 - #define ALPS_PROTO_V3 3 20 - #define ALPS_PROTO_V4 4 21 - #define ALPS_PROTO_V5 5 22 - #define ALPS_PROTO_V6 6 23 - #define ALPS_PROTO_V7 7 /* t3btl t4s */ 17 + #define ALPS_PROTO_V1 0x100 18 + #define ALPS_PROTO_V2 0x200 19 + #define ALPS_PROTO_V3 0x300 20 + #define ALPS_PROTO_V3_RUSHMORE 0x310 21 + #define ALPS_PROTO_V4 0x400 22 + #define ALPS_PROTO_V5 0x500 23 + #define ALPS_PROTO_V6 0x600 24 + #define ALPS_PROTO_V7 0x700 /* t3btl t4s */ 24 25 25 26 #define MAX_TOUCHES 2 26 27 ··· 47 46 }; 48 47 49 48 /** 49 + * struct alps_protocol_info - information about protocol used by a device 50 + * @version: Indicates V1/V2/V3/... 51 + * @byte0: Helps figure out whether a position report packet matches the 52 + * known format for this model. The first byte of the report, ANDed with 53 + * mask0, should match byte0. 54 + * @mask0: The mask used to check the first byte of the report. 55 + * @flags: Additional device capabilities (passthrough port, trackstick, etc.). 56 + */ 57 + struct alps_protocol_info { 58 + u16 version; 59 + u8 byte0, mask0; 60 + unsigned int flags; 61 + }; 62 + 63 + /** 50 64 * struct alps_model_info - touchpad ID table 51 65 * @signature: E7 response string to match. 52 66 * @command_mode_resp: For V3/V4 touchpads, the final byte of the EC response 53 67 * (aka command mode response) identifies the firmware minor version. This 54 68 * can be used to distinguish different hardware models which are not 55 69 * uniquely identifiable through their E7 responses. 56 - * @proto_version: Indicates V1/V2/V3/... 57 - * @byte0: Helps figure out whether a position report packet matches the 58 - * known format for this model. The first byte of the report, ANDed with 59 - * mask0, should match byte0. 60 - * @mask0: The mask used to check the first byte of the report. 61 - * @flags: Additional device capabilities (passthrough port, trackstick, etc.). 70 + * @protocol_info: information about protcol used by the device. 62 71 * 63 72 * Many (but not all) ALPS touchpads can be identified by looking at the 64 73 * values returned in the "E7 report" and/or the "EC report." This table 65 74 * lists a number of such touchpads. 66 75 */ 67 76 struct alps_model_info { 68 - unsigned char signature[3]; 69 - unsigned char command_mode_resp; 70 - unsigned char proto_version; 71 - unsigned char byte0, mask0; 72 - int flags; 77 + u8 signature[3]; 78 + u8 command_mode_resp; 79 + struct alps_protocol_info protocol_info; 73 80 }; 74 81 75 82 /** ··· 141 132 142 133 /** 143 134 * struct alps_data - private data structure for the ALPS driver 144 - * @dev2: "Relative" device used to report trackstick or mouse activity. 145 - * @phys: Physical path for the relative device. 135 + * @psmouse: Pointer to parent psmouse device 136 + * @dev2: Trackstick device (can be NULL). 137 + * @dev3: Generic PS/2 mouse (can be NULL, delayed registering). 138 + * @phys2: Physical path for the trackstick device. 139 + * @phys3: Physical path for the generic PS/2 mouse. 140 + * @dev3_register_work: Delayed work for registering PS/2 mouse. 146 141 * @nibble_commands: Command mapping used for touchpad register accesses. 147 142 * @addr_command: Command used to tell the touchpad that a register address 148 143 * follows. ··· 173 160 * @timer: Timer for flushing out the final report packet in the stream. 174 161 */ 175 162 struct alps_data { 163 + struct psmouse *psmouse; 176 164 struct input_dev *dev2; 177 - char phys[32]; 165 + struct input_dev *dev3; 166 + char phys2[32]; 167 + char phys3[32]; 168 + struct delayed_work dev3_register_work; 178 169 179 170 /* these are autodetected when the device is identified */ 180 171 const struct alps_nibble_commands *nibble_commands; 181 172 int addr_command; 182 - unsigned char proto_version; 183 - unsigned char byte0, mask0; 184 - unsigned char fw_ver[3]; 173 + u16 proto_version; 174 + u8 byte0, mask0; 175 + u8 fw_ver[3]; 185 176 int flags; 186 177 int x_max; 187 178 int y_max;
-5
drivers/input/mouse/cypress_ps2.c
··· 710 710 711 711 return -1; 712 712 } 713 - 714 - bool cypress_supported(void) 715 - { 716 - return true; 717 - }
-5
drivers/input/mouse/cypress_ps2.h
··· 172 172 #ifdef CONFIG_MOUSE_PS2_CYPRESS 173 173 int cypress_detect(struct psmouse *psmouse, bool set_properties); 174 174 int cypress_init(struct psmouse *psmouse); 175 - bool cypress_supported(void); 176 175 #else 177 176 inline int cypress_detect(struct psmouse *psmouse, bool set_properties) 178 177 { ··· 180 181 inline int cypress_init(struct psmouse *psmouse) 181 182 { 182 183 return -ENOSYS; 183 - } 184 - inline bool cypress_supported(void) 185 - { 186 - return 0; 187 184 } 188 185 #endif /* CONFIG_MOUSE_PS2_CYPRESS */ 189 186
-10
drivers/input/mouse/focaltech.c
··· 424 424 return error; 425 425 } 426 426 427 - bool focaltech_supported(void) 428 - { 429 - return true; 430 - } 431 - 432 427 #else /* CONFIG_MOUSE_PS2_FOCALTECH */ 433 428 434 429 int focaltech_init(struct psmouse *psmouse) ··· 431 436 focaltech_reset(psmouse); 432 437 433 438 return 0; 434 - } 435 - 436 - bool focaltech_supported(void) 437 - { 438 - return false; 439 439 } 440 440 441 441 #endif /* CONFIG_MOUSE_PS2_FOCALTECH */
-1
drivers/input/mouse/focaltech.h
··· 19 19 20 20 int focaltech_detect(struct psmouse *psmouse, bool set_properties); 21 21 int focaltech_init(struct psmouse *psmouse); 22 - bool focaltech_supported(void); 23 22 24 23 #endif
+3 -3
drivers/input/mouse/psmouse-base.c
··· 727 727 if (psmouse_do_detect(focaltech_detect, psmouse, set_properties) == 0) { 728 728 if (max_proto > PSMOUSE_IMEX) { 729 729 if (!set_properties || focaltech_init(psmouse) == 0) { 730 - if (focaltech_supported()) 730 + if (IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH)) 731 731 return PSMOUSE_FOCALTECH; 732 732 /* 733 733 * Note that we need to also restrict ··· 776 776 * Try activating protocol, but check if support is enabled first, since 777 777 * we try detecting Synaptics even when protocol is disabled. 778 778 */ 779 - if (synaptics_supported() && 779 + if (IS_ENABLED(CONFIG_MOUSE_PS2_SYNAPTICS) && 780 780 (!set_properties || synaptics_init(psmouse) == 0)) { 781 781 return PSMOUSE_SYNAPTICS; 782 782 } ··· 801 801 */ 802 802 if (max_proto > PSMOUSE_IMEX && 803 803 cypress_detect(psmouse, set_properties) == 0) { 804 - if (cypress_supported()) { 804 + if (IS_ENABLED(CONFIG_MOUSE_PS2_CYPRESS)) { 805 805 if (cypress_init(psmouse) == 0) 806 806 return PSMOUSE_CYPRESS; 807 807
-10
drivers/input/mouse/synaptics.c
··· 1454 1454 return __synaptics_init(psmouse, false); 1455 1455 } 1456 1456 1457 - bool synaptics_supported(void) 1458 - { 1459 - return true; 1460 - } 1461 - 1462 1457 #else /* CONFIG_MOUSE_PS2_SYNAPTICS */ 1463 1458 1464 1459 void __init synaptics_module_init(void) ··· 1463 1468 int synaptics_init(struct psmouse *psmouse) 1464 1469 { 1465 1470 return -ENOSYS; 1466 - } 1467 - 1468 - bool synaptics_supported(void) 1469 - { 1470 - return false; 1471 1471 } 1472 1472 1473 1473 #endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
-1
drivers/input/mouse/synaptics.h
··· 175 175 int synaptics_init(struct psmouse *psmouse); 176 176 int synaptics_init_relative(struct psmouse *psmouse); 177 177 void synaptics_reset(struct psmouse *psmouse); 178 - bool synaptics_supported(void); 179 178 180 179 #endif /* _SYNAPTICS_H */