• Home
  • Raw
  • Download

Lines Matching refs:shid

24 static int surface_hid_load_hid_descriptor(struct surface_hid_device *shid)  in surface_hid_load_hid_descriptor()  argument
28 status = shid->ops.get_descriptor(shid, SURFACE_HID_DESC_HID, in surface_hid_load_hid_descriptor()
29 (u8 *)&shid->hid_desc, sizeof(shid->hid_desc)); in surface_hid_load_hid_descriptor()
33 if (shid->hid_desc.desc_len != sizeof(shid->hid_desc)) { in surface_hid_load_hid_descriptor()
34 dev_err(shid->dev, "unexpected HID descriptor length: got %u, expected %zu\n", in surface_hid_load_hid_descriptor()
35 shid->hid_desc.desc_len, sizeof(shid->hid_desc)); in surface_hid_load_hid_descriptor()
39 if (shid->hid_desc.desc_type != HID_DT_HID) { in surface_hid_load_hid_descriptor()
40 dev_err(shid->dev, "unexpected HID descriptor type: got %#04x, expected %#04x\n", in surface_hid_load_hid_descriptor()
41 shid->hid_desc.desc_type, HID_DT_HID); in surface_hid_load_hid_descriptor()
45 if (shid->hid_desc.num_descriptors != 1) { in surface_hid_load_hid_descriptor()
46 dev_err(shid->dev, "unexpected number of descriptors: got %u, expected 1\n", in surface_hid_load_hid_descriptor()
47 shid->hid_desc.num_descriptors); in surface_hid_load_hid_descriptor()
51 if (shid->hid_desc.report_desc_type != HID_DT_REPORT) { in surface_hid_load_hid_descriptor()
52 dev_err(shid->dev, "unexpected report descriptor type: got %#04x, expected %#04x\n", in surface_hid_load_hid_descriptor()
53 shid->hid_desc.report_desc_type, HID_DT_REPORT); in surface_hid_load_hid_descriptor()
60 static int surface_hid_load_device_attributes(struct surface_hid_device *shid) in surface_hid_load_device_attributes() argument
64 status = shid->ops.get_descriptor(shid, SURFACE_HID_DESC_ATTRS, in surface_hid_load_device_attributes()
65 (u8 *)&shid->attrs, sizeof(shid->attrs)); in surface_hid_load_device_attributes()
69 if (get_unaligned_le32(&shid->attrs.length) != sizeof(shid->attrs)) { in surface_hid_load_device_attributes()
70 dev_err(shid->dev, "unexpected attribute length: got %u, expected %zu\n", in surface_hid_load_device_attributes()
71 get_unaligned_le32(&shid->attrs.length), sizeof(shid->attrs)); in surface_hid_load_device_attributes()
83 struct surface_hid_device *shid = hid->driver_data; in surface_hid_start() local
85 return ssam_notifier_register(shid->ctrl, &shid->notif); in surface_hid_start()
90 struct surface_hid_device *shid = hid->driver_data; in surface_hid_stop() local
93 ssam_notifier_unregister(shid->ctrl, &shid->notif); in surface_hid_stop()
107 struct surface_hid_device *shid = hid->driver_data; in surface_hid_parse() local
108 size_t len = get_unaligned_le16(&shid->hid_desc.report_desc_len); in surface_hid_parse()
116 status = shid->ops.get_descriptor(shid, SURFACE_HID_DESC_REPORT, buf, len); in surface_hid_parse()
127 struct surface_hid_device *shid = hid->driver_data; in surface_hid_raw_request() local
130 return shid->ops.output_report(shid, reportnum, buf, len); in surface_hid_raw_request()
133 return shid->ops.get_feature_report(shid, reportnum, buf, len); in surface_hid_raw_request()
136 return shid->ops.set_feature_report(shid, reportnum, buf, len); in surface_hid_raw_request()
153 int surface_hid_device_add(struct surface_hid_device *shid) in surface_hid_device_add() argument
157 status = surface_hid_load_hid_descriptor(shid); in surface_hid_device_add()
161 status = surface_hid_load_device_attributes(shid); in surface_hid_device_add()
165 shid->hid = hid_allocate_device(); in surface_hid_device_add()
166 if (IS_ERR(shid->hid)) in surface_hid_device_add()
167 return PTR_ERR(shid->hid); in surface_hid_device_add()
169 shid->hid->dev.parent = shid->dev; in surface_hid_device_add()
170 shid->hid->bus = BUS_HOST; in surface_hid_device_add()
171 shid->hid->vendor = get_unaligned_le16(&shid->attrs.vendor); in surface_hid_device_add()
172 shid->hid->product = get_unaligned_le16(&shid->attrs.product); in surface_hid_device_add()
173 shid->hid->version = get_unaligned_le16(&shid->hid_desc.hid_version); in surface_hid_device_add()
174 shid->hid->country = shid->hid_desc.country_code; in surface_hid_device_add()
176 snprintf(shid->hid->name, sizeof(shid->hid->name), "Microsoft Surface %04X:%04X", in surface_hid_device_add()
177 shid->hid->vendor, shid->hid->product); in surface_hid_device_add()
179 strscpy(shid->hid->phys, dev_name(shid->dev), sizeof(shid->hid->phys)); in surface_hid_device_add()
181 shid->hid->driver_data = shid; in surface_hid_device_add()
182 shid->hid->ll_driver = &surface_hid_ll_driver; in surface_hid_device_add()
184 status = hid_add_device(shid->hid); in surface_hid_device_add()
186 hid_destroy_device(shid->hid); in surface_hid_device_add()
192 void surface_hid_device_destroy(struct surface_hid_device *shid) in surface_hid_device_destroy() argument
194 hid_destroy_device(shid->hid); in surface_hid_device_destroy()