Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 16 Nov 2013 00:48:22 +0000 (16:48 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 16 Nov 2013 00:48:22 +0000 (16:48 -0800)
Pull HID updates from Jiri Kosina:
 - i2c-hid is not querying init reports any more, as it's not mandated
   by the spec, and annoys quite a few devices during enumeration, by
   Bibek Basu
 - a lot of fixes for Logitech devices, by Simon Wood
 - hid-apple now has an option to switch between Option and Command
   mode, by Nanno Langstraat
 - Some more workarounds for severely broken ELO devices, by Oliver
   Neukum
 - more devm conversions, by Benjamin Tissoires
 - wiimote correctness fixes, by David Herrmann
 - a lot of added support for various new device IDs and random small
   fixes here and there"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (34 commits)
  HID: enable Mayflash USB Gamecube Adapter
  HID: sony: Add force feedback support for Dualshock3 USB
  Input: usbtouchscreen: ignore eGalax/D-Wav/EETI HIDs
  HID: don't ignore eGalax/D-Wav/EETI HIDs
  HID: roccat: add missing special driver declarations
  HID:hid-lg4ff: Correct Auto-center strength for wheels other than MOMO and MOMO2
  HID:hid-lg4ff: Initialize device properties before we touch autocentering.
  HID:hid-lg4ff: ensure ConstantForce is disabled when set to 0
  HID:hid-lg4ff: Switch autocentering off when strength is set to zero.
  HID:hid-lg4ff: Scale autocentering force properly on Logitech wheel
  HID: roccat: fix Coverity CID 141438
  HID: multitouch: add manufacturer to Kconfig help text
  HID: logitech-dj: small cleanup in rdcat()
  HID: remove self-assignment from hid_input_report
  HID: hid-sensor-hub: fix report size
  HID: i2c-hid: Stop querying for init reports
  HID: roccat: add support for Ryos MK keyboards
  HID: roccat: generalize some common code
  HID: roccat: add new device return value
  HID: wiimote: add pro-controller analog stick calibration
  ...

1  2 
drivers/hid/hid-sensor-hub.c
drivers/hid/hid-wiimote.h
drivers/hid/i2c-hid/i2c-hid.c

@@@ -326,7 -326,8 +326,8 @@@ int sensor_hub_input_get_attribute_info
                                field->logical == attr_usage_id) {
                                sensor_hub_fill_attr_info(info, i, report->id,
                                        field->unit, field->unit_exponent,
-                                       field->report_size);
+                                       field->report_size *
+                                                       field->report_count);
                                ret = 0;
                        } else {
                                for (j = 0; j < field->maxusage; ++j) {
                                                        i, report->id,
                                                        field->unit,
                                                        field->unit_exponent,
-                                                       field->report_size);
+                                                       field->report_size *
+                                                       field->report_count);
                                                ret = 0;
                                                break;
                                        }
@@@ -425,9 -427,10 +427,10 @@@ static int sensor_hub_raw_event(struct 
                hid_dbg(hdev, "%d collection_index:%x hid:%x sz:%x\n",
                                i, report->field[i]->usage->collection_index,
                                report->field[i]->usage->hid,
-                               report->field[i]->report_size/8);
-               sz = report->field[i]->report_size/8;
+                               (report->field[i]->report_size *
+                                       report->field[i]->report_count)/8);
+               sz = (report->field[i]->report_size *
+                                       report->field[i]->report_count)/8;
                if (pdata->pending.status && pdata->pending.attr_usage_id ==
                                report->field[i]->usage->hid) {
                        hid_dbg(hdev, "data was pending ...\n");
        return 1;
  }
  
 +int sensor_hub_device_open(struct hid_sensor_hub_device *hsdev)
 +{
 +      int ret = 0;
 +      struct sensor_hub_data *data =  hid_get_drvdata(hsdev->hdev);
 +
 +      mutex_lock(&data->mutex);
 +      if (!hsdev->ref_cnt) {
 +              ret = hid_hw_open(hsdev->hdev);
 +              if (ret) {
 +                      hid_err(hsdev->hdev, "failed to open hid device\n");
 +                      mutex_unlock(&data->mutex);
 +                      return ret;
 +              }
 +      }
 +      hsdev->ref_cnt++;
 +      mutex_unlock(&data->mutex);
 +
 +      return ret;
 +}
 +EXPORT_SYMBOL_GPL(sensor_hub_device_open);
 +
 +void sensor_hub_device_close(struct hid_sensor_hub_device *hsdev)
 +{
 +      struct sensor_hub_data *data =  hid_get_drvdata(hsdev->hdev);
 +
 +      mutex_lock(&data->mutex);
 +      hsdev->ref_cnt--;
 +      if (!hsdev->ref_cnt)
 +              hid_hw_close(hsdev->hdev);
 +      mutex_unlock(&data->mutex);
 +}
 +EXPORT_SYMBOL_GPL(sensor_hub_device_close);
 +
  static int sensor_hub_probe(struct hid_device *hdev,
                                const struct hid_device_id *id)
  {
                hid_err(hdev, "hw start failed\n");
                return ret;
        }
 -      ret = hid_hw_open(hdev);
 -      if (ret) {
 -              hid_err(hdev, "failed to open input interrupt pipe\n");
 -              goto err_stop_hw;
 -      }
 -
        INIT_LIST_HEAD(&sd->dyn_callback_list);
        sd->hid_sensor_client_cnt = 0;
        report_enum = &hdev->report_enum[HID_INPUT_REPORT];
        if (dev_cnt > HID_MAX_PHY_DEVICES) {
                hid_err(hdev, "Invalid Physical device count\n");
                ret = -EINVAL;
 -              goto err_close;
 +              goto err_stop_hw;
        }
        sd->hid_sensor_hub_client_devs = kzalloc(dev_cnt *
                                                sizeof(struct mfd_cell),
        if (sd->hid_sensor_hub_client_devs == NULL) {
                hid_err(hdev, "Failed to allocate memory for mfd cells\n");
                        ret = -ENOMEM;
 -                      goto err_close;
 +                      goto err_stop_hw;
        }
        list_for_each_entry(report, &report_enum->report_list, list) {
                hid_dbg(hdev, "Report id:%x\n", report->id);
@@@ -592,6 -568,8 +595,6 @@@ err_free_names
        for (i = 0; i < sd->hid_sensor_client_cnt ; ++i)
                kfree(sd->hid_sensor_hub_client_devs[i].name);
        kfree(sd->hid_sensor_hub_client_devs);
 -err_close:
 -      hid_hw_close(hdev);
  err_stop_hw:
        hid_hw_stop(hdev);
  
@@@ -46,6 -46,7 +46,7 @@@
  #define WIIPROTO_FLAG_DRM_LOCKED      0x8000
  #define WIIPROTO_FLAG_BUILTIN_MP      0x010000
  #define WIIPROTO_FLAG_NO_MP           0x020000
+ #define WIIPROTO_FLAG_PRO_CALIB_DONE  0x040000
  
  #define WIIPROTO_FLAGS_LEDS (WIIPROTO_FLAG_LED1 | WIIPROTO_FLAG_LED2 | \
                                        WIIPROTO_FLAG_LED3 | WIIPROTO_FLAG_LED4)
@@@ -135,6 -136,7 +136,7 @@@ struct wiimote_state 
  
        /* calibration/cache data */
        __u16 calib_bboard[4][3];
+       __s16 calib_pro_sticks[4];
        __u8 cache_rumble;
  };
  
@@@ -327,7 -329,7 +329,7 @@@ static inline void wiimote_cmd_acquire_
  static inline void wiimote_cmd_set(struct wiimote_data *wdata, int cmd,
                                                                __u32 opt)
  {
 -      INIT_COMPLETION(wdata->state.ready);
 +      reinit_completion(&wdata->state.ready);
        wdata->state.cmd = cmd;
        wdata->state.opt = opt;
  }
@@@ -454,10 -454,6 +454,6 @@@ static void i2c_hid_init_reports(struc
                return;
        }
  
-       list_for_each_entry(report,
-               &hid->report_enum[HID_INPUT_REPORT].report_list, list)
-               i2c_hid_init_report(report, inbuf, ihid->bufsize);
        list_for_each_entry(report,
                &hid->report_enum[HID_FEATURE_REPORT].report_list, list)
                i2c_hid_init_report(report, inbuf, ihid->bufsize);
@@@ -854,10 -850,10 +850,10 @@@ static int i2c_hid_acpi_pdata(struct i2
                0xF7, 0xF6, 0xDF, 0x3C, 0x67, 0x42, 0x55, 0x45,
                0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE,
        };
 -      struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
 -      union acpi_object params[4], *obj;
 +      union acpi_object params[4];
        struct acpi_object_list input;
        struct acpi_device *adev;
 +      unsigned long long value;
        acpi_handle handle;
  
        handle = ACPI_HANDLE(&client->dev);
        params[3].package.count = 0;
        params[3].package.elements = NULL;
  
 -      if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DSM", &input, &buf))) {
 +      if (ACPI_FAILURE(acpi_evaluate_integer(handle, "_DSM", &input,
 +                                                              &value))) {
                dev_err(&client->dev, "device _DSM execution failed\n");
                return -ENODEV;
        }
  
 -      obj = (union acpi_object *)buf.pointer;
 -      if (obj->type != ACPI_TYPE_INTEGER) {
 -              dev_err(&client->dev, "device _DSM returned invalid type: %d\n",
 -                      obj->type);
 -              kfree(buf.pointer);
 -              return -EINVAL;
 -      }
 -
 -      pdata->hid_descriptor_address = obj->integer.value;
 +      pdata->hid_descriptor_address = value;
  
 -      kfree(buf.pointer);
        return 0;
  }