Commit 55fd939e authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'usb-4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
 "Here are some small USB fixes for 4.13-rc2.

  The usual batch, gadget fixes for reported issues, as well as xhci
  fixes, and a small random collection of other fixes for reported
  issues.

  All have been in linux-next with no reported issues"

* tag 'usb-4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (25 commits)
  xhci: fix memleak in xhci_run()
  usb: xhci: fix spinlock recursion for USB2 test mode
  xhci: fix 20000ms port resume timeout
  usb: xhci: Issue stop EP command only when the EP state is running
  xhci: Bad Ethernet performance plugged in ASM1042A host
  xhci: Fix NULL pointer dereference when cleaning up streams for removed host
  usb: renesas_usbhs: gadget: disable all eps when the driver stops
  usb: renesas_usbhs: fix usbhsc_resume() for !USBHSF_RUNTIME_PWCTRL
  usb: gadget: udc: renesas_usb3: protect usb3_ep->started in usb3_start_pipen()
  usb: gadget: udc: renesas_usb3: fix zlp transfer by the dmac
  usb: gadget: udc: renesas_usb3: fix free size in renesas_usb3_dma_free_prd()
  usb: gadget: f_uac2: endianness fixes.
  usb: gadget: f_uac1: endianness fixes.
  include: usb: audio: specify exact endiannes of descriptors
  usb: gadget: udc: start_udc() can be static
  usb: dwc2: gadget: On USB RESET reset device address to zero
  usb: storage: return on error to avoid a null pointer dereference
  usb: typec: include linux/device.h in ucsi.h
  USB: cdc-acm: add device-id for quirky printer
  usb: dwc3: gadget: only unmap requests from DMA if mapped
  ...
parents bcb53e57 d6f5f071
...@@ -1829,6 +1829,9 @@ static const struct usb_device_id acm_ids[] = { ...@@ -1829,6 +1829,9 @@ static const struct usb_device_id acm_ids[] = {
{ USB_DEVICE(0x1576, 0x03b1), /* Maretron USB100 */ { USB_DEVICE(0x1576, 0x03b1), /* Maretron USB100 */
.driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
}, },
{ USB_DEVICE(0xfff0, 0x0100), /* DATECS FP-2000 */
.driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
},
{ USB_DEVICE(0x2912, 0x0001), /* ATOL FPrint */ { USB_DEVICE(0x2912, 0x0001), /* ATOL FPrint */
.driver_info = CLEAR_HALT_CONDITIONS, .driver_info = CLEAR_HALT_CONDITIONS,
......
...@@ -3573,6 +3573,9 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw) ...@@ -3573,6 +3573,9 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw)
/* Report disconnection if it is not already done. */ /* Report disconnection if it is not already done. */
dwc2_hsotg_disconnect(hsotg); dwc2_hsotg_disconnect(hsotg);
/* Reset device address to zero */
__bic32(hsotg->regs + DCFG, DCFG_DEVADDR_MASK);
if (usb_status & GOTGCTL_BSESVLD && connected) if (usb_status & GOTGCTL_BSESVLD && connected)
dwc2_hsotg_core_init_disconnected(hsotg, true); dwc2_hsotg_core_init_disconnected(hsotg, true);
} }
......
...@@ -766,15 +766,15 @@ static int dwc3_core_init(struct dwc3 *dwc) ...@@ -766,15 +766,15 @@ static int dwc3_core_init(struct dwc3 *dwc)
dwc->maximum_speed = USB_SPEED_HIGH; dwc->maximum_speed = USB_SPEED_HIGH;
} }
ret = dwc3_core_soft_reset(dwc); ret = dwc3_core_get_phy(dwc);
if (ret) if (ret)
goto err0; goto err0;
ret = dwc3_phy_setup(dwc); ret = dwc3_core_soft_reset(dwc);
if (ret) if (ret)
goto err0; goto err0;
ret = dwc3_core_get_phy(dwc); ret = dwc3_phy_setup(dwc);
if (ret) if (ret)
goto err0; goto err0;
......
...@@ -512,15 +512,6 @@ static int dwc3_omap_probe(struct platform_device *pdev) ...@@ -512,15 +512,6 @@ static int dwc3_omap_probe(struct platform_device *pdev)
/* check the DMA Status */ /* check the DMA Status */
reg = dwc3_omap_readl(omap->base, USBOTGSS_SYSCONFIG); reg = dwc3_omap_readl(omap->base, USBOTGSS_SYSCONFIG);
irq_set_status_flags(omap->irq, IRQ_NOAUTOEN);
ret = devm_request_threaded_irq(dev, omap->irq, dwc3_omap_interrupt,
dwc3_omap_interrupt_thread, IRQF_SHARED,
"dwc3-omap", omap);
if (ret) {
dev_err(dev, "failed to request IRQ #%d --> %d\n",
omap->irq, ret);
goto err1;
}
ret = dwc3_omap_extcon_register(omap); ret = dwc3_omap_extcon_register(omap);
if (ret < 0) if (ret < 0)
...@@ -532,8 +523,15 @@ static int dwc3_omap_probe(struct platform_device *pdev) ...@@ -532,8 +523,15 @@ static int dwc3_omap_probe(struct platform_device *pdev)
goto err1; goto err1;
} }
ret = devm_request_threaded_irq(dev, omap->irq, dwc3_omap_interrupt,
dwc3_omap_interrupt_thread, IRQF_SHARED,
"dwc3-omap", omap);
if (ret) {
dev_err(dev, "failed to request IRQ #%d --> %d\n",
omap->irq, ret);
goto err1;
}
dwc3_omap_enable_irqs(omap); dwc3_omap_enable_irqs(omap);
enable_irq(omap->irq);
return 0; return 0;
err1: err1:
......
...@@ -191,15 +191,17 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, ...@@ -191,15 +191,17 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
req->started = false; req->started = false;
list_del(&req->list); list_del(&req->list);
req->trb = NULL;
req->remaining = 0; req->remaining = 0;
if (req->request.status == -EINPROGRESS) if (req->request.status == -EINPROGRESS)
req->request.status = status; req->request.status = status;
if (req->trb)
usb_gadget_unmap_request_by_dev(dwc->sysdev, usb_gadget_unmap_request_by_dev(dwc->sysdev,
&req->request, req->direction); &req->request, req->direction);
req->trb = NULL;
trace_dwc3_gadget_giveback(req); trace_dwc3_gadget_giveback(req);
spin_unlock(&dwc->lock); spin_unlock(&dwc->lock);
......
...@@ -2490,7 +2490,7 @@ static int fsg_main_thread(void *common_) ...@@ -2490,7 +2490,7 @@ static int fsg_main_thread(void *common_)
int i; int i;
down_write(&common->filesem); down_write(&common->filesem);
for (i = 0; i < ARRAY_SIZE(common->luns); --i) { for (i = 0; i < ARRAY_SIZE(common->luns); i++) {
struct fsg_lun *curlun = common->luns[i]; struct fsg_lun *curlun = common->luns[i];
if (!curlun || !fsg_lun_is_open(curlun)) if (!curlun || !fsg_lun_is_open(curlun))
continue; continue;
......
...@@ -92,9 +92,9 @@ static struct uac_input_terminal_descriptor usb_out_it_desc = { ...@@ -92,9 +92,9 @@ static struct uac_input_terminal_descriptor usb_out_it_desc = {
.bDescriptorType = USB_DT_CS_INTERFACE, .bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_INPUT_TERMINAL, .bDescriptorSubtype = UAC_INPUT_TERMINAL,
.bTerminalID = USB_OUT_IT_ID, .bTerminalID = USB_OUT_IT_ID,
.wTerminalType = UAC_TERMINAL_STREAMING, .wTerminalType = cpu_to_le16(UAC_TERMINAL_STREAMING),
.bAssocTerminal = 0, .bAssocTerminal = 0,
.wChannelConfig = 0x3, .wChannelConfig = cpu_to_le16(0x3),
}; };
#define IO_OUT_OT_ID 2 #define IO_OUT_OT_ID 2
...@@ -103,7 +103,7 @@ static struct uac1_output_terminal_descriptor io_out_ot_desc = { ...@@ -103,7 +103,7 @@ static struct uac1_output_terminal_descriptor io_out_ot_desc = {
.bDescriptorType = USB_DT_CS_INTERFACE, .bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_OUTPUT_TERMINAL, .bDescriptorSubtype = UAC_OUTPUT_TERMINAL,
.bTerminalID = IO_OUT_OT_ID, .bTerminalID = IO_OUT_OT_ID,
.wTerminalType = UAC_OUTPUT_TERMINAL_SPEAKER, .wTerminalType = cpu_to_le16(UAC_OUTPUT_TERMINAL_SPEAKER),
.bAssocTerminal = 0, .bAssocTerminal = 0,
.bSourceID = USB_OUT_IT_ID, .bSourceID = USB_OUT_IT_ID,
}; };
...@@ -114,9 +114,9 @@ static struct uac_input_terminal_descriptor io_in_it_desc = { ...@@ -114,9 +114,9 @@ static struct uac_input_terminal_descriptor io_in_it_desc = {
.bDescriptorType = USB_DT_CS_INTERFACE, .bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_INPUT_TERMINAL, .bDescriptorSubtype = UAC_INPUT_TERMINAL,
.bTerminalID = IO_IN_IT_ID, .bTerminalID = IO_IN_IT_ID,
.wTerminalType = UAC_INPUT_TERMINAL_MICROPHONE, .wTerminalType = cpu_to_le16(UAC_INPUT_TERMINAL_MICROPHONE),
.bAssocTerminal = 0, .bAssocTerminal = 0,
.wChannelConfig = 0x3, .wChannelConfig = cpu_to_le16(0x3),
}; };
#define USB_IN_OT_ID 4 #define USB_IN_OT_ID 4
...@@ -125,7 +125,7 @@ static struct uac1_output_terminal_descriptor usb_in_ot_desc = { ...@@ -125,7 +125,7 @@ static struct uac1_output_terminal_descriptor usb_in_ot_desc = {
.bDescriptorType = USB_DT_CS_INTERFACE, .bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_OUTPUT_TERMINAL, .bDescriptorSubtype = UAC_OUTPUT_TERMINAL,
.bTerminalID = USB_IN_OT_ID, .bTerminalID = USB_IN_OT_ID,
.wTerminalType = UAC_TERMINAL_STREAMING, .wTerminalType = cpu_to_le16(UAC_TERMINAL_STREAMING),
.bAssocTerminal = 0, .bAssocTerminal = 0,
.bSourceID = IO_IN_IT_ID, .bSourceID = IO_IN_IT_ID,
}; };
...@@ -174,7 +174,7 @@ static struct uac1_as_header_descriptor as_out_header_desc = { ...@@ -174,7 +174,7 @@ static struct uac1_as_header_descriptor as_out_header_desc = {
.bDescriptorSubtype = UAC_AS_GENERAL, .bDescriptorSubtype = UAC_AS_GENERAL,
.bTerminalLink = USB_OUT_IT_ID, .bTerminalLink = USB_OUT_IT_ID,
.bDelay = 1, .bDelay = 1,
.wFormatTag = UAC_FORMAT_TYPE_I_PCM, .wFormatTag = cpu_to_le16(UAC_FORMAT_TYPE_I_PCM),
}; };
static struct uac1_as_header_descriptor as_in_header_desc = { static struct uac1_as_header_descriptor as_in_header_desc = {
...@@ -183,7 +183,7 @@ static struct uac1_as_header_descriptor as_in_header_desc = { ...@@ -183,7 +183,7 @@ static struct uac1_as_header_descriptor as_in_header_desc = {
.bDescriptorSubtype = UAC_AS_GENERAL, .bDescriptorSubtype = UAC_AS_GENERAL,
.bTerminalLink = USB_IN_OT_ID, .bTerminalLink = USB_IN_OT_ID,
.bDelay = 1, .bDelay = 1,
.wFormatTag = UAC_FORMAT_TYPE_I_PCM, .wFormatTag = cpu_to_le16(UAC_FORMAT_TYPE_I_PCM),
}; };
DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(1); DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(1);
...@@ -606,8 +606,8 @@ static int f_audio_bind(struct usb_configuration *c, struct usb_function *f) ...@@ -606,8 +606,8 @@ static int f_audio_bind(struct usb_configuration *c, struct usb_function *f)
if (status) if (status)
goto fail; goto fail;
audio->out_ep_maxpsize = as_out_ep_desc.wMaxPacketSize; audio->out_ep_maxpsize = le16_to_cpu(as_out_ep_desc.wMaxPacketSize);
audio->in_ep_maxpsize = as_in_ep_desc.wMaxPacketSize; audio->in_ep_maxpsize = le16_to_cpu(as_in_ep_desc.wMaxPacketSize);
audio->params.c_chmask = audio_opts->c_chmask; audio->params.c_chmask = audio_opts->c_chmask;
audio->params.c_srate = audio_opts->c_srate; audio->params.c_srate = audio_opts->c_srate;
audio->params.c_ssize = audio_opts->c_ssize; audio->params.c_ssize = audio_opts->c_ssize;
......
...@@ -168,7 +168,7 @@ static struct uac2_input_terminal_descriptor usb_out_it_desc = { ...@@ -168,7 +168,7 @@ static struct uac2_input_terminal_descriptor usb_out_it_desc = {
.bAssocTerminal = 0, .bAssocTerminal = 0,
.bCSourceID = USB_OUT_CLK_ID, .bCSourceID = USB_OUT_CLK_ID,
.iChannelNames = 0, .iChannelNames = 0,
.bmControls = (CONTROL_RDWR << COPY_CTRL), .bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL),
}; };
/* Input Terminal for I/O-In */ /* Input Terminal for I/O-In */
...@@ -182,7 +182,7 @@ static struct uac2_input_terminal_descriptor io_in_it_desc = { ...@@ -182,7 +182,7 @@ static struct uac2_input_terminal_descriptor io_in_it_desc = {
.bAssocTerminal = 0, .bAssocTerminal = 0,
.bCSourceID = USB_IN_CLK_ID, .bCSourceID = USB_IN_CLK_ID,
.iChannelNames = 0, .iChannelNames = 0,
.bmControls = (CONTROL_RDWR << COPY_CTRL), .bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL),
}; };
/* Ouput Terminal for USB_IN */ /* Ouput Terminal for USB_IN */
...@@ -196,7 +196,7 @@ static struct uac2_output_terminal_descriptor usb_in_ot_desc = { ...@@ -196,7 +196,7 @@ static struct uac2_output_terminal_descriptor usb_in_ot_desc = {
.bAssocTerminal = 0, .bAssocTerminal = 0,
.bSourceID = IO_IN_IT_ID, .bSourceID = IO_IN_IT_ID,
.bCSourceID = USB_IN_CLK_ID, .bCSourceID = USB_IN_CLK_ID,
.bmControls = (CONTROL_RDWR << COPY_CTRL), .bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL),
}; };
/* Ouput Terminal for I/O-Out */ /* Ouput Terminal for I/O-Out */
...@@ -210,7 +210,7 @@ static struct uac2_output_terminal_descriptor io_out_ot_desc = { ...@@ -210,7 +210,7 @@ static struct uac2_output_terminal_descriptor io_out_ot_desc = {
.bAssocTerminal = 0, .bAssocTerminal = 0,
.bSourceID = USB_OUT_IT_ID, .bSourceID = USB_OUT_IT_ID,
.bCSourceID = USB_OUT_CLK_ID, .bCSourceID = USB_OUT_CLK_ID,
.bmControls = (CONTROL_RDWR << COPY_CTRL), .bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL),
}; };
static struct uac2_ac_header_descriptor ac_hdr_desc = { static struct uac2_ac_header_descriptor ac_hdr_desc = {
...@@ -220,9 +220,10 @@ static struct uac2_ac_header_descriptor ac_hdr_desc = { ...@@ -220,9 +220,10 @@ static struct uac2_ac_header_descriptor ac_hdr_desc = {
.bDescriptorSubtype = UAC_MS_HEADER, .bDescriptorSubtype = UAC_MS_HEADER,
.bcdADC = cpu_to_le16(0x200), .bcdADC = cpu_to_le16(0x200),
.bCategory = UAC2_FUNCTION_IO_BOX, .bCategory = UAC2_FUNCTION_IO_BOX,
.wTotalLength = sizeof in_clk_src_desc + sizeof out_clk_src_desc .wTotalLength = cpu_to_le16(sizeof in_clk_src_desc
+ sizeof usb_out_it_desc + sizeof io_in_it_desc + sizeof out_clk_src_desc + sizeof usb_out_it_desc
+ sizeof usb_in_ot_desc + sizeof io_out_ot_desc, + sizeof io_in_it_desc + sizeof usb_in_ot_desc
+ sizeof io_out_ot_desc),
.bmControls = 0, .bmControls = 0,
}; };
...@@ -569,10 +570,12 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) ...@@ -569,10 +570,12 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
return ret; return ret;
} }
agdev->in_ep_maxpsize = max(fs_epin_desc.wMaxPacketSize, agdev->in_ep_maxpsize = max_t(u16,
hs_epin_desc.wMaxPacketSize); le16_to_cpu(fs_epin_desc.wMaxPacketSize),
agdev->out_ep_maxpsize = max(fs_epout_desc.wMaxPacketSize, le16_to_cpu(hs_epin_desc.wMaxPacketSize));
hs_epout_desc.wMaxPacketSize); agdev->out_ep_maxpsize = max_t(u16,
le16_to_cpu(fs_epout_desc.wMaxPacketSize),
le16_to_cpu(hs_epout_desc.wMaxPacketSize));
hs_epout_desc.bEndpointAddress = fs_epout_desc.bEndpointAddress; hs_epout_desc.bEndpointAddress = fs_epout_desc.bEndpointAddress;
hs_epin_desc.bEndpointAddress = fs_epin_desc.bEndpointAddress; hs_epin_desc.bEndpointAddress = fs_epin_desc.bEndpointAddress;
......
...@@ -192,7 +192,7 @@ config USB_RENESAS_USBHS_UDC ...@@ -192,7 +192,7 @@ config USB_RENESAS_USBHS_UDC
config USB_RENESAS_USB3 config USB_RENESAS_USB3
tristate 'Renesas USB3.0 Peripheral controller' tristate 'Renesas USB3.0 Peripheral controller'
depends on ARCH_RENESAS || COMPILE_TEST depends on ARCH_RENESAS || COMPILE_TEST
depends on EXTCON depends on EXTCON && HAS_DMA
help help
Renesas USB3.0 Peripheral controller is a USB peripheral controller Renesas USB3.0 Peripheral controller is a USB peripheral controller
that supports super, high, and full speed USB 3.0 data transfers. that supports super, high, and full speed USB 3.0 data transfers.
...@@ -257,6 +257,7 @@ config USB_MV_U3D ...@@ -257,6 +257,7 @@ config USB_MV_U3D
config USB_SNP_CORE config USB_SNP_CORE
depends on (USB_AMD5536UDC || USB_SNP_UDC_PLAT) depends on (USB_AMD5536UDC || USB_SNP_UDC_PLAT)
depends on HAS_DMA
tristate tristate
help help
This enables core driver support for Synopsys USB 2.0 Device This enables core driver support for Synopsys USB 2.0 Device
...@@ -271,7 +272,7 @@ config USB_SNP_CORE ...@@ -271,7 +272,7 @@ config USB_SNP_CORE
config USB_SNP_UDC_PLAT config USB_SNP_UDC_PLAT
tristate "Synopsys USB 2.0 Device controller" tristate "Synopsys USB 2.0 Device controller"
depends on (USB_GADGET && OF) depends on USB_GADGET && OF && HAS_DMA
select USB_GADGET_DUALSPEED select USB_GADGET_DUALSPEED
select USB_SNP_CORE select USB_SNP_CORE
default ARCH_BCM_IPROC default ARCH_BCM_IPROC
......
...@@ -89,6 +89,9 @@ ...@@ -89,6 +89,9 @@
/* USB_COM_CON */ /* USB_COM_CON */
#define USB_COM_CON_CONF BIT(24) #define USB_COM_CON_CONF BIT(24)
#define USB_COM_CON_PN_WDATAIF_NL BIT(23)
#define USB_COM_CON_PN_RDATAIF_NL BIT(22)
#define USB_COM_CON_PN_LSTTR_PP BIT(21)
#define USB_COM_CON_SPD_MODE BIT(17) #define USB_COM_CON_SPD_MODE BIT(17)
#define USB_COM_CON_EP0_EN BIT(16) #define USB_COM_CON_EP0_EN BIT(16)
#define USB_COM_CON_DEV_ADDR_SHIFT 8 #define USB_COM_CON_DEV_ADDR_SHIFT 8
...@@ -686,6 +689,9 @@ static void renesas_usb3_init_controller(struct renesas_usb3 *usb3) ...@@ -686,6 +689,9 @@ static void renesas_usb3_init_controller(struct renesas_usb3 *usb3)
{ {
usb3_init_axi_bridge(usb3); usb3_init_axi_bridge(usb3);
usb3_init_epc_registers(usb3); usb3_init_epc_registers(usb3);
usb3_set_bit(usb3, USB_COM_CON_PN_WDATAIF_NL |
USB_COM_CON_PN_RDATAIF_NL | USB_COM_CON_PN_LSTTR_PP,
USB3_USB_COM_CON);
usb3_write(usb3, USB_OTG_IDMON, USB3_USB_OTG_INT_STA); usb3_write(usb3, USB_OTG_IDMON, USB3_USB_OTG_INT_STA);
usb3_write(usb3, USB_OTG_IDMON, USB3_USB_OTG_INT_ENA); usb3_write(usb3, USB_OTG_IDMON, USB3_USB_OTG_INT_ENA);
...@@ -1369,7 +1375,7 @@ static int renesas_usb3_dma_free_prd(struct renesas_usb3 *usb3, ...@@ -1369,7 +1375,7 @@ static int renesas_usb3_dma_free_prd(struct renesas_usb3 *usb3,
usb3_for_each_dma(usb3, dma, i) { usb3_for_each_dma(usb3, dma, i) {
if (dma->prd) { if (dma->prd) {
dma_free_coherent(dev, USB3_DMA_MAX_XFER_SIZE, dma_free_coherent(dev, USB3_DMA_PRD_SIZE,
dma->prd, dma->prd_dma); dma->prd, dma->prd_dma);
dma->prd = NULL; dma->prd = NULL;
} }
...@@ -1409,12 +1415,12 @@ static void usb3_start_pipen(struct renesas_usb3_ep *usb3_ep, ...@@ -1409,12 +1415,12 @@ static void usb3_start_pipen(struct renesas_usb3_ep *usb3_ep,
int ret = -EAGAIN; int ret = -EAGAIN;
u32 enable_bits = 0; u32 enable_bits = 0;
spin_lock_irqsave(&usb3->lock, flags);
if (usb3_ep->halt || usb3_ep->started) if (usb3_ep->halt || usb3_ep->started)
return; goto out;
if (usb3_req != usb3_req_first) if (usb3_req != usb3_req_first)
return; goto out;
spin_lock_irqsave(&usb3->lock, flags);
if (usb3_pn_change(usb3, usb3_ep->num) < 0) if (usb3_pn_change(usb3, usb3_ep->num) < 0)
goto out; goto out;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
/* description */ /* description */
#define UDC_MOD_DESCRIPTION "Synopsys UDC platform driver" #define UDC_MOD_DESCRIPTION "Synopsys UDC platform driver"
void start_udc(struct udc *udc) static void start_udc(struct udc *udc)
{ {
if (udc->driver) { if (udc->driver) {
dev_info(udc->dev, "Connecting...\n"); dev_info(udc->dev, "Connecting...\n");
...@@ -38,7 +38,7 @@ void start_udc(struct udc *udc) ...@@ -38,7 +38,7 @@ void start_udc(struct udc *udc)
} }
} }
void stop_udc(struct udc *udc) static void stop_udc(struct udc *udc)
{ {
int tmp; int tmp;
u32 reg; u32 reg;
...@@ -76,7 +76,7 @@ void stop_udc(struct udc *udc) ...@@ -76,7 +76,7 @@ void stop_udc(struct udc *udc)
dev_info(udc->dev, "Device disconnected\n"); dev_info(udc->dev, "Device disconnected\n");
} }
void udc_drd_work(struct work_struct *work) static void udc_drd_work(struct work_struct *work)
{ {
struct udc *udc; struct udc *udc;
......
...@@ -77,6 +77,16 @@ ...@@ -77,6 +77,16 @@
#define USB_INTEL_USB3_PSSEN 0xD8 #define USB_INTEL_USB3_PSSEN 0xD8
#define USB_INTEL_USB3PRM 0xDC #define USB_INTEL_USB3PRM 0xDC
/* ASMEDIA quirk use */
#define ASMT_DATA_WRITE0_REG 0xF8
#define ASMT_DATA_WRITE1_REG 0xFC
#define ASMT_CONTROL_REG 0xE0
#define ASMT_CONTROL_WRITE_BIT 0x02
#define ASMT_WRITEREG_CMD 0x10423
#define ASMT_FLOWCTL_ADDR 0xFA30
#define ASMT_FLOWCTL_DATA 0xBA
#define ASMT_PSEUDO_DATA 0
/* /*
* amd_chipset_gen values represent AMD different chipset generations * amd_chipset_gen values represent AMD different chipset generations
*/ */
...@@ -412,6 +422,50 @@ void usb_amd_quirk_pll_disable(void) ...@@ -412,6 +422,50 @@ void usb_amd_quirk_pll_disable(void)
} }
EXPORT_SYMBOL_GPL(usb_amd_quirk_pll_disable); EXPORT_SYMBOL_GPL(usb_amd_quirk_pll_disable);
static int usb_asmedia_wait_write(struct pci_dev *pdev)
{
unsigned long retry_count;
unsigned char value;
for (retry_count = 1000; retry_count > 0; --retry_count) {
pci_read_config_byte(pdev, ASMT_CONTROL_REG, &value);
if (value == 0xff) {
dev_err(&pdev->dev, "%s: check_ready ERROR", __func__);
return -EIO;
}
if ((value & ASMT_CONTROL_WRITE_BIT) == 0)
return 0;
usleep_range(40, 60);
}
dev_warn(&pdev->dev, "%s: check_write_ready timeout", __func__);
return -ETIMEDOUT;
}
void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev)
{
if (usb_asmedia_wait_write(pdev) != 0)
return;
/* send command and address to device */
pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_WRITEREG_CMD);
pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_FLOWCTL_ADDR);
pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
if (usb_asmedia_wait_write(pdev) != 0)
return;
/* send data to device */
pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_FLOWCTL_DATA);
pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_PSEUDO_DATA);
pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
}
EXPORT_SYMBOL_GPL(usb_asmedia_modifyflowcontrol);
void usb_amd_quirk_pll_enable(void) void usb_amd_quirk_pll_enable(void)
{ {
usb_amd_quirk_pll(0); usb_amd_quirk_pll(0);
......
...@@ -11,6 +11,7 @@ bool usb_amd_prefetch_quirk(void); ...@@ -11,6 +11,7 @@ bool usb_amd_prefetch_quirk(void);
void usb_amd_dev_put(void); void usb_amd_dev_put(void);
void usb_amd_quirk_pll_disable(void); void usb_amd_quirk_pll_disable(void);
void usb_amd_quirk_pll_enable(void); void usb_amd_quirk_pll_enable(void);
void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev);
void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev); void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev);
void usb_disable_xhci_ports(struct pci_dev *xhci_pdev); void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
void sb800_prefetch(struct device *dev, int on); void sb800_prefetch(struct device *dev, int on);
...@@ -18,6 +19,7 @@ void sb800_prefetch(struct device *dev, int on); ...@@ -18,6 +19,7 @@ void sb800_prefetch(struct device *dev, int on);
struct pci_dev; struct pci_dev;
static inline void usb_amd_quirk_pll_disable(void) {} static inline void usb_amd_quirk_pll_disable(void) {}
static inline void usb_amd_quirk_pll_enable(void) {} static inline void usb_amd_quirk_pll_enable(void) {}
static inline void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) {}
static inline void usb_amd_dev_put(void) {} static inline void usb_amd_dev_put(void) {}
static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {} static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {}
static inline void sb800_prefetch(struct device *dev, int on) {} static inline void sb800_prefetch(struct device *dev, int on) {}
......
...@@ -398,14 +398,21 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) ...@@ -398,14 +398,21 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
spin_lock_irqsave(&xhci->lock, flags); spin_lock_irqsave(&xhci->lock, flags);
for (i = LAST_EP_INDEX; i > 0; i--) { for (i = LAST_EP_INDEX; i > 0; i--) {
if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue) { if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue) {
struct xhci_ep_ctx *ep_ctx;
struct xhci_command *command; struct xhci_command *command;
ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->out_ctx, i);
/* Check ep is running, required by AMD SNPS 3.1 xHC */
if (GET_EP_CTX_STATE(ep_ctx) != EP_STATE_RUNNING)
continue;
command = xhci_alloc_command(xhci, false, false, command = xhci_alloc_command(xhci, false, false,
GFP_NOWAIT); GFP_NOWAIT);
if (!command) { if (!command) {
spin_unlock_irqrestore(&xhci->lock, flags); spin_unlock_irqrestore(&xhci->lock, flags);
xhci_free_command(xhci, cmd); xhci_free_command(xhci, cmd);
return -ENOMEM; return -ENOMEM;
} }
xhci_queue_stop_endpoint(xhci, command, slot_id, i, xhci_queue_stop_endpoint(xhci, command, slot_id, i,
suspend); suspend);
...@@ -603,12 +610,14 @@ static int xhci_enter_test_mode(struct xhci_hcd *xhci, ...@@ -603,12 +610,14 @@ static int xhci_enter_test_mode(struct xhci_hcd *xhci,
/* Disable all Device Slots */ /* Disable all Device Slots */
xhci_dbg(xhci, "Disable all slots\n"); xhci_dbg(xhci, "Disable all slots\n");
spin_unlock_irqrestore(&xhci->lock, *flags);
for (i = 1; i <= HCS_MAX_SLOTS(xhci->hcs_params1); i++) { for (i = 1; i <= HCS_MAX_SLOTS(xhci->hcs_params1); i++) {
retval = xhci_disable_slot(xhci, NULL, i); retval = xhci_disable_slot(xhci, NULL, i);
if (retval) if (retval)
xhci_err(xhci, "Failed to disable slot %d, %d. Enter test mode anyway\n", xhci_err(xhci, "Failed to disable slot %d, %d. Enter test mode anyway\n",
i, retval); i, retval);
} }
spin_lock_irqsave(&xhci->lock, *flags);
/* Put all ports to the Disable state by clear PP */ /* Put all ports to the Disable state by clear PP */
xhci_dbg(xhci, "Disable all port (PP = 0)\n"); xhci_dbg(xhci, "Disable all port (PP = 0)\n");
/* Power off USB3 ports*/ /* Power off USB3 ports*/
...@@ -897,6 +906,9 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, ...@@ -897,6 +906,9 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd,
clear_bit(wIndex, &bus_state->resuming_ports); clear_bit(wIndex, &bus_state->resuming_ports);
set_bit(wIndex, &bus_state->rexit_ports); set_bit(wIndex, &bus_state->rexit_ports);
xhci_test_and_clear_bit(xhci, port_array, wIndex,
PORT_PLC);
xhci_set_link_state(xhci, port_array, wIndex, xhci_set_link_state(xhci, port_array, wIndex,
XDEV_U0); XDEV_U0);
......
...@@ -59,6 +59,8 @@ ...@@ -59,6 +59,8 @@
#define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb #define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb
#define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc #define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc
#define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142
static const char hcd_name[] = "xhci_hcd"; static const char hcd_name[] = "xhci_hcd";
static struct hc_driver __read_mostly xhci_pci_hc_driver; static struct hc_driver __read_mostly xhci_pci_hc_driver;
...@@ -217,6 +219,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) ...@@ -217,6 +219,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
pdev->device == 0x1142) pdev->device == 0x1142)
xhci->quirks |= XHCI_TRUST_TX_LENGTH; xhci->quirks |= XHCI_TRUST_TX_LENGTH;
if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI)
xhci->quirks |= XHCI_ASMEDIA_MODIFY_FLOWCONTROL;
if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241) if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241)
xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7; xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7;
......
...@@ -864,13 +864,16 @@ static void xhci_kill_endpoint_urbs(struct xhci_hcd *xhci, ...@@ -864,13 +864,16 @@ static void xhci_kill_endpoint_urbs(struct xhci_hcd *xhci,
(ep->ep_state & EP_GETTING_NO_STREAMS)) { (ep->ep_state & EP_GETTING_NO_STREAMS)) {
int stream_id; int stream_id;
for (stream_id = 0; stream_id < ep->stream_info->num_streams; for (stream_id = 1; stream_id < ep->stream_info->num_streams;
stream_id++) { stream_id++) {
ring = ep->stream_info->stream_rings[stream_id];
if (!ring)
continue;
xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
"Killing URBs for slot ID %u, ep index %u, stream %u", "Killing URBs for slot ID %u, ep index %u, stream %u",
slot_id, ep_index, stream_id + 1); slot_id, ep_index, stream_id);
xhci_kill_ring_urbs(xhci, xhci_kill_ring_urbs(xhci, ring);
ep->stream_info->stream_rings[stream_id]);
} }
} else { } else {
ring = ep->ring; ring = ep->ring;
......
...@@ -198,6 +198,9 @@ int xhci_reset(struct xhci_hcd *xhci) ...@@ -198,6 +198,9 @@ int xhci_reset(struct xhci_hcd *xhci)
if (ret) if (ret)
return ret; return ret;
if (xhci->quirks & XHCI_ASMEDIA_MODIFY_FLOWCONTROL)
usb_asmedia_modifyflowcontrol(to_pci_dev(xhci_to_hcd(xhci)->self.controller));
xhci_dbg_trace(xhci, trace_xhci_dbg_init, xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"Wait for controller to be ready for doorbell rings"); "Wait for controller to be ready for doorbell rings");
/* /*
...@@ -622,8 +625,10 @@ int xhci_run(struct usb_hcd *hcd) ...@@ -622,8 +625,10 @@ int xhci_run(struct usb_hcd *hcd)
if (!command) if (!command)
return -ENOMEM; return -ENOMEM;
xhci_queue_vendor_command(xhci, command, 0, 0, 0, ret = xhci_queue_vendor_command(xhci, command, 0, 0, 0,
TRB_TYPE(TRB_NEC_GET_FW)); TRB_TYPE(TRB_NEC_GET_FW));
if (ret)
xhci_free_command(xhci, command);
} }
xhci_dbg_trace(xhci, trace_xhci_dbg_init, xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"Finished xhci_run for USB2 roothub"); "Finished xhci_run for USB2 roothub");
...@@ -1085,6 +1090,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) ...@@ -1085,6 +1090,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && !comp_timer_running) if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && !comp_timer_running)
compliance_mode_recovery_timer_init(xhci); compliance_mode_recovery_timer_init(xhci);
if (xhci->quirks & XHCI_ASMEDIA_MODIFY_FLOWCONTROL)
usb_asmedia_modifyflowcontrol(to_pci_dev(hcd->self.controller));
/* Re-enable port polling. */ /* Re-enable port polling. */
xhci_dbg(xhci, "%s: starting port polling.\n", __func__); xhci_dbg(xhci, "%s: starting port polling.\n", __func__);
set_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags); set_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags);
......
...@@ -1820,6 +1820,7 @@ struct xhci_hcd { ...@@ -1820,6 +1820,7 @@ struct xhci_hcd {
#define XHCI_BROKEN_PORT_PED (1 << 25) #define XHCI_BROKEN_PORT_PED (1 << 25)
#define XHCI_LIMIT_ENDPOINT_INTERVAL_7 (1 << 26) #define XHCI_LIMIT_ENDPOINT_INTERVAL_7 (1 << 26)
#define XHCI_U2_DISABLE_WAKE (1 << 27) #define XHCI_U2_DISABLE_WAKE (1 << 27)
#define XHCI_ASMEDIA_MODIFY_FLOWCONTROL (1 << 28)
unsigned int num_active_eps; unsigned int num_active_eps;
unsigned int limit_active_eps; unsigned int limit_active_eps;
......
...@@ -752,8 +752,10 @@ static int usbhsc_resume(struct device *dev) ...@@ -752,8 +752,10 @@ static int usbhsc_resume(struct device *dev)
struct usbhs_priv *priv = dev_get_drvdata(dev); struct usbhs_priv *priv = dev_get_drvdata(dev);
struct platform_device *pdev = usbhs_priv_to_pdev(priv); struct platform_device *pdev = usbhs_priv_to_pdev(priv);
if (!usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) if (!usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) {
usbhsc_power_ctrl(priv, 1); usbhsc_power_ctrl(priv, 1);
usbhs_mod_autonomy_mode(priv);
}
usbhs_platform_call(priv, phy_reset, pdev); usbhs_platform_call(priv, phy_reset, pdev);
......
...@@ -37,6 +37,7 @@ struct usbhsg_gpriv; ...@@ -37,6 +37,7 @@ struct usbhsg_gpriv;
struct usbhsg_uep { struct usbhsg_uep {
struct usb_ep ep; struct usb_ep ep;
struct usbhs_pipe *pipe; struct usbhs_pipe *pipe;
spinlock_t lock; /* protect the pipe */
char ep_name[EP_NAME_SIZE]; char ep_name[EP_NAME_SIZE];
...@@ -636,10 +637,16 @@ static int usbhsg_ep_enable(struct usb_ep *ep, ...@@ -636,10 +637,16 @@ static int usbhsg_ep_enable(struct usb_ep *ep,
static int usbhsg_ep_disable(struct usb_ep *ep) static int usbhsg_ep_disable(struct usb_ep *ep)
{ {
struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep);
struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); struct usbhs_pipe *pipe;
unsigned long flags;
int ret = 0;
if (!pipe) spin_lock_irqsave(&uep->lock, flags);
return -EINVAL; pipe = usbhsg_uep_to_pipe(uep);
if (!pipe) {
ret = -EINVAL;
goto out;
}
usbhsg_pipe_disable(uep); usbhsg_pipe_disable(uep);
usbhs_pipe_free(pipe); usbhs_pipe_free(pipe);
...@@ -647,6 +654,9 @@ static int usbhsg_ep_disable(struct usb_ep *ep) ...@@ -647,6 +654,9 @@ static int usbhsg_ep_disable(struct usb_ep *ep)
uep->pipe->mod_private = NULL; uep->pipe->mod_private = NULL;
uep->pipe = NULL; uep->pipe = NULL;
out:
spin_unlock_irqrestore(&uep->lock, flags);
return 0; return 0;
} }
...@@ -696,8 +706,11 @@ static int usbhsg_ep_dequeue(struct usb_ep *ep, struct usb_request *req) ...@@ -696,8 +706,11 @@ static int usbhsg_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
{ {
struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep);
struct usbhsg_request *ureq = usbhsg_req_to_ureq(req); struct usbhsg_request *ureq = usbhsg_req_to_ureq(req);
struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); struct usbhs_pipe *pipe;
unsigned long flags;
spin_lock_irqsave(&uep->lock, flags);
pipe = usbhsg_uep_to_pipe(uep);
if (pipe) if (pipe)
usbhs_pkt_pop(pipe, usbhsg_ureq_to_pkt(ureq)); usbhs_pkt_pop(pipe, usbhsg_ureq_to_pkt(ureq));
...@@ -706,6 +719,7 @@ static int usbhsg_ep_dequeue(struct usb_ep *ep, struct usb_request *req) ...@@ -706,6 +719,7 @@ static int usbhsg_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
* even if the pipe is NULL. * even if the pipe is NULL.
*/ */
usbhsg_queue_pop(uep, ureq, -ECONNRESET); usbhsg_queue_pop(uep, ureq, -ECONNRESET);
spin_unlock_irqrestore(&uep->lock, flags);
return 0; return 0;
} }
...@@ -852,10 +866,10 @@ static int usbhsg_try_stop(struct usbhs_priv *priv, u32 status) ...@@ -852,10 +866,10 @@ static int usbhsg_try_stop(struct usbhs_priv *priv, u32 status)
{ {
struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv);
struct usbhs_mod *mod = usbhs_mod_get_current(priv); struct usbhs_mod *mod = usbhs_mod_get_current(priv);
struct usbhsg_uep *dcp = usbhsg_gpriv_to_dcp(gpriv); struct usbhsg_uep *uep;
struct device *dev = usbhs_priv_to_dev(priv); struct device *dev = usbhs_priv_to_dev(priv);
unsigned long flags; unsigned long flags;
int ret = 0; int ret = 0, i;
/******************** spin lock ********************/ /******************** spin lock ********************/
usbhs_lock(priv, flags); usbhs_lock(priv, flags);
...@@ -887,7 +901,9 @@ static int usbhsg_try_stop(struct usbhs_priv *priv, u32 status) ...@@ -887,7 +901,9 @@ static int usbhsg_try_stop(struct usbhs_priv *priv, u32 status)
usbhs_sys_set_test_mode(priv, 0); usbhs_sys_set_test_mode(priv, 0);
usbhs_sys_function_ctrl(priv, 0); usbhs_sys_function_ctrl(priv, 0);
usbhsg_ep_disable(&dcp->ep); /* disable all eps */
usbhsg_for_each_uep_with_dcp(uep, gpriv, i)
usbhsg_ep_disable(&uep->ep);
dev_dbg(dev, "stop gadget\n"); dev_dbg(dev, "stop gadget\n");
...@@ -1069,6 +1085,7 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) ...@@ -1069,6 +1085,7 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
ret = -ENOMEM; ret = -ENOMEM;
goto usbhs_mod_gadget_probe_err_gpriv; goto usbhs_mod_gadget_probe_err_gpriv;
} }
spin_lock_init(&uep->lock);
gpriv->transceiver = usb_get_phy(USB_PHY_TYPE_UNDEFINED); gpriv->transceiver = usb_get_phy(USB_PHY_TYPE_UNDEFINED);
dev_info(dev, "%stransceiver found\n", dev_info(dev, "%stransceiver found\n",
......
...@@ -1529,8 +1529,11 @@ static void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us) ...@@ -1529,8 +1529,11 @@ static void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us)
/* Make sure driver was initialized */ /* Make sure driver was initialized */
if (us->extra == NULL) if (us->extra == NULL) {
usb_stor_dbg(us, "ERROR Driver not initialized\n"); usb_stor_dbg(us, "ERROR Driver not initialized\n");
srb->result = DID_ERROR << 16;
return;
}
scsi_set_resid(srb, 0); scsi_set_resid(srb, 0);
/* scsi_bufflen might change in protocol translation to ata */ /* scsi_bufflen might change in protocol translation to ata */
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#define __DRIVER_USB_TYPEC_UCSI_H #define __DRIVER_USB_TYPEC_UCSI_H
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/device.h>
#include <linux/types.h> #include <linux/types.h>
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
......
...@@ -115,13 +115,13 @@ struct uac2_input_terminal_descriptor { ...@@ -115,13 +115,13 @@ struct uac2_input_terminal_descriptor {
__u8 bDescriptorType; __u8 bDescriptorType;
__u8 bDescriptorSubtype; __u8 bDescriptorSubtype;
__u8 bTerminalID; __u8 bTerminalID;
__u16 wTerminalType; __le16 wTerminalType;
__u8 bAssocTerminal; __u8 bAssocTerminal;
__u8 bCSourceID; __u8 bCSourceID;
__u8 bNrChannels; __u8 bNrChannels;
__u32 bmChannelConfig; __le32 bmChannelConfig;
__u8 iChannelNames; __u8 iChannelNames;
__u16 bmControls; __le16 bmControls;
__u8 iTerminal; __u8 iTerminal;
} __attribute__((packed)); } __attribute__((packed));
...@@ -132,11 +132,11 @@ struct uac2_output_terminal_descriptor { ...@@ -132,11 +132,11 @@ struct uac2_output_terminal_descriptor {
__u8 bDescriptorType; __u8 bDescriptorType;
__u8 bDescriptorSubtype; __u8 bDescriptorSubtype;
__u8 bTerminalID; __u8 bTerminalID;
__u16 wTerminalType; __le16 wTerminalType;
__u8 bAssocTerminal; __u8 bAssocTerminal;
__u8 bSourceID; __u8 bSourceID;
__u8 bCSourceID; __u8 bCSourceID;
__u16 bmControls; __le16 bmControls;
__u8 iTerminal; __u8 iTerminal;
} __attribute__((packed)); } __attribute__((packed));
...@@ -164,9 +164,9 @@ struct uac2_as_header_descriptor { ...@@ -164,9 +164,9 @@ struct uac2_as_header_descriptor {
__u8 bTerminalLink; __u8 bTerminalLink;
__u8 bmControls; __u8 bmControls;
__u8 bFormatType; __u8 bFormatType;
__u32 bmFormats; __le32 bmFormats;
__u8 bNrChannels; __u8 bNrChannels;
__u32 bmChannelConfig; __le32 bmChannelConfig;
__u8 iChannelNames; __u8 iChannelNames;
} __attribute__((packed)); } __attribute__((packed));
......
...@@ -333,7 +333,7 @@ struct uac_processing_unit_descriptor { ...@@ -333,7 +333,7 @@ struct uac_processing_unit_descriptor {
__u8 bDescriptorType; __u8 bDescriptorType;
__u8 bDescriptorSubtype; __u8 bDescriptorSubtype;
__u8 bUnitID; __u8 bUnitID;
__u16 wProcessType; __le16 wProcessType;
__u8 bNrInPins; __u8 bNrInPins;
__u8 baSourceID[]; __u8 baSourceID[];
} __attribute__ ((packed)); } __attribute__ ((packed));
...@@ -491,8 +491,8 @@ struct uac_format_type_ii_ext_descriptor { ...@@ -491,8 +491,8 @@ struct uac_format_type_ii_ext_descriptor {
__u8 bDescriptorType; __u8 bDescriptorType;
__u8 bDescriptorSubtype; __u8 bDescriptorSubtype;
__u8 bFormatType; __u8 bFormatType;
__u16 wMaxBitRate; __le16 wMaxBitRate;
__u16 wSamplesPerFrame; __le16 wSamplesPerFrame;
__u8 bHeaderLength; __u8 bHeaderLength;
__u8 bSideBandProtocol; __u8 bSideBandProtocol;
} __attribute__((packed)); } __attribute__((packed));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment