usb: gadget: f_hid add super speed support
Add super speed descriptors to f_hid. Change-Id: I81f9c89963218d27c37f2a25e71245f2ee81a388 Signed-off-by: Janusz Dziedzic <januszx.dziedzic@linux.intel.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> Git-commit: dbf499cf720a0096acea7641492d9edeffc25d10 Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git [ajaya@codeaurora.org: drop changes for SSP descriptors] Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
This commit is contained in:
parent
825084cdc1
commit
6f3ba887e4
1 changed files with 66 additions and 1 deletions
|
@ -98,6 +98,60 @@ static struct hid_descriptor hidg_desc = {
|
||||||
/*.desc[0].wDescriptorLenght = DYNAMIC */
|
/*.desc[0].wDescriptorLenght = DYNAMIC */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Super-Speed Support */
|
||||||
|
|
||||||
|
static struct usb_endpoint_descriptor hidg_ss_in_ep_desc = {
|
||||||
|
.bLength = USB_DT_ENDPOINT_SIZE,
|
||||||
|
.bDescriptorType = USB_DT_ENDPOINT,
|
||||||
|
.bEndpointAddress = USB_DIR_IN,
|
||||||
|
.bmAttributes = USB_ENDPOINT_XFER_INT,
|
||||||
|
/*.wMaxPacketSize = DYNAMIC */
|
||||||
|
.bInterval = 4, /* FIXME: Add this field in the
|
||||||
|
* HID gadget configuration?
|
||||||
|
* (struct hidg_func_descriptor)
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct usb_ss_ep_comp_descriptor hidg_ss_in_comp_desc = {
|
||||||
|
.bLength = sizeof(hidg_ss_in_comp_desc),
|
||||||
|
.bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
|
||||||
|
|
||||||
|
/* .bMaxBurst = 0, */
|
||||||
|
/* .bmAttributes = 0, */
|
||||||
|
/* .wBytesPerInterval = DYNAMIC */
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct usb_endpoint_descriptor hidg_ss_out_ep_desc = {
|
||||||
|
.bLength = USB_DT_ENDPOINT_SIZE,
|
||||||
|
.bDescriptorType = USB_DT_ENDPOINT,
|
||||||
|
.bEndpointAddress = USB_DIR_OUT,
|
||||||
|
.bmAttributes = USB_ENDPOINT_XFER_INT,
|
||||||
|
/*.wMaxPacketSize = DYNAMIC */
|
||||||
|
.bInterval = 4, /* FIXME: Add this field in the
|
||||||
|
* HID gadget configuration?
|
||||||
|
* (struct hidg_func_descriptor)
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct usb_ss_ep_comp_descriptor hidg_ss_out_comp_desc = {
|
||||||
|
.bLength = sizeof(hidg_ss_out_comp_desc),
|
||||||
|
.bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
|
||||||
|
|
||||||
|
/* .bMaxBurst = 0, */
|
||||||
|
/* .bmAttributes = 0, */
|
||||||
|
/* .wBytesPerInterval = DYNAMIC */
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct usb_descriptor_header *hidg_ss_descriptors[] = {
|
||||||
|
(struct usb_descriptor_header *)&hidg_interface_desc,
|
||||||
|
(struct usb_descriptor_header *)&hidg_desc,
|
||||||
|
(struct usb_descriptor_header *)&hidg_ss_in_ep_desc,
|
||||||
|
(struct usb_descriptor_header *)&hidg_ss_in_comp_desc,
|
||||||
|
(struct usb_descriptor_header *)&hidg_ss_out_ep_desc,
|
||||||
|
(struct usb_descriptor_header *)&hidg_ss_out_comp_desc,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
/* High-Speed Support */
|
/* High-Speed Support */
|
||||||
|
|
||||||
static struct usb_endpoint_descriptor hidg_hs_in_ep_desc = {
|
static struct usb_endpoint_descriptor hidg_hs_in_ep_desc = {
|
||||||
|
@ -714,8 +768,14 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f)
|
||||||
/* set descriptor dynamic values */
|
/* set descriptor dynamic values */
|
||||||
hidg_interface_desc.bInterfaceSubClass = hidg->bInterfaceSubClass;
|
hidg_interface_desc.bInterfaceSubClass = hidg->bInterfaceSubClass;
|
||||||
hidg_interface_desc.bInterfaceProtocol = hidg->bInterfaceProtocol;
|
hidg_interface_desc.bInterfaceProtocol = hidg->bInterfaceProtocol;
|
||||||
|
hidg_ss_in_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length);
|
||||||
|
hidg_ss_in_comp_desc.wBytesPerInterval =
|
||||||
|
cpu_to_le16(hidg->report_length);
|
||||||
hidg_hs_in_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length);
|
hidg_hs_in_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length);
|
||||||
hidg_fs_in_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length);
|
hidg_fs_in_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length);
|
||||||
|
hidg_ss_out_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length);
|
||||||
|
hidg_ss_out_comp_desc.wBytesPerInterval =
|
||||||
|
cpu_to_le16(hidg->report_length);
|
||||||
hidg_hs_out_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length);
|
hidg_hs_out_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length);
|
||||||
hidg_fs_out_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length);
|
hidg_fs_out_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length);
|
||||||
/*
|
/*
|
||||||
|
@ -731,8 +791,13 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f)
|
||||||
hidg_hs_out_ep_desc.bEndpointAddress =
|
hidg_hs_out_ep_desc.bEndpointAddress =
|
||||||
hidg_fs_out_ep_desc.bEndpointAddress;
|
hidg_fs_out_ep_desc.bEndpointAddress;
|
||||||
|
|
||||||
|
hidg_ss_in_ep_desc.bEndpointAddress =
|
||||||
|
hidg_fs_in_ep_desc.bEndpointAddress;
|
||||||
|
hidg_ss_out_ep_desc.bEndpointAddress =
|
||||||
|
hidg_fs_out_ep_desc.bEndpointAddress;
|
||||||
|
|
||||||
status = usb_assign_descriptors(f, hidg_fs_descriptors,
|
status = usb_assign_descriptors(f, hidg_fs_descriptors,
|
||||||
hidg_hs_descriptors, NULL);
|
hidg_hs_descriptors, hidg_ss_descriptors);
|
||||||
if (status)
|
if (status)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue