Advertisement
Guest User

linux3.18.1-3-focaltech

a guest
Jan 8th, 2015
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.47 KB | None | 0 0
  1. --- linux-3.18.1/drivers/input/mouse/focaltech.c 2014-12-16 18:39:45.000000000 +0100
  2. +++ ubuntu-fixes-pilot6/drivers/input/mouse/focaltech.c 2014-12-16 11:11:57.000000000 +0100
  3. @@ -2,6 +2,7 @@
  4. * Focaltech TouchPad PS/2 mouse driver
  5. *
  6. * Copyright (c) 2014 Red Hat Inc.
  7. + * Copyright (c) 2014 Mathias Gottschlag <mgottschlag@gmail.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. @@ -13,15 +14,14 @@
  12. * Hans de Goede <hdegoede@redhat.com>
  13. */
  14.  
  15. -/*
  16. - * The Focaltech PS/2 touchpad protocol is unknown. This drivers deals with
  17. - * detection only, to avoid further detection attempts confusing the touchpad
  18. - * this way it at least works in PS/2 mouse compatibility mode.
  19. - */
  20.  
  21. #include <linux/device.h>
  22. #include <linux/libps2.h>
  23. +#include <linux/input/mt.h>
  24. +#include <linux/serio.h>
  25. +#include <linux/slab.h>
  26. #include "psmouse.h"
  27. +#include "focaltech.h"
  28.  
  29. static const char * const focaltech_pnp_ids[] = {
  30. "FLT0101",
  31. @@ -30,6 +30,12 @@
  32. NULL
  33. };
  34.  
  35. +/*
  36. + * Even if the kernel is built without support for Focaltech PS/2 touchpads (or
  37. + * when the real driver fails to recognize the device), we still have to detect
  38. + * them in order to avoid further detection attempts confusing the touchpad.
  39. + * This way it at least works in PS/2 mouse compatibility mode.
  40. + */
  41. int focaltech_detect(struct psmouse *psmouse, bool set_properties)
  42. {
  43. if (!psmouse_matches_pnp_id(psmouse, focaltech_pnp_ids))
  44. @@ -37,16 +43,309 @@
  45.  
  46. if (set_properties) {
  47. psmouse->vendor = "FocalTech";
  48. - psmouse->name = "FocalTech Touchpad in mouse emulation mode";
  49. + psmouse->name = "FocalTech Touchpad";
  50. }
  51.  
  52. return 0;
  53. }
  54.  
  55. -int focaltech_init(struct psmouse *psmouse)
  56. +static void focaltech_reset(struct psmouse *psmouse)
  57. {
  58. ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
  59. psmouse_reset(psmouse);
  60. +}
  61. +
  62. +#ifdef CONFIG_MOUSE_PS2_FOCALTECH
  63. +
  64. +static void focaltech_report_state(struct psmouse *psmouse)
  65. +{
  66. + int i;
  67. + struct focaltech_data *priv = psmouse->private;
  68. + struct focaltech_hw_state *state = &priv->state;
  69. + struct input_dev *dev = psmouse->dev;
  70. +
  71. + for (i = 0; i < FOC_MAX_FINGERS; i++) {
  72. + struct focaltech_finger_state *finger = &state->fingers[i];
  73. + bool active = finger->active && finger->valid;
  74. + input_mt_slot(dev, i);
  75. + input_mt_report_slot_state(dev, MT_TOOL_FINGER, active);
  76. + if (active) {
  77. + input_report_abs(dev, ABS_MT_POSITION_X, finger->x);
  78. + input_report_abs(dev, ABS_MT_POSITION_Y,
  79. + focaltech_invert_y(finger->y));
  80. + }
  81. + }
  82. + input_mt_report_pointer_emulation(dev, true);
  83. +
  84. + input_report_key(psmouse->dev, BTN_LEFT, state->pressed);
  85. + input_sync(psmouse->dev);
  86. +}
  87. +
  88. +static void process_touch_packet(struct focaltech_hw_state *state,
  89. + unsigned char *packet)
  90. +{
  91. + int i;
  92. + unsigned char fingers = packet[1];
  93. +
  94. + state->pressed = (packet[0] >> 4) & 1;
  95. + /* the second byte contains a bitmap of all fingers touching the pad */
  96. + for (i = 0; i < FOC_MAX_FINGERS; i++) {
  97. + state->fingers[i].active = fingers & 0x1;
  98. + if (!state->fingers[i].active) {
  99. + /* even when the finger becomes active again, we still
  100. + * will have to wait for the first valid position */
  101. + state->fingers[i].valid = false;
  102. + }
  103. + fingers >>= 1;
  104. + }
  105. +}
  106. +
  107. +static void process_abs_packet(struct psmouse *psmouse,
  108. + unsigned char *packet)
  109. +{
  110. + struct focaltech_data *priv = psmouse->private;
  111. + struct focaltech_hw_state *state = &priv->state;
  112. + unsigned int finger;
  113. +
  114. + finger = (packet[1] >> 4) - 1;
  115. + if (finger >= FOC_MAX_FINGERS) {
  116. + psmouse_err(psmouse, "Invalid finger in abs packet: %d",
  117. + finger);
  118. + return;
  119. + }
  120. +
  121. + state->pressed = (packet[0] >> 4) & 1;
  122. + /*
  123. + * packet[5] contains some kind of tool size in the most significant
  124. + * nibble. 0xff is a special value (latching) that signals a large
  125. + * contact area.
  126. + */
  127. + if (packet[5] == 0xff) {
  128. + state->fingers[finger].valid = false;
  129. + return;
  130. + }
  131. + state->fingers[finger].x = ((packet[1] & 0xf) << 8) | packet[2];
  132. + state->fingers[finger].y = (packet[3] << 8) | packet[4];
  133. + state->fingers[finger].valid = true;
  134. +}
  135. +
  136. +static void process_rel_packet(struct psmouse *psmouse,
  137. + unsigned char *packet)
  138. +{
  139. + struct focaltech_data *priv = psmouse->private;
  140. + struct focaltech_hw_state *state = &priv->state;
  141. + int finger1, finger2;
  142. +
  143. + state->pressed = packet[0] >> 7;
  144. + finger1 = ((packet[0] >> 4) & 0x7) - 1;
  145. + if (finger1 < FOC_MAX_FINGERS) {
  146. + state->fingers[finger1].x += (char)packet[1];
  147. + state->fingers[finger1].y += (char)packet[2];
  148. + } else {
  149. + psmouse_err(psmouse, "First finger in rel packet invalid: %d",
  150. + finger1);
  151. + }
  152. + /*
  153. + * If there is an odd number of fingers, the last relative packet only
  154. + * contains one finger. In this case, the second finger index in the
  155. + * packet is 0 (we subtract 1 in the lines above to create array
  156. + * indices, so the finger will overflow and be above FOC_MAX_FINGERS).
  157. + */
  158. + finger2 = ((packet[3] >> 4) & 0x7) - 1;
  159. + if (finger2 < FOC_MAX_FINGERS) {
  160. + state->fingers[finger2].x += (char)packet[4];
  161. + state->fingers[finger2].y += (char)packet[5];
  162. + }
  163. +}
  164. +
  165. +static void focaltech_process_packet(struct psmouse *psmouse)
  166. +{
  167. + struct focaltech_data *priv = psmouse->private;
  168. + unsigned char *packet = psmouse->packet;
  169. +
  170. + switch (packet[0] & 0xf) {
  171. + case FOC_TOUCH:
  172. + process_touch_packet(&priv->state, packet);
  173. + break;
  174. + case FOC_ABS:
  175. + process_abs_packet(psmouse, packet);
  176. + break;
  177. + case FOC_REL:
  178. + process_rel_packet(psmouse, packet);
  179. + break;
  180. + default:
  181. + psmouse_err(psmouse, "Unknown packet type: %02x", packet[0]);
  182. + break;
  183. + }
  184. +
  185. + focaltech_report_state(psmouse);
  186. +}
  187. +
  188. +static psmouse_ret_t focaltech_process_byte(struct psmouse *psmouse)
  189. +{
  190. + if (psmouse->pktcnt >= 6) { /* Full packet received */
  191. + focaltech_process_packet(psmouse);
  192. + return PSMOUSE_FULL_PACKET;
  193. + }
  194. + /*
  195. + * we might want to do some validation of the data here, but we do not
  196. + * know the protocoll well enough
  197. + */
  198. + return PSMOUSE_GOOD_DATA;
  199. +}
  200. +
  201. +static int focaltech_switch_protocol(struct psmouse *psmouse)
  202. +{
  203. + struct ps2dev *ps2dev = &psmouse->ps2dev;
  204. + unsigned char param[3];
  205. +
  206. + param[0] = 0;
  207. + if (ps2_command(ps2dev, param, 0x10f8))
  208. + return -EIO;
  209. + if (ps2_command(ps2dev, param, 0x10f8))
  210. + return -EIO;
  211. + if (ps2_command(ps2dev, param, 0x10f8))
  212. + return -EIO;
  213. + param[0] = 1;
  214. + if (ps2_command(ps2dev, param, 0x10f8))
  215. + return -EIO;
  216. + if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETSCALE11))
  217. + return -EIO;
  218. +
  219. + if (ps2_command(ps2dev, param, PSMOUSE_CMD_ENABLE))
  220. + return -EIO;
  221. +
  222. + return 0;
  223. +}
  224. +
  225. +static void focaltech_disconnect(struct psmouse *psmouse)
  226. +{
  227. + focaltech_reset(psmouse);
  228. + kfree(psmouse->private);
  229. + psmouse->private = NULL;
  230. +}
  231. +
  232. +static int focaltech_reconnect(struct psmouse *psmouse)
  233. +{
  234. + focaltech_reset(psmouse);
  235. + if (focaltech_switch_protocol(psmouse)) {
  236. + psmouse_err(psmouse,
  237. + "Unable to initialize the device.");
  238. + return -1;
  239. + }
  240. + return 0;
  241. +}
  242. +
  243. +static void set_input_params(struct psmouse *psmouse)
  244. +{
  245. + struct input_dev *dev = psmouse->dev;
  246. + struct focaltech_data *priv = psmouse->private;
  247. +
  248. + __set_bit(EV_ABS, dev->evbit);
  249. + input_set_abs_params(dev, ABS_MT_POSITION_X, 0, priv->x_max, 0, 0);
  250. + input_set_abs_params(dev, ABS_MT_POSITION_Y, 0, priv->y_max, 0, 0);
  251. + input_mt_init_slots(dev, 5, INPUT_MT_POINTER);
  252. + __clear_bit(EV_REL, dev->evbit);
  253. + __clear_bit(REL_X, dev->relbit);
  254. + __clear_bit(REL_Y, dev->relbit);
  255. + __clear_bit(BTN_RIGHT, dev->keybit);
  256. + __clear_bit(BTN_MIDDLE, dev->keybit);
  257. + __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
  258. +}
  259. +
  260. +static int focaltech_read_register(struct ps2dev *ps2dev, int reg,
  261. + unsigned char *param)
  262. +{
  263. + if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETSCALE11))
  264. + return -EIO;
  265. + param[0] = 0;
  266. + if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES))
  267. + return -EIO;
  268. + if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES))
  269. + return -EIO;
  270. + if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES))
  271. + return -EIO;
  272. + param[0] = reg;
  273. + if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES))
  274. + return -EIO;
  275. + if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO))
  276. + return -EIO;
  277. + return 0;
  278. +}
  279. +
  280. +static int focaltech_read_size(struct psmouse *psmouse)
  281. +{
  282. + struct ps2dev *ps2dev = &psmouse->ps2dev;
  283. + struct focaltech_data *priv = psmouse->private;
  284. + char param[3];
  285. +
  286. + if (focaltech_read_register(ps2dev, 2, param))
  287. + return -EIO;
  288. + /* not sure whether this is 100% correct */
  289. + priv->x_max = (unsigned char)param[1] * 128;
  290. + priv->y_max = (unsigned char)param[2] * 128;
  291. +
  292. + return 0;
  293. +}
  294. +int focaltech_init(struct psmouse *psmouse)
  295. +{
  296. + struct focaltech_data *priv;
  297. + int err;
  298. +
  299. + psmouse->private = priv = kzalloc(sizeof(struct focaltech_data), GFP_KERNEL);
  300. + if (!priv)
  301. + return -ENOMEM;
  302. +
  303. + focaltech_reset(psmouse);
  304. + err = focaltech_read_size(psmouse);
  305. + if (err) {
  306. + focaltech_reset(psmouse);
  307. + psmouse_err(psmouse,
  308. + "Unable to read the size of the touchpad.");
  309. + goto fail;
  310. + }
  311. + if (focaltech_switch_protocol(psmouse)) {
  312. + focaltech_reset(psmouse);
  313. + psmouse_err(psmouse,
  314. + "Unable to initialize the device.");
  315. + err = -ENOSYS;
  316. + goto fail;
  317. + }
  318. +
  319. + set_input_params(psmouse);
  320. +
  321. + psmouse->protocol_handler = focaltech_process_byte;
  322. + psmouse->pktsize = 6;
  323. + psmouse->disconnect = focaltech_disconnect;
  324. + psmouse->reconnect = focaltech_reconnect;
  325. + psmouse->cleanup = focaltech_reset;
  326. + /* resync is not supported yet */
  327. + psmouse->resync_time = 0;
  328.  
  329. return 0;
  330. +fail:
  331. + focaltech_reset(psmouse);
  332. + kfree(priv);
  333. + return err;
  334. +}
  335. +
  336. +bool focaltech_supported(void)
  337. +{
  338. + return true;
  339. }
  340. +
  341. +#else /* CONFIG_MOUSE_PS2_FOCALTECH */
  342. +
  343. +int focaltech_init(struct psmouse *psmouse)
  344. +{
  345. + focaltech_reset(psmouse);
  346. +
  347. + return 0;
  348. +}
  349. +
  350. +bool focaltech_supported(void)
  351. +{
  352. + return false;
  353. +}
  354. +
  355. +#endif /* CONFIG_MOUSE_PS2_FOCALTECH */
  356. diff -uNr linux-3.18.1/drivers/input/mouse/focaltech.h ubuntu-fixes-pilot6/drivers/input/mouse/focaltech.h
  357. --- linux-3.18.1/drivers/input/mouse/focaltech.h 2014-12-16 18:39:45.000000000 +0100
  358. +++ ubuntu-fixes-pilot6/drivers/input/mouse/focaltech.h 2014-12-16 11:11:57.000000000 +0100
  359. @@ -2,6 +2,7 @@
  360. * Focaltech TouchPad PS/2 mouse driver
  361. *
  362. * Copyright (c) 2014 Red Hat Inc.
  363. + * Copyright (c) 2014 Mathias Gottschlag <mgottschlag@gmail.com>
  364. *
  365. * This program is free software; you can redistribute it and/or modify
  366. * it under the terms of the GNU General Public License as published by
  367. @@ -16,7 +17,66 @@
  368. #ifndef _FOCALTECH_H
  369. #define _FOCALTECH_H
  370.  
  371. +/*
  372. + * Packet types - the numbers are not consecutive, so we might be missing
  373. + * something here.
  374. + */
  375. +#define FOC_TOUCH 0x3 /* bitmap of active fingers */
  376. +#define FOC_ABS 0x6 /* absolute position of one finger */
  377. +#define FOC_REL 0x9 /* relative position of 1-2 fingers */
  378. +
  379. +#define FOC_MAX_FINGERS 5
  380. +
  381. +#define FOC_MAX_X 2431
  382. +#define FOC_MAX_Y 1663
  383. +
  384. +static inline int focaltech_invert_y(int y)
  385. +{
  386. + return FOC_MAX_Y - y;
  387. +}
  388. +
  389. +/*
  390. + * Current state of a single finger on the touchpad.
  391. + */
  392. +struct focaltech_finger_state {
  393. + /* the touchpad has generated a touch event for the finger */
  394. + bool active;
  395. + /*
  396. + * The touchpad has sent position data for the finger. The flag is 0
  397. + * when the finger is not active, and there is a time between the first
  398. + * touch event for the finger and the following absolute position
  399. + * packet for the finger where the touchpad has declared the finger to
  400. + * be valid, but we do not have any valid position yet.
  401. + */
  402. + bool valid;
  403. + /* absolute position (from the bottom left corner) of the finger */
  404. + unsigned int x;
  405. + unsigned int y;
  406. +};
  407. +
  408. +/*
  409. + * Description of the current state of the touchpad hardware.
  410. + */
  411. +struct focaltech_hw_state {
  412. + /*
  413. + * The touchpad tracks the positions of the fingers for us, the array
  414. + * indices correspond to the finger indices returned in the report
  415. + * packages.
  416. + */
  417. + struct focaltech_finger_state fingers[FOC_MAX_FINGERS];
  418. + /*
  419. + * True if the clickpad has been pressed.
  420. + */
  421. + bool pressed;
  422. +};
  423. +
  424. +struct focaltech_data {
  425. + unsigned int x_max, y_max;
  426. + struct focaltech_hw_state state;
  427. +};
  428. +
  429. int focaltech_detect(struct psmouse *psmouse, bool set_properties);
  430. int focaltech_init(struct psmouse *psmouse);
  431. +bool focaltech_supported(void);
  432.  
  433. #endif
  434. diff -uNr linux-3.18.1/drivers/input/mouse/Kconfig ubuntu-fixes-pilot6/drivers/input/mouse/Kconfig
  435. --- linux-3.18.1/drivers/input/mouse/Kconfig 2014-12-16 18:39:45.000000000 +0100
  436. +++ ubuntu-fixes-pilot6/drivers/input/mouse/Kconfig 2014-12-16 11:11:57.000000000 +0100
  437. @@ -146,6 +146,17 @@
  438.  
  439. If unsure, say N.
  440.  
  441. +config MOUSE_PS2_FOCALTECH
  442. + bool "FocalTech PS/2 mouse protocol extension" if EXPERT
  443. + default y
  444. + depends on MOUSE_PS2
  445. + help
  446. + Say Y here if you have a FocalTech PS/2 TouchPad connected to
  447. + your system.
  448. +
  449. + If unsure, say Y.
  450. +
  451. +
  452. config MOUSE_SERIAL
  453. tristate "Serial mouse"
  454. select SERIO
  455. diff -uNr linux-3.18.1/drivers/input/mouse/psmouse-base.c ubuntu-fixes-pilot6/drivers/input/mouse/psmouse-base.c
  456. --- linux-3.18.1/drivers/input/mouse/psmouse-base.c 2014-12-16 18:39:45.000000000 +0100
  457. +++ ubuntu-fixes-pilot6/drivers/input/mouse/psmouse-base.c 2014-12-16 11:11:57.000000000 +0100
  458. @@ -685,8 +685,6 @@
  459. __set_bit(REL_X, input_dev->relbit);
  460. __set_bit(REL_Y, input_dev->relbit);
  461.  
  462. - __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
  463. -
  464. psmouse->set_rate = psmouse_set_rate;
  465. psmouse->set_resolution = psmouse_set_resolution;
  466. psmouse->poll = psmouse_poll;
  467. @@ -725,16 +723,19 @@
  468.  
  469. /* Always check for focaltech, this is safe as it uses pnp-id matching */
  470. if (psmouse_do_detect(focaltech_detect, psmouse, set_properties) == 0) {
  471. - if (!set_properties || focaltech_init(psmouse) == 0) {
  472. - /*
  473. - * Not supported yet, use bare protocol.
  474. - * Note that we need to also restrict
  475. - * psmouse_max_proto so that psmouse_initialize()
  476. - * does not try to reset rate and resolution,
  477. - * because even that upsets the device.
  478. - */
  479. - psmouse_max_proto = PSMOUSE_PS2;
  480. - return PSMOUSE_PS2;
  481. + if (max_proto > PSMOUSE_IMEX) {
  482. + if (!set_properties || focaltech_init(psmouse) == 0) {
  483. + if (focaltech_supported())
  484. + return PSMOUSE_FOCALTECH;
  485. + /*
  486. + * Note that we need to also restrict
  487. + * psmouse_max_proto so that psmouse_initialize()
  488. + * does not try to reset rate and resolution,
  489. + * because even that upsets the device.
  490. + */
  491. + psmouse_max_proto = PSMOUSE_PS2;
  492. + return PSMOUSE_PS2;
  493. + }
  494. }
  495. }
  496.  
  497. @@ -1063,6 +1064,15 @@
  498. .alias = "cortps",
  499. .detect = cortron_detect,
  500. },
  501. +#ifdef CONFIG_MOUSE_PS2_FOCALTECH
  502. + {
  503. + .type = PSMOUSE_FOCALTECH,
  504. + .name = "FocalTechPS/2",
  505. + .alias = "focaltech",
  506. + .detect = focaltech_detect,
  507. + .init = focaltech_init,
  508. + },
  509. +#endif
  510. {
  511. .type = PSMOUSE_AUTO,
  512. .name = "auto",
  513. @@ -1536,9 +1546,16 @@
  514. {
  515. struct psmouse *psmouse = serio_get_drvdata(serio);
  516. struct psmouse *parent = NULL;
  517. + struct serio_driver *drv = serio->drv;
  518. unsigned char type;
  519. int rc = -1;
  520.  
  521. + if (!drv || !psmouse) {
  522. + psmouse_dbg(psmouse,
  523. + "reconnect request, but serio is disconnected, ignoring...\n");
  524. + return -1;
  525. + }
  526. +
  527. mutex_lock(&psmouse_mutex);
  528.  
  529. if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) {
  530. diff -uNr linux-3.18.1/drivers/input/mouse/psmouse.h ubuntu-fixes-pilot6/drivers/input/mouse/psmouse.h
  531. --- linux-3.18.1/drivers/input/mouse/psmouse.h 2014-12-16 18:39:45.000000000 +0100
  532. +++ ubuntu-fixes-pilot6/drivers/input/mouse/psmouse.h 2014-12-16 11:11:57.000000000 +0100
  533. @@ -96,6 +96,7 @@
  534. PSMOUSE_FSP,
  535. PSMOUSE_SYNAPTICS_RELATIVE,
  536. PSMOUSE_CYPRESS,
  537. + PSMOUSE_FOCALTECH,
  538. PSMOUSE_AUTO /* This one should always be last */
  539. };
  540.  
  541. diff -uNr linux-3.18.1/drivers/input/mouse/synaptics.c ubuntu-fixes-pilot6/drivers/input/mouse/synaptics.c
  542. --- linux-3.18.1/drivers/input/mouse/synaptics.c 2014-12-16 18:39:45.000000000 +0100
  543. +++ ubuntu-fixes-pilot6/drivers/input/mouse/synaptics.c 2014-12-16 11:11:57.000000000 +0100
  544. @@ -117,9 +117,6 @@
  545. }
  546.  
  547. #ifdef CONFIG_MOUSE_PS2_SYNAPTICS
  548. -
  549. -static bool cr48_profile_sensor;
  550. -
  551. struct min_max_quirk {
  552. const char * const *pnp_ids;
  553. int x_min, x_max, y_min, y_max;
  554. @@ -143,10 +140,6 @@
  555. (const char * const []){"LEN2001", NULL},
  556. 1024, 5022, 2508, 4832
  557. },
  558. - {
  559. - (const char * const []){"LEN2006", NULL},
  560. - 1264, 5675, 1171, 4688
  561. - },
  562. { }
  563. };
  564.  
  565. @@ -190,6 +183,7 @@
  566. NULL
  567. };
  568.  
  569. +
  570. /*****************************************************************************
  571. * Synaptics communications functions
  572. ****************************************************************************/
  573. @@ -355,8 +349,7 @@
  574. }
  575.  
  576. for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
  577. - if (psmouse_matches_pnp_id(psmouse,
  578. - min_max_pnpid_table[i].pnp_ids)) {
  579. + if (psmouse_matches_pnp_id(psmouse, min_max_pnpid_table[i].pnp_ids)) {
  580. priv->x_min = min_max_pnpid_table[i].x_min;
  581. priv->x_max = min_max_pnpid_table[i].x_max;
  582. priv->y_min = min_max_pnpid_table[i].y_min;
  583. @@ -1187,42 +1180,6 @@
  584. priv->agm_pending = false;
  585. }
  586.  
  587. -static void synaptics_profile_sensor_process(struct psmouse *psmouse,
  588. - struct synaptics_hw_state *sgm,
  589. - int num_fingers)
  590. -{
  591. - struct input_dev *dev = psmouse->dev;
  592. - struct synaptics_data *priv = psmouse->private;
  593. - struct synaptics_hw_state *hw[2] = { sgm, &priv->agm };
  594. - struct input_mt_pos pos[2];
  595. - int slot[2], nsemi, i;
  596. -
  597. - nsemi = clamp_val(num_fingers, 0, 2);
  598. -
  599. - for (i = 0; i < nsemi; i++) {
  600. - pos[i].x = hw[i]->x;
  601. - pos[i].y = synaptics_invert_y(hw[i]->y);
  602. - }
  603. -
  604. - input_mt_assign_slots(dev, slot, pos, nsemi);
  605. -
  606. - for (i = 0; i < nsemi; i++) {
  607. - input_mt_slot(dev, slot[i]);
  608. - input_mt_report_slot_state(dev, MT_TOOL_FINGER, true);
  609. - input_report_abs(dev, ABS_MT_POSITION_X, pos[i].x);
  610. - input_report_abs(dev, ABS_MT_POSITION_Y, pos[i].y);
  611. - input_report_abs(dev, ABS_MT_PRESSURE, hw[i]->z);
  612. - }
  613. -
  614. - input_mt_drop_unused(dev);
  615. - input_mt_report_pointer_emulation(dev, false);
  616. - input_mt_report_finger_count(dev, num_fingers);
  617. -
  618. - synaptics_report_buttons(psmouse, sgm);
  619. -
  620. - input_sync(dev);
  621. -}
  622. -
  623. /*
  624. * called for each full received packet from the touchpad
  625. */
  626. @@ -1286,11 +1243,6 @@
  627. finger_width = 0;
  628. }
  629.  
  630. - if (cr48_profile_sensor) {
  631. - synaptics_profile_sensor_process(psmouse, &hw, num_fingers);
  632. - return;
  633. - }
  634. -
  635. if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c))
  636. synaptics_report_semi_mt_data(dev, &hw, &priv->agm,
  637. num_fingers);
  638. @@ -1436,9 +1388,6 @@
  639. set_abs_position_params(dev, priv, ABS_X, ABS_Y);
  640. input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0);
  641.  
  642. - if (cr48_profile_sensor)
  643. - input_set_abs_params(dev, ABS_MT_PRESSURE, 0, 255, 0, 0);
  644. -
  645. if (SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) {
  646. set_abs_position_params(dev, priv, ABS_MT_POSITION_X,
  647. ABS_MT_POSITION_Y);
  648. @@ -1450,16 +1399,11 @@
  649. __set_bit(BTN_TOOL_QUADTAP, dev->keybit);
  650. __set_bit(BTN_TOOL_QUINTTAP, dev->keybit);
  651. } else if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) {
  652. + /* Non-image sensors with AGM use semi-mt */
  653. + __set_bit(INPUT_PROP_SEMI_MT, dev->propbit);
  654. + input_mt_init_slots(dev, 2, 0);
  655. set_abs_position_params(dev, priv, ABS_MT_POSITION_X,
  656. ABS_MT_POSITION_Y);
  657. - /*
  658. - * Profile sensor in CR-48 tracks contacts reasonably well,
  659. - * other non-image sensors with AGM use semi-mt.
  660. - */
  661. - input_mt_init_slots(dev, 2,
  662. - INPUT_MT_POINTER |
  663. - (cr48_profile_sensor ?
  664. - INPUT_MT_TRACK : INPUT_MT_SEMI_MT));
  665. }
  666.  
  667. if (SYN_CAP_PALMDETECT(priv->capabilities))
  668. @@ -1493,7 +1437,9 @@
  669. /* Clickpads report only left button */
  670. __clear_bit(BTN_RIGHT, dev->keybit);
  671. __clear_bit(BTN_MIDDLE, dev->keybit);
  672. - }
  673. + } else if (SYN_CAP_CLICKPAD2BTN(priv->ext_cap_0c) ||
  674. + SYN_CAP_CLICKPAD2BTN2(priv->ext_cap_0c))
  675. + __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
  676. }
  677.  
  678. static ssize_t synaptics_show_disable_gesture(struct psmouse *psmouse,
  679. @@ -1661,19 +1607,6 @@
  680. { }
  681. };
  682.  
  683. -static const struct dmi_system_id __initconst cr48_dmi_table[] = {
  684. -#if defined(CONFIG_DMI) && defined(CONFIG_X86)
  685. - {
  686. - /* Cr-48 Chromebook (Codename Mario) */
  687. - .matches = {
  688. - DMI_MATCH(DMI_SYS_VENDOR, "IEC"),
  689. - DMI_MATCH(DMI_PRODUCT_NAME, "Mario"),
  690. - },
  691. - },
  692. -#endif
  693. - { }
  694. -};
  695. -
  696. static const struct dmi_system_id forcepad_dmi_table[] __initconst = {
  697. #if defined(CONFIG_DMI) && defined(CONFIG_X86)
  698. {
  699. @@ -1690,7 +1623,6 @@
  700. {
  701. impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
  702. broken_olpc_ec = dmi_check_system(olpc_dmi_table);
  703. - cr48_profile_sensor = dmi_check_system(cr48_dmi_table);
  704.  
  705. /*
  706. * Unfortunately ForcePad capability is not exported over PS/2,
  707. diff -uNr linux-3.18.1/drivers/input/mouse/synaptics.h ubuntu-fixes-pilot6/drivers/input/mouse/synaptics.h
  708. --- linux-3.18.1/drivers/input/mouse/synaptics.h 2014-12-16 18:39:45.000000000 +0100
  709. +++ ubuntu-fixes-pilot6/drivers/input/mouse/synaptics.h 2014-12-16 11:11:57.000000000 +0100
  710. @@ -83,6 +83,7 @@
  711. */
  712. #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */
  713. #define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */
  714. +#define SYN_CAP_CLICKPAD2BTN2(ex0c) ((ex0c) & 0x200000) /* 2-button ClickPad */
  715. #define SYN_CAP_MAX_DIMENSIONS(ex0c) ((ex0c) & 0x020000)
  716. #define SYN_CAP_MIN_DIMENSIONS(ex0c) ((ex0c) & 0x002000)
  717. #define SYN_CAP_ADV_GESTURE(ex0c) ((ex0c) & 0x080000)
  718. diff -uNr linux-3.18.1/drivers/input/mouse/synaptics_usb.c ubuntu-fixes-pilot6/drivers/input/mouse/synaptics_usb.c
  719. --- linux-3.18.1/drivers/input/mouse/synaptics_usb.c 2014-12-16 18:39:45.000000000 +0100
  720. +++ ubuntu-fixes-pilot6/drivers/input/mouse/synaptics_usb.c 2014-12-16 11:11:57.000000000 +0100
  721. @@ -387,7 +387,6 @@
  722. __set_bit(EV_REL, input_dev->evbit);
  723. __set_bit(REL_X, input_dev->relbit);
  724. __set_bit(REL_Y, input_dev->relbit);
  725. - __set_bit(INPUT_PROP_POINTING_STICK, input_dev->propbit);
  726. input_set_abs_params(input_dev, ABS_PRESSURE, 0, 127, 0, 0);
  727. } else {
  728. input_set_abs_params(input_dev, ABS_X,
  729. @@ -402,11 +401,6 @@
  730. __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit);
  731. }
  732.  
  733. - if (synusb->flags & SYNUSB_TOUCHSCREEN)
  734. - __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
  735. - else
  736. - __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
  737. -
  738. __set_bit(BTN_LEFT, input_dev->keybit);
  739. __set_bit(BTN_RIGHT, input_dev->keybit);
  740. __set_bit(BTN_MIDDLE, input_dev->keybit);
  741. diff -uNr linux-3.18.1/drivers/input/mouse/trackpoint.c ubuntu-fixes-pilot6/drivers/input/mouse/trackpoint.c
  742. --- linux-3.18.1/drivers/input/mouse/trackpoint.c 2014-12-16 18:39:45.000000000 +0100
  743. +++ ubuntu-fixes-pilot6/drivers/input/mouse/trackpoint.c 2014-12-16 11:11:57.000000000 +0100
  744. @@ -393,9 +393,6 @@
  745. if ((button_info & 0x0f) >= 3)
  746. __set_bit(BTN_MIDDLE, psmouse->dev->keybit);
  747.  
  748. - __set_bit(INPUT_PROP_POINTER, psmouse->dev->propbit);
  749. - __set_bit(INPUT_PROP_POINTING_STICK, psmouse->dev->propbit);
  750. -
  751. trackpoint_defaults(psmouse->private);
  752.  
  753. error = trackpoint_power_on_reset(&psmouse->ps2dev);
  754. diff -uNr linux-3.18.1/drivers/input/mouse/vsxxxaa.c ubuntu-fixes-pilot6/drivers/input/mouse/vsxxxaa.c
  755. --- linux-3.18.1/drivers/input/mouse/vsxxxaa.c 2014-12-16 18:39:45.000000000 +0100
  756. +++ ubuntu-fixes-pilot6/drivers/input/mouse/vsxxxaa.c 2014-12-16 11:11:57.000000000 +0100
  757. @@ -128,7 +128,7 @@
  758. if (num >= mouse->count) {
  759. mouse->count = 0;
  760. } else {
  761. - memmove(mouse->buf, mouse->buf + num, BUFLEN - num);
  762. + memmove(mouse->buf, mouse->buf + num - 1, BUFLEN - num);
  763. mouse->count -= num;
  764. }
  765. }
  766. diff -uNr linux-3.18.1/drivers/input/serio/altera_ps2.c ubuntu-fixes-pilot6/drivers/input/serio/altera_ps2.c
  767. --- linux-3.18.1/drivers/input/serio/altera_ps2.c 2014-12-16 18:39:45.000000000 +0100
  768. +++ ubuntu-fixes-pilot6/drivers/input/serio/altera_ps2.c 2014-12-16 11:11:57.000000000 +0100
  769. @@ -37,7 +37,7 @@
  770. {
  771. struct ps2if *ps2if = dev_id;
  772. unsigned int status;
  773. - irqreturn_t handled = IRQ_NONE;
  774. + int handled = IRQ_NONE;
  775.  
  776. while ((status = readl(ps2if->base)) & 0xffff0000) {
  777. serio_interrupt(ps2if->io, status & 0xff, 0);
  778. @@ -74,7 +74,7 @@
  779. {
  780. struct ps2if *ps2if = io->port_data;
  781.  
  782. - writel(0, ps2if->base + 4); /* disable rx irq */
  783. + writel(0, ps2if->base); /* disable rx irq */
  784. }
  785.  
  786. /*
  787. diff -uNr linux-3.18.1/drivers/input/serio/hyperv-keyboard.c ubuntu-fixes-pilot6/drivers/input/serio/hyperv-keyboard.c
  788. --- linux-3.18.1/drivers/input/serio/hyperv-keyboard.c 2014-12-16 18:39:45.000000000 +0100
  789. +++ ubuntu-fixes-pilot6/drivers/input/serio/hyperv-keyboard.c 2014-12-16 11:11:57.000000000 +0100
  790. @@ -170,15 +170,6 @@
  791. serio_interrupt(kbd_dev->hv_serio, scan_code, 0);
  792. }
  793. spin_unlock_irqrestore(&kbd_dev->lock, flags);
  794. -
  795. - /*
  796. - * Only trigger a wakeup on key down, otherwise
  797. - * "echo freeze > /sys/power/state" can't really enter the
  798. - * state because the Enter-UP can trigger a wakeup at once.
  799. - */
  800. - if (!(info & IS_BREAK))
  801. - pm_wakeup_event(&hv_dev->device, 0);
  802. -
  803. break;
  804.  
  805. default:
  806. @@ -385,9 +376,6 @@
  807. goto err_close_vmbus;
  808.  
  809. serio_register_port(kbd_dev->hv_serio);
  810. -
  811. - device_init_wakeup(&hv_dev->device, true);
  812. -
  813. return 0;
  814.  
  815. err_close_vmbus:
  816. @@ -402,7 +390,6 @@
  817. {
  818. struct hv_kbd_dev *kbd_dev = hv_get_drvdata(hv_dev);
  819.  
  820. - device_init_wakeup(&hv_dev->device, false);
  821. serio_unregister_port(kbd_dev->hv_serio);
  822. vmbus_close(hv_dev->channel);
  823. kfree(kbd_dev);
  824. diff -uNr linux-3.18.1/drivers/input/serio/i8042-sparcio.h ubuntu-fixes-pilot6/drivers/input/serio/i8042-sparcio.h
  825. --- linux-3.18.1/drivers/input/serio/i8042-sparcio.h 2014-12-16 18:39:45.000000000 +0100
  826. +++ ubuntu-fixes-pilot6/drivers/input/serio/i8042-sparcio.h 2014-12-16 11:11:57.000000000 +0100
  827. @@ -17,6 +17,7 @@
  828. #define I8042_MUX_PHYS_DESC "sparcps2/serio%d"
  829.  
  830. static void __iomem *kbd_iobase;
  831. +static struct resource *kbd_res;
  832.  
  833. #define I8042_COMMAND_REG (kbd_iobase + 0x64UL)
  834. #define I8042_DATA_REG (kbd_iobase + 0x60UL)
  835. @@ -43,8 +44,6 @@
  836.  
  837. #ifdef CONFIG_PCI
  838.  
  839. -static struct resource *kbd_res;
  840. -
  841. #define OBP_PS2KBD_NAME1 "kb_ps2"
  842. #define OBP_PS2KBD_NAME2 "keyboard"
  843. #define OBP_PS2MS_NAME1 "kdmouse"
  844. diff -uNr linux-3.18.1/drivers/input/serio/i8042-x86ia64io.h ubuntu-fixes-pilot6/drivers/input/serio/i8042-x86ia64io.h
  845. --- linux-3.18.1/drivers/input/serio/i8042-x86ia64io.h 2014-12-16 18:39:45.000000000 +0100
  846. +++ ubuntu-fixes-pilot6/drivers/input/serio/i8042-x86ia64io.h 2014-12-16 11:11:57.000000000 +0100
  847. @@ -472,13 +472,6 @@
  848. },
  849. },
  850. {
  851. - /* Asus X450LCP */
  852. - .matches = {
  853. - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
  854. - DMI_MATCH(DMI_PRODUCT_NAME, "X450LCP"),
  855. - },
  856. - },
  857. - {
  858. /* Avatar AVIU-145A6 */
  859. .matches = {
  860. DMI_MATCH(DMI_SYS_VENDOR, "Intel"),
  861. diff -uNr linux-3.18.1/drivers/input/serio/serio.c ubuntu-fixes-pilot6/drivers/input/serio/serio.c
  862. --- linux-3.18.1/drivers/input/serio/serio.c 2014-12-16 18:39:45.000000000 +0100
  863. +++ ubuntu-fixes-pilot6/drivers/input/serio/serio.c 2014-12-16 11:11:57.000000000 +0100
  864. @@ -524,8 +524,8 @@
  865. spin_lock_init(&serio->lock);
  866. mutex_init(&serio->drv_mutex);
  867. device_initialize(&serio->dev);
  868. - dev_set_name(&serio->dev, "serio%lu",
  869. - (unsigned long)atomic_inc_return(&serio_no) - 1);
  870. + dev_set_name(&serio->dev, "serio%ld",
  871. + (long)atomic_inc_return(&serio_no) - 1);
  872. serio->dev.bus = &serio_bus;
  873. serio->dev.release = serio_release_port;
  874. serio->dev.groups = serio_device_attr_groups;
  875. diff -uNr linux-3.18.1/drivers/input/tablet/Kconfig ubuntu-fixes-pilot6/drivers/input/tablet/Kconfig
  876. --- linux-3.18.1/drivers/input/tablet/Kconfig 2014-12-16 18:39:45.000000000 +0100
  877. +++ ubuntu-fixes-pilot6/drivers/input/tablet/Kconfig 2014-12-16 11:11:57.000000000 +0100
  878. @@ -73,14 +73,20 @@
  879. To compile this driver as a module, choose M here: the
  880. module will be called kbtab.
  881.  
  882. -config TABLET_SERIAL_WACOM4
  883. - tristate "Wacom protocol 4 serial tablet support"
  884. - select SERIO
  885. +config TABLET_USB_WACOM
  886. + tristate "Wacom Intuos/Graphire tablet support (USB)"
  887. + depends on USB_ARCH_HAS_HCD
  888. + select POWER_SUPPLY
  889. + select USB
  890. + select NEW_LEDS
  891. + select LEDS_CLASS
  892. help
  893. - Say Y here if you want to use Wacom protocol 4 serial tablets.
  894. - E.g. serial versions of the Cintiq, Graphire or Penpartner.
  895. + Say Y here if you want to use the USB version of the Wacom Intuos
  896. + or Graphire tablet. Make sure to say Y to "Mouse support"
  897. + (CONFIG_INPUT_MOUSEDEV) and/or "Event interface support"
  898. + (CONFIG_INPUT_EVDEV) as well.
  899.  
  900. To compile this driver as a module, choose M here: the
  901. - module will be called wacom_serial4.
  902. + module will be called wacom.
  903.  
  904. endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement