]> Git Repo - J-linux.git/commitdiff
Merge branch 'for-5.17/core' into for-linus
authorJiri Kosina <[email protected]>
Mon, 10 Jan 2022 08:49:13 +0000 (09:49 +0100)
committerJiri Kosina <[email protected]>
Mon, 10 Jan 2022 08:49:13 +0000 (09:49 +0100)
- support for USI style pens (Tero Kristo, Mika Westerberg)
- quirk for devices that need inverted X/Y axes (Alistair Francis)
- small core code cleanups and deduplication (Benjamin Tissoires)

1  2 
drivers/hid/hid-input.c
include/linux/hid.h

diff --combined drivers/hid/hid-input.c
index 03f994541981c1cf245a3eea0a38e3dedbdcf99f,5f357dddcc01825f8c94aa6249620e97680657d4..1ce75e8b49d5750a6faefde156e2a724185a2b32
@@@ -52,6 -52,7 +52,7 @@@ static const struct 
  #define map_rel(c)    hid_map_usage(hidinput, usage, &bit, &max, EV_REL, (c))
  #define map_key(c)    hid_map_usage(hidinput, usage, &bit, &max, EV_KEY, (c))
  #define map_led(c)    hid_map_usage(hidinput, usage, &bit, &max, EV_LED, (c))
+ #define map_msc(c)    hid_map_usage(hidinput, usage, &bit, &max, EV_MSC, (c))
  
  #define map_abs_clear(c)      hid_map_usage_clear(hidinput, usage, &bit, \
                &max, EV_ABS, (c))
@@@ -325,8 -326,6 +326,8 @@@ static const struct hid_device_id hid_b
          HID_BATTERY_QUIRK_IGNORE },
        { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN),
          HID_BATTERY_QUIRK_IGNORE },
 +      { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN),
 +        HID_BATTERY_QUIRK_IGNORE },
        { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15),
          HID_BATTERY_QUIRK_IGNORE },
        { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_15),
@@@ -876,10 -875,7 +877,7 @@@ static void hidinput_configure_usage(st
  
                case 0x5b: /* TransducerSerialNumber */
                case 0x6e: /* TransducerSerialNumber2 */
-                       usage->type = EV_MSC;
-                       usage->code = MSC_SERIAL;
-                       bit = input->mscbit;
-                       max = MSC_MAX;
+                       map_msc(MSC_SERIAL);
                        break;
  
                default:  goto unknown;
@@@ -1333,6 -1329,12 +1331,12 @@@ void hidinput_hid_event(struct hid_devi
  
        input = field->hidinput->input;
  
+       if (usage->type == EV_ABS &&
+           (((*quirks & HID_QUIRK_X_INVERT) && usage->code == ABS_X) ||
+            ((*quirks & HID_QUIRK_Y_INVERT) && usage->code == ABS_Y))) {
+               value = field->logical_maximum - value;
+       }
        if (usage->hat_min < usage->hat_max || usage->hat_dir) {
                int hat_dir = usage->hat_dir;
                if (!hat_dir)
@@@ -1465,7 -1467,8 +1469,8 @@@ void hidinput_report_event(struct hid_d
  }
  EXPORT_SYMBOL_GPL(hidinput_report_event);
  
- int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field)
+ static int hidinput_find_field(struct hid_device *hid, unsigned int type,
+                              unsigned int code, struct hid_field **field)
  {
        struct hid_report *report;
        int i, j;
        }
        return -1;
  }
- EXPORT_SYMBOL_GPL(hidinput_find_field);
  
  struct hid_field *hidinput_get_led_field(struct hid_device *hid)
  {
@@@ -1743,6 -1745,16 +1747,16 @@@ static struct hid_input *hidinput_alloc
                case HID_GD_MOUSE:
                        suffix = "Mouse";
                        break;
+               case HID_DG_PEN:
+                       /*
+                        * yes, there is an issue here:
+                        *  DG_PEN -> "Stylus"
+                        *  DG_STYLUS -> "Pen"
+                        * But changing this now means users with config snippets
+                        * will have to change it and the test suite will not be happy.
+                        */
+                       suffix = "Stylus";
+                       break;
                case HID_DG_STYLUS:
                        suffix = "Pen";
                        break;
diff --combined include/linux/hid.h
index aaf89a8a836cf532729861edcc4e882f141adb90,a14c089eb0c1b47d7892c2934320f9bae4d286f7..7487b0586fe6acd17dd466065e37b2f62983a6f7
@@@ -241,6 -241,7 +241,7 @@@ struct hid_item 
  #define HID_DG_TOUCH          0x000d0033
  #define HID_DG_UNTOUCH                0x000d0034
  #define HID_DG_TAP            0x000d0035
+ #define HID_DG_TRANSDUCER_INDEX       0x000d0038
  #define HID_DG_TABLETFUNCTIONKEY      0x000d0039
  #define HID_DG_PROGRAMCHANGEKEY       0x000d003a
  #define HID_DG_BATTERYSTRENGTH        0x000d003b
  #define HID_DG_BARRELSWITCH   0x000d0044
  #define HID_DG_ERASER         0x000d0045
  #define HID_DG_TABLETPICK     0x000d0046
+ #define HID_DG_PEN_COLOR                      0x000d005c
+ #define HID_DG_PEN_LINE_WIDTH                 0x000d005e
+ #define HID_DG_PEN_LINE_STYLE                 0x000d0070
+ #define HID_DG_PEN_LINE_STYLE_INK             0x000d0072
+ #define HID_DG_PEN_LINE_STYLE_PENCIL          0x000d0073
+ #define HID_DG_PEN_LINE_STYLE_HIGHLIGHTER     0x000d0074
+ #define HID_DG_PEN_LINE_STYLE_CHISEL_MARKER   0x000d0075
+ #define HID_DG_PEN_LINE_STYLE_BRUSH           0x000d0076
+ #define HID_DG_PEN_LINE_STYLE_NO_PREFERENCE   0x000d0077
  
  #define HID_CP_CONSUMERCONTROL        0x000c0001
  #define HID_CP_NUMERICKEYPAD  0x000c0002
  /* BIT(9) reserved for backward compatibility, was NO_INIT_INPUT_REPORTS */
  #define HID_QUIRK_ALWAYS_POLL                 BIT(10)
  #define HID_QUIRK_INPUT_PER_APP                       BIT(11)
+ #define HID_QUIRK_X_INVERT                    BIT(12)
+ #define HID_QUIRK_Y_INVERT                    BIT(13)
  #define HID_QUIRK_SKIP_OUTPUT_REPORTS         BIT(16)
  #define HID_QUIRK_SKIP_OUTPUT_REPORT_ID               BIT(17)
  #define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP        BIT(18)
@@@ -788,7 -800,7 +800,7 @@@ struct hid_driver 
        container_of(pdrv, struct hid_driver, driver)
  
  /**
 - * hid_ll_driver - low level driver callbacks
 + * struct hid_ll_driver - low level driver callbacks
   * @start: called on probe to start the device
   * @stop: called on remove
   * @open: called by input layer on open
@@@ -840,11 -852,6 +852,11 @@@ static inline bool hid_is_using_ll_driv
        return hdev->ll_driver == driver;
  }
  
 +static inline bool hid_is_usb(struct hid_device *hdev)
 +{
 +      return hid_is_using_ll_driver(hdev, &usb_hid_driver);
 +}
 +
  #define       PM_HINT_FULLON  1<<5
  #define PM_HINT_NORMAL        1<<1
  
@@@ -894,7 -901,6 +906,6 @@@ extern void hidinput_disconnect(struct 
  
  int hid_set_field(struct hid_field *, unsigned, __s32);
  int hid_input_report(struct hid_device *, int type, u8 *, u32, int);
- int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
  struct hid_field *hidinput_get_led_field(struct hid_device *hid);
  unsigned int hidinput_count_leds(struct hid_device *hid);
  __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
@@@ -928,6 -934,16 +939,16 @@@ s32 hid_snto32(__u32 value, unsigned n)
  __u32 hid_field_extract(const struct hid_device *hid, __u8 *report,
                     unsigned offset, unsigned n);
  
+ #ifdef CONFIG_PM
+ int hid_driver_suspend(struct hid_device *hdev, pm_message_t state);
+ int hid_driver_reset_resume(struct hid_device *hdev);
+ int hid_driver_resume(struct hid_device *hdev);
+ #else
+ static inline int hid_driver_suspend(struct hid_device *hdev, pm_message_t state) { return 0; }
+ static inline int hid_driver_reset_resume(struct hid_device *hdev) { return 0; }
+ static inline int hid_driver_resume(struct hid_device *hdev) { return 0; }
+ #endif
  /**
   * hid_device_io_start - enable HID input during probe, remove
   *
@@@ -1005,6 -1021,10 +1026,10 @@@ static inline void hid_map_usage(struc
                bmap = input->ledbit;
                limit = LED_MAX;
                break;
+       case EV_MSC:
+               bmap = input->mscbit;
+               limit = MSC_MAX;
+               break;
        }
  
        if (unlikely(c > limit || !bmap)) {
@@@ -1061,6 -1081,12 +1086,12 @@@ int __must_check hid_hw_start(struct hi
  void hid_hw_stop(struct hid_device *hdev);
  int __must_check hid_hw_open(struct hid_device *hdev);
  void hid_hw_close(struct hid_device *hdev);
+ void hid_hw_request(struct hid_device *hdev,
+                   struct hid_report *report, int reqtype);
+ int hid_hw_raw_request(struct hid_device *hdev,
+                      unsigned char reportnum, __u8 *buf,
+                      size_t len, unsigned char rtype, int reqtype);
+ int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, size_t len);
  
  /**
   * hid_hw_power - requests underlying HW to go into given power mode
@@@ -1078,68 -1104,6 +1109,6 @@@ static inline int hid_hw_power(struct h
  }
  
  
- /**
-  * hid_hw_request - send report request to device
-  *
-  * @hdev: hid device
-  * @report: report to send
-  * @reqtype: hid request type
-  */
- static inline void hid_hw_request(struct hid_device *hdev,
-                                 struct hid_report *report, int reqtype)
- {
-       if (hdev->ll_driver->request)
-               return hdev->ll_driver->request(hdev, report, reqtype);
-       __hid_request(hdev, report, reqtype);
- }
- /**
-  * hid_hw_raw_request - send report request to device
-  *
-  * @hdev: hid device
-  * @reportnum: report ID
-  * @buf: in/out data to transfer
-  * @len: length of buf
-  * @rtype: HID report type
-  * @reqtype: HID_REQ_GET_REPORT or HID_REQ_SET_REPORT
-  *
-  * Return: count of data transferred, negative if error
-  *
-  * Same behavior as hid_hw_request, but with raw buffers instead.
-  */
- static inline int hid_hw_raw_request(struct hid_device *hdev,
-                                 unsigned char reportnum, __u8 *buf,
-                                 size_t len, unsigned char rtype, int reqtype)
- {
-       if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
-               return -EINVAL;
-       return hdev->ll_driver->raw_request(hdev, reportnum, buf, len,
-                                                   rtype, reqtype);
- }
- /**
-  * hid_hw_output_report - send output report to device
-  *
-  * @hdev: hid device
-  * @buf: raw data to transfer
-  * @len: length of buf
-  *
-  * Return: count of data transferred, negative if error
-  */
- static inline int hid_hw_output_report(struct hid_device *hdev, __u8 *buf,
-                                       size_t len)
- {
-       if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
-               return -EINVAL;
-       if (hdev->ll_driver->output_report)
-               return hdev->ll_driver->output_report(hdev, buf, len);
-       return -ENOSYS;
- }
  /**
   * hid_hw_idle - send idle request to device
   *
@@@ -1158,7 -1122,7 +1127,7 @@@ static inline int hid_hw_idle(struct hi
  }
  
  /**
 - * hid_may_wakeup - return if the hid device may act as a wakeup source during system-suspend
 + * hid_hw_may_wakeup - return if the hid device may act as a wakeup source during system-suspend
   *
   * @hdev: hid device
   */
This page took 0.075629 seconds and 4 git commands to generate.