Lines Matching defs:hdev

238 	struct hid_device *hdev;
249 static int ft260_hid_feature_report_get(struct hid_device *hdev,
260 ret = hid_hw_raw_request(hdev, report_id, buf, len, HID_FEATURE_REPORT,
270 static int ft260_hid_feature_report_set(struct hid_device *hdev, u8 *data,
282 ret = hid_hw_raw_request(hdev, buf[0], buf, len, HID_FEATURE_REPORT,
289 static int ft260_i2c_reset(struct hid_device *hdev)
296 ret = ft260_hid_feature_report_set(hdev, (u8 *)&report, sizeof(report));
298 hid_err(hdev, "failed to reset I2C controller: %d\n", ret);
308 struct hid_device *hdev = dev->hdev;
313 ret = ft260_hid_feature_report_get(hdev, FT260_I2C_STATUS,
316 hid_err(hdev, "failed to retrieve status: %d, no wakeup\n",
326 ret = ft260_hid_feature_report_get(hdev, FT260_I2C_STATUS,
329 hid_err(hdev, "failed to retrieve status: %d\n", ret);
346 hid_err(hdev, "i2c bus error: %#02x\n", report.bus_status);
353 static int ft260_hid_output_report(struct hid_device *hdev, u8 *data,
363 ret = hid_hw_output_report(hdev, buf, len);
374 struct hid_device *hdev = dev->hdev;
378 ret = ft260_hid_output_report(hdev, data, len);
380 hid_err(hdev, "%s: failed to start transfer, ret %d\n",
382 ft260_i2c_reset(hdev);
413 ft260_i2c_reset(hdev);
421 struct hid_device *hdev = dev->hdev;
452 hid_err(hdev, "%s: failed with %d\n", __func__, ret);
503 struct hid_device *hdev = dev->hdev;
533 ret = ft260_hid_output_report(hdev, (u8 *)&rep, sizeof(rep));
535 hid_err(hdev, "%s: failed with %d\n", __func__, ret);
542 ft260_i2c_reset(hdev);
554 ft260_i2c_reset(hdev);
580 struct hid_device *hdev = dev->hdev;
585 hid_err(hdev, "%s: invalid wr_len: %d\n", __func__, wr_len);
617 struct hid_device *hdev = dev->hdev;
621 ret = hid_hw_power(hdev, PM_HINT_FULLON);
623 hid_err(hdev, "failed to enter FULLON power mode: %d\n", ret);
647 hid_hw_power(hdev, PM_HINT_NORMAL);
658 struct hid_device *hdev = dev->hdev;
664 ret = hid_hw_power(hdev, PM_HINT_FULLON);
666 hid_err(hdev, "power management error: %d\n", ret);
742 hid_err(hdev, "unsupported smbus transaction size %d\n", size);
747 hid_hw_power(hdev, PM_HINT_NORMAL);
770 static int ft260_get_system_config(struct hid_device *hdev,
776 ret = ft260_hid_feature_report_get(hdev, FT260_SYSTEM_SETTINGS,
779 hid_err(hdev, "failed to retrieve system status\n");
785 static int ft260_is_interface_enabled(struct hid_device *hdev)
788 struct usb_interface *usbif = to_usb_interface(hdev->dev.parent);
792 ret = ft260_get_system_config(hdev, &cfg);
806 hid_info(hdev, "uart interface is not supported\n");
811 hid_info(hdev, "uart interface is not supported\n");
820 static int ft260_byte_show(struct hid_device *hdev, int id, u8 *cfg, int len,
825 ret = ft260_hid_feature_report_get(hdev, id, cfg, len);
832 static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len,
837 ret = ft260_hid_feature_report_get(hdev, id, cfg, len);
849 struct hid_device *hdev = to_hid_device(kdev); \
853 return func(hdev, id, (u8 *)&rep, len, field, buf); \
870 struct hid_device *hdev = to_hid_device(kdev); \
878 ret = ft260_hid_feature_report_set(hdev, (u8 *)&rep, \
935 struct hid_device *hdev = to_hid_device(kdev);
936 int ret = ft260_i2c_reset(hdev);
960 static int ft260_probe(struct hid_device *hdev, const struct hid_device_id *id)
966 if (!hid_is_usb(hdev))
969 dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL);
973 ret = hid_parse(hdev);
975 hid_err(hdev, "failed to parse HID\n");
979 ret = hid_hw_start(hdev, 0);
981 hid_err(hdev, "failed to start HID HW\n");
985 ret = hid_hw_open(hdev);
987 hid_err(hdev, "failed to open HID HW\n");
991 ret = ft260_hid_feature_report_get(hdev, FT260_CHIP_VERSION,
994 hid_err(hdev, "failed to retrieve chip version\n");
998 hid_info(hdev, "chip code: %02x%02x %02x%02x\n",
1002 ret = ft260_is_interface_enabled(hdev);
1006 hid_info(hdev, "USB HID v%x.%02x Device [%s] on %s\n",
1007 hdev->version >> 8, hdev->version & 0xff, hdev->name,
1008 hdev->phys);
1010 hid_set_drvdata(hdev, dev);
1011 dev->hdev = hdev;
1016 dev->adap.dev.parent = &hdev->dev;
1025 ft260_i2c_reset(hdev);
1030 hid_err(hdev, "failed to add i2c adapter\n");
1034 ret = sysfs_create_group(&hdev->dev.kobj, &ft260_attr_group);
1036 hid_err(hdev, "failed to create sysfs attrs\n");
1045 hid_hw_close(hdev);
1047 hid_hw_stop(hdev);
1051 static void ft260_remove(struct hid_device *hdev)
1053 struct ft260_device *dev = hid_get_drvdata(hdev);
1058 sysfs_remove_group(&hdev->dev.kobj, &ft260_attr_group);
1061 hid_hw_close(hdev);
1062 hid_hw_stop(hdev);
1065 static int ft260_raw_event(struct hid_device *hdev, struct hid_report *report,
1068 struct ft260_device *dev = hid_get_drvdata(hdev);
1078 hid_err(hdev, "unexpected report %#02x, length %d\n",
1091 hid_err(hdev, "unhandled report %#02x\n", xfer->report);