]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'input/next'
authorThierry Reding <treding@nvidia.com>
Mon, 21 Oct 2013 11:29:24 +0000 (13:29 +0200)
committerThierry Reding <treding@nvidia.com>
Mon, 21 Oct 2013 11:29:24 +0000 (13:29 +0200)
1  2 
drivers/input/keyboard/pxa27x_keypad.c
drivers/input/tablet/wacom_sys.c

index a2e758d27584c0117a5c941d36b8042ab20f425f,5446ad4e4aebbb30d6d912a49bef1f6c88e432ee..186138c720c79ebfee4ef896c61aeee78c770289
@@@ -27,6 -27,7 +27,7 @@@
  #include <linux/err.h>
  #include <linux/input/matrix_keypad.h>
  #include <linux/slab.h>
+ #include <linux/of.h>
  
  #include <asm/mach/arch.h>
  #include <asm/mach/map.h>
@@@ -786,17 -787,10 +787,17 @@@ static int pxa27x_keypad_probe(struct p
        input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
        input_set_capability(input_dev, EV_MSC, MSC_SCAN);
  
 -      if (pdata)
 +      if (pdata) {
                error = pxa27x_keypad_build_keycode(keypad);
 -      else
 +      } else {
                error = pxa27x_keypad_build_keycode_from_dt(keypad);
 +              /*
 +               * Data that we get from DT resides in dynamically
 +               * allocated memory so we need to update our pdata
 +               * pointer.
 +               */
 +              pdata = keypad->pdata;
 +      }
        if (error) {
                dev_err(&pdev->dev, "failed to build keycode\n");
                goto failed_put_clk;
index e53416a4d7f3275ea2fd8f53f6a55dcbb6de02ad,8a90da11365f78d4193550410398d6fa07a390aa..867e7c33ac55072b19f2ff339705c4e90f6b428d
@@@ -524,9 -524,6 +524,6 @@@ static int wacom_set_device_mode(struc
  
                error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT,
                                         report_id, rep_data, length, 1);
-               if (error >= 0)
-                       error = wacom_get_report(intf, WAC_HID_FEATURE_REPORT,
-                                                report_id, rep_data, length, 1);
        } while ((error < 0 || rep_data[1] != mode) && limit++ < WAC_MSG_RETRIES);
  
        kfree(rep_data);
@@@ -548,7 -545,7 +545,7 @@@ static int wacom_query_tablet_data(stru
                        /* MT Tablet PC touch */
                        return wacom_set_device_mode(intf, 3, 4, 4);
                }
-               else if (features->type == WACOM_24HDT) {
+               else if (features->type == WACOM_24HDT || features->type == CINTIQ_HYBRID) {
                        return wacom_set_device_mode(intf, 18, 3, 2);
                }
        } else if (features->device_type == BTN_TOOL_PEN) {
@@@ -719,7 -716,7 +716,7 @@@ static int wacom_led_control(struct wac
                return -ENOMEM;
  
        if (wacom->wacom_wac.features.type >= INTUOS5S &&
-           wacom->wacom_wac.features.type <= INTUOS5L) {
+           wacom->wacom_wac.features.type <= INTUOSPL) {
                /*
                 * Touch Ring and crop mark LED luminance may take on
                 * one of four values:
@@@ -981,14 -978,20 +978,20 @@@ static int wacom_initialize_leds(struc
        case INTUOS5S:
        case INTUOS5:
        case INTUOS5L:
-               wacom->led.select[0] = 0;
-               wacom->led.select[1] = 0;
-               wacom->led.llv = 32;
-               wacom->led.hlv = 0;
-               wacom->led.img_lum = 0;
-               error = sysfs_create_group(&wacom->intf->dev.kobj,
-                                          &intuos5_led_attr_group);
+       case INTUOSPS:
+       case INTUOSPM:
+       case INTUOSPL:
+               if (wacom->wacom_wac.features.device_type == BTN_TOOL_PEN) {
+                       wacom->led.select[0] = 0;
+                       wacom->led.select[1] = 0;
+                       wacom->led.llv = 32;
+                       wacom->led.hlv = 0;
+                       wacom->led.img_lum = 0;
+                       error = sysfs_create_group(&wacom->intf->dev.kobj,
+                                                 &intuos5_led_attr_group);
+               } else
+                       return 0;
                break;
  
        default:
@@@ -1024,14 -1027,17 +1027,18 @@@ static void wacom_destroy_leds(struct w
        case INTUOS5S:
        case INTUOS5:
        case INTUOS5L:
-               sysfs_remove_group(&wacom->intf->dev.kobj,
-                                  &intuos5_led_attr_group);
+       case INTUOSPS:
+       case INTUOSPM:
+       case INTUOSPL:
+               if (wacom->wacom_wac.features.device_type == BTN_TOOL_PEN)
+                       sysfs_remove_group(&wacom->intf->dev.kobj,
+                                          &intuos5_led_attr_group);
                break;
        }
  }
  
  static enum power_supply_property wacom_battery_props[] = {
 +      POWER_SUPPLY_PROP_SCOPE,
        POWER_SUPPLY_PROP_CAPACITY
  };
  
@@@ -1043,9 -1049,6 +1050,9 @@@ static int wacom_battery_get_property(s
        int ret = 0;
  
        switch (psp) {
 +              case POWER_SUPPLY_PROP_SCOPE:
 +                      val->intval = POWER_SUPPLY_SCOPE_DEVICE;
 +                      break;
                case POWER_SUPPLY_PROP_CAPACITY:
                        val->intval =
                                wacom->wacom_wac.battery_capacity * 100 / 31;
@@@ -1185,34 -1188,47 +1192,47 @@@ static void wacom_wireless_work(struct 
                wacom_wac1->features =
                        *((struct wacom_features *)id->driver_info);
                wacom_wac1->features.device_type = BTN_TOOL_PEN;
+               snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen",
+                        wacom_wac1->features.name);
                error = wacom_register_input(wacom1);
                if (error)
-                       goto fail1;
+                       goto fail;
  
                /* Touch interface */
-               wacom_wac2->features =
-                       *((struct wacom_features *)id->driver_info);
-               wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
-               wacom_wac2->features.device_type = BTN_TOOL_FINGER;
-               wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096;
-               error = wacom_register_input(wacom2);
-               if (error)
-                       goto fail2;
+               if (wacom_wac1->features.touch_max) {
+                       wacom_wac2->features =
+                               *((struct wacom_features *)id->driver_info);
+                       wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
+                       wacom_wac2->features.device_type = BTN_TOOL_FINGER;
+                       wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096;
+                       if (wacom_wac2->features.touch_max)
+                               snprintf(wacom_wac2->name, WACOM_NAME_MAX,
+                                        "%s (WL) Finger",wacom_wac2->features.name);
+                       else
+                               snprintf(wacom_wac2->name, WACOM_NAME_MAX,
+                                        "%s (WL) Pad",wacom_wac2->features.name);
+                       error = wacom_register_input(wacom2);
+                       if (error)
+                               goto fail;
+               }
  
                error = wacom_initialize_battery(wacom);
                if (error)
-                       goto fail3;
+                       goto fail;
        }
  
        return;
  
- fail3:
-       input_unregister_device(wacom_wac2->input);
-       wacom_wac2->input = NULL;
- fail2:
-       input_unregister_device(wacom_wac1->input);
-       wacom_wac1->input = NULL;
- fail1:
+ fail:
+       if (wacom_wac2->input) {
+               input_unregister_device(wacom_wac2->input);
+               wacom_wac2->input = NULL;
+       }
+       if (wacom_wac1->input) {
+               input_unregister_device(wacom_wac1->input);
+               wacom_wac1->input = NULL;
+       }
        return;
  }
  
@@@ -1302,7 -1318,7 +1322,7 @@@ static int wacom_probe(struct usb_inter
         * HID descriptor. If this is the touch interface (wMaxPacketSize
         * of WACOM_PKGLEN_BBTOUCH3), override the table values.
         */
-       if (features->type >= INTUOS5S && features->type <= INTUOS5L) {
+       if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
                if (endpoint->wMaxPacketSize == WACOM_PKGLEN_BBTOUCH3) {
                        features->device_type = BTN_TOOL_FINGER;
                        features->pktlen = WACOM_PKGLEN_BBTOUCH3;
                struct usb_device *other_dev;
  
                /* Append the device type to the name */
-               strlcat(wacom_wac->name,
-                       features->device_type == BTN_TOOL_PEN ?
-                               " Pen" : " Finger",
-                       sizeof(wacom_wac->name));
+               if (features->device_type != BTN_TOOL_FINGER)
+                       strlcat(wacom_wac->name, " Pen", WACOM_NAME_MAX);
+               else if (features->touch_max)
+                       strlcat(wacom_wac->name, " Finger", WACOM_NAME_MAX);
+               else
+                       strlcat(wacom_wac->name, " Pad", WACOM_NAME_MAX);
  
                other_dev = wacom_get_sibling(dev, features->oVid, features->oPid);
                if (other_dev == NULL || wacom_get_usbdev_data(other_dev) == NULL)