OSDN Git Service

Merge branch 'next' into for-linus
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 7 Sep 2013 03:23:44 +0000 (20:23 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 7 Sep 2013 03:23:44 +0000 (20:23 -0700)
Merge first round of changes for 3.12 merge window.

1  2 
drivers/input/tablet/wacom_wac.c
drivers/input/touchscreen/cyttsp4_core.c

@@@ -363,7 -363,6 +363,7 @@@ static int wacom_intuos_inout(struct wa
                case 0x140802: /* Intuos4/5 13HD/24HD Classic Pen */
                case 0x160802: /* Cintiq 13HD Pro Pen */
                case 0x180802: /* DTH2242 Pen */
 +              case 0x100802: /* Intuos4/5 13HD/24HD General Pen */
                        wacom->tool[idx] = BTN_TOOL_PEN;
                        break;
  
                case 0x10080c: /* Intuos4/5 13HD/24HD Art Pen Eraser */
                case 0x16080a: /* Cintiq 13HD Pro Pen Eraser */
                case 0x18080a: /* DTH2242 Eraser */
 +              case 0x10080a: /* Intuos4/5 13HD/24HD General Pen Eraser */
                        wacom->tool[idx] = BTN_TOOL_RUBBER;
                        break;
  
@@@ -1445,13 -1443,6 +1445,6 @@@ void wacom_setup_device_quirks(struct w
        }
  }
  
- static unsigned int wacom_calculate_touch_res(unsigned int logical_max,
-                                             unsigned int physical_max)
- {
-        /* Touch physical dimensions are in 100th of mm */
-        return (logical_max * 100) / physical_max;
- }
  static void wacom_abs_set_axis(struct input_dev *input_dev,
                               struct wacom_wac *wacom_wac)
  {
                        input_set_abs_params(input_dev, ABS_Y, 0,
                                features->y_max, features->y_fuzz, 0);
                        input_abs_set_res(input_dev, ABS_X,
-                               wacom_calculate_touch_res(features->x_max,
-                                                       features->x_phy));
+                                         features->x_resolution);
                        input_abs_set_res(input_dev, ABS_Y,
-                               wacom_calculate_touch_res(features->y_max,
-                                                       features->y_phy));
+                                         features->y_resolution);
                }
  
                if (features->touch_max > 1) {
                        input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0,
                                features->y_max, features->y_fuzz, 0);
                        input_abs_set_res(input_dev, ABS_MT_POSITION_X,
-                               wacom_calculate_touch_res(features->x_max,
-                                                       features->x_phy));
+                                         features->x_resolution);
                        input_abs_set_res(input_dev, ABS_MT_POSITION_Y,
-                               wacom_calculate_touch_res(features->y_max,
-                                                       features->y_phy));
+                                         features->y_resolution);
                }
        }
  }
@@@ -2112,7 -2099,7 +2101,7 @@@ static const struct wacom_features waco
        { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN,  14720,  9200, 1023,
          31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
          .touch_max = 2 };
 -static struct wacom_features wacom_features_0xDB =
 +static const struct wacom_features wacom_features_0xDB =
        { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN,  21648, 13700, 1023,
          31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
          .touch_max = 2 };
@@@ -2127,12 -2114,6 +2116,12 @@@ static const struct wacom_features waco
          { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN,    21648, 13700, 1023,
          31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
          .touch_max = 16 };
 +static const struct wacom_features wacom_features_0x300 =
 +      { "Wacom Bamboo One S",    WACOM_PKGLEN_BBPEN,    14720,  9225, 1023,
 +        31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
 +static const struct wacom_features wacom_features_0x301 =
 +      { "Wacom Bamboo One M",    WACOM_PKGLEN_BBPEN,    21648, 13530, 1023,
 +        31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  static const struct wacom_features wacom_features_0x6004 =
        { "ISD-V4",               WACOM_PKGLEN_GRAPHIRE,  12800,  8000,  255,
          0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@@ -2259,8 -2240,6 +2248,8 @@@ const struct usb_device_id wacom_ids[] 
        { USB_DEVICE_WACOM(0x100) },
        { USB_DEVICE_WACOM(0x101) },
        { USB_DEVICE_WACOM(0x10D) },
 +      { USB_DEVICE_WACOM(0x300) },
 +      { USB_DEVICE_WACOM(0x301) },
        { USB_DEVICE_WACOM(0x304) },
        { USB_DEVICE_WACOM(0x4001) },
        { USB_DEVICE_WACOM(0x47) },
@@@ -153,7 -153,7 +153,7 @@@ static int cyttsp4_hw_reset(struct cytt
   */
  static int cyttsp4_bits_2_bytes(unsigned int nbits, size_t *max)
  {
 -      *max = 1 << nbits;
 +      *max = 1UL << nbits;
        return (nbits + 7) / 8;
  }
  
@@@ -1246,9 -1246,6 +1246,6 @@@ static void cyttsp4_watchdog_timer(unsi
  
        dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__);
  
-       if (!cd)
-               return;
        if (!work_pending(&cd->watchdog_work))
                schedule_work(&cd->watchdog_work);
  
@@@ -1450,6 -1447,11 +1447,6 @@@ static void cyttsp4_watchdog_work(struc
        u8 *mode;
        int retval;
  
 -      if (cd == NULL) {
 -              dev_err(cd->dev, "%s: NULL context pointer\n", __func__);
 -              return;
 -      }
 -
        mutex_lock(&cd->system_lock);
        retval = cyttsp4_load_status_regs(cd);
        if (retval < 0) {
@@@ -1552,106 -1554,6 +1549,6 @@@ exit
        return rc;
  }
  
- static int cyttsp4_core_sleep(struct cyttsp4 *cd)
- {
-       int rc;
-       rc = cyttsp4_request_exclusive(cd, cd->dev,
-                       CY_CORE_SLEEP_REQUEST_EXCLUSIVE_TIMEOUT);
-       if (rc < 0) {
-               dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n",
-                               __func__, cd->exclusive_dev, cd->dev);
-               return 0;
-       }
-       rc = cyttsp4_core_sleep_(cd);
-       if (cyttsp4_release_exclusive(cd, cd->dev) < 0)
-               dev_err(cd->dev, "%s: fail to release exclusive\n", __func__);
-       else
-               dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__);
-       return rc;
- }
- static int cyttsp4_core_wake_(struct cyttsp4 *cd)
- {
-       struct device *dev = cd->dev;
-       int rc;
-       u8 mode;
-       int t;
-       /* Already woken? */
-       mutex_lock(&cd->system_lock);
-       if (cd->sleep_state == SS_SLEEP_OFF) {
-               mutex_unlock(&cd->system_lock);
-               return 0;
-       }
-       cd->int_status &= ~CY_INT_IGNORE;
-       cd->int_status |= CY_INT_AWAKE;
-       cd->sleep_state = SS_WAKING;
-       if (cd->cpdata->power) {
-               dev_dbg(dev, "%s: Power up HW\n", __func__);
-               rc = cd->cpdata->power(cd->cpdata, 1, dev, &cd->ignore_irq);
-       } else {
-               dev_dbg(dev, "%s: No power function\n", __func__);
-               rc = -ENOSYS;
-       }
-       if (rc < 0) {
-               dev_err(dev, "%s: HW Power up fails r=%d\n",
-                               __func__, rc);
-               /* Initiate a read transaction to wake up */
-               cyttsp4_adap_read(cd, CY_REG_BASE, sizeof(mode), &mode);
-       } else
-               dev_vdbg(cd->dev, "%s: HW power up succeeds\n",
-                       __func__);
-       mutex_unlock(&cd->system_lock);
-       t = wait_event_timeout(cd->wait_q,
-                       (cd->int_status & CY_INT_AWAKE) == 0,
-                       msecs_to_jiffies(CY_CORE_WAKEUP_TIMEOUT));
-       if (IS_TMO(t)) {
-               dev_err(dev, "%s: TMO waiting for wakeup\n", __func__);
-               mutex_lock(&cd->system_lock);
-               cd->int_status &= ~CY_INT_AWAKE;
-               /* Try starting up */
-               cyttsp4_queue_startup_(cd);
-               mutex_unlock(&cd->system_lock);
-       }
-       mutex_lock(&cd->system_lock);
-       cd->sleep_state = SS_SLEEP_OFF;
-       mutex_unlock(&cd->system_lock);
-       cyttsp4_start_wd_timer(cd);
-       return 0;
- }
- static int cyttsp4_core_wake(struct cyttsp4 *cd)
- {
-       int rc;
-       rc = cyttsp4_request_exclusive(cd, cd->dev,
-                       CY_CORE_REQUEST_EXCLUSIVE_TIMEOUT);
-       if (rc < 0) {
-               dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n",
-                               __func__, cd->exclusive_dev, cd->dev);
-               return 0;
-       }
-       rc = cyttsp4_core_wake_(cd);
-       if (cyttsp4_release_exclusive(cd, cd->dev) < 0)
-               dev_err(cd->dev, "%s: fail to release exclusive\n", __func__);
-       else
-               dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__);
-       return rc;
- }
  static int cyttsp4_startup_(struct cyttsp4 *cd)
  {
        int retry = CY_CORE_STARTUP_RETRY_COUNT;
@@@ -1821,6 -1723,106 +1718,106 @@@ static void cyttsp4_free_si_ptrs(struc
  }
  
  #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME)
+ static int cyttsp4_core_sleep(struct cyttsp4 *cd)
+ {
+       int rc;
+       rc = cyttsp4_request_exclusive(cd, cd->dev,
+                       CY_CORE_SLEEP_REQUEST_EXCLUSIVE_TIMEOUT);
+       if (rc < 0) {
+               dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n",
+                               __func__, cd->exclusive_dev, cd->dev);
+               return 0;
+       }
+       rc = cyttsp4_core_sleep_(cd);
+       if (cyttsp4_release_exclusive(cd, cd->dev) < 0)
+               dev_err(cd->dev, "%s: fail to release exclusive\n", __func__);
+       else
+               dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__);
+       return rc;
+ }
+ static int cyttsp4_core_wake_(struct cyttsp4 *cd)
+ {
+       struct device *dev = cd->dev;
+       int rc;
+       u8 mode;
+       int t;
+       /* Already woken? */
+       mutex_lock(&cd->system_lock);
+       if (cd->sleep_state == SS_SLEEP_OFF) {
+               mutex_unlock(&cd->system_lock);
+               return 0;
+       }
+       cd->int_status &= ~CY_INT_IGNORE;
+       cd->int_status |= CY_INT_AWAKE;
+       cd->sleep_state = SS_WAKING;
+       if (cd->cpdata->power) {
+               dev_dbg(dev, "%s: Power up HW\n", __func__);
+               rc = cd->cpdata->power(cd->cpdata, 1, dev, &cd->ignore_irq);
+       } else {
+               dev_dbg(dev, "%s: No power function\n", __func__);
+               rc = -ENOSYS;
+       }
+       if (rc < 0) {
+               dev_err(dev, "%s: HW Power up fails r=%d\n",
+                               __func__, rc);
+               /* Initiate a read transaction to wake up */
+               cyttsp4_adap_read(cd, CY_REG_BASE, sizeof(mode), &mode);
+       } else
+               dev_vdbg(cd->dev, "%s: HW power up succeeds\n",
+                       __func__);
+       mutex_unlock(&cd->system_lock);
+       t = wait_event_timeout(cd->wait_q,
+                       (cd->int_status & CY_INT_AWAKE) == 0,
+                       msecs_to_jiffies(CY_CORE_WAKEUP_TIMEOUT));
+       if (IS_TMO(t)) {
+               dev_err(dev, "%s: TMO waiting for wakeup\n", __func__);
+               mutex_lock(&cd->system_lock);
+               cd->int_status &= ~CY_INT_AWAKE;
+               /* Try starting up */
+               cyttsp4_queue_startup_(cd);
+               mutex_unlock(&cd->system_lock);
+       }
+       mutex_lock(&cd->system_lock);
+       cd->sleep_state = SS_SLEEP_OFF;
+       mutex_unlock(&cd->system_lock);
+       cyttsp4_start_wd_timer(cd);
+       return 0;
+ }
+ static int cyttsp4_core_wake(struct cyttsp4 *cd)
+ {
+       int rc;
+       rc = cyttsp4_request_exclusive(cd, cd->dev,
+                       CY_CORE_REQUEST_EXCLUSIVE_TIMEOUT);
+       if (rc < 0) {
+               dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n",
+                               __func__, cd->exclusive_dev, cd->dev);
+               return 0;
+       }
+       rc = cyttsp4_core_wake_(cd);
+       if (cyttsp4_release_exclusive(cd, cd->dev) < 0)
+               dev_err(cd->dev, "%s: fail to release exclusive\n", __func__);
+       else
+               dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__);
+       return rc;
+ }
  static int cyttsp4_core_suspend(struct device *dev)
  {
        struct cyttsp4 *cd = dev_get_drvdata(dev);
@@@ -2025,7 -2027,7 +2022,7 @@@ struct cyttsp4 *cyttsp4_probe(const str
        if (!cd->xfer_buf) {
                dev_err(dev, "%s: Error, kzalloc\n", __func__);
                rc = -ENOMEM;
 -              goto error_alloc_data;
 +              goto error_free_cd;
        }
  
        /* Initialize device info */
        cd->irq = gpio_to_irq(cd->cpdata->irq_gpio);
        if (cd->irq < 0) {
                rc = -EINVAL;
 -              goto error_gpio_irq;
 +              goto error_free_xfer;
        }
  
        dev_set_drvdata(dev, cd);
@@@ -2117,9 -2119,7 +2114,9 @@@ error_request_irq
        if (cd->cpdata->init)
                cd->cpdata->init(cd->cpdata, 0, dev);
        dev_set_drvdata(dev, NULL);
 -error_gpio_irq:
 +error_free_xfer:
 +      kfree(cd->xfer_buf);
 +error_free_cd:
        kfree(cd);
  error_alloc_data:
  error_no_pdata: