diff options
Diffstat (limited to 'drivers/usb/gadget/function/f_uac2.c')
-rw-r--r-- | drivers/usb/gadget/function/f_uac2.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index a5a27a504d67..33e16658e5cf 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c | |||
@@ -512,6 +512,11 @@ static int snd_uac2_remove(struct platform_device *pdev) | |||
512 | return 0; | 512 | return 0; |
513 | } | 513 | } |
514 | 514 | ||
515 | static void snd_uac2_release(struct device *dev) | ||
516 | { | ||
517 | dev_dbg(dev, "releasing '%s'\n", dev_name(dev)); | ||
518 | } | ||
519 | |||
515 | static int alsa_uac2_init(struct audio_dev *agdev) | 520 | static int alsa_uac2_init(struct audio_dev *agdev) |
516 | { | 521 | { |
517 | struct snd_uac2_chip *uac2 = &agdev->uac2; | 522 | struct snd_uac2_chip *uac2 = &agdev->uac2; |
@@ -523,6 +528,7 @@ static int alsa_uac2_init(struct audio_dev *agdev) | |||
523 | 528 | ||
524 | uac2->pdev.id = 0; | 529 | uac2->pdev.id = 0; |
525 | uac2->pdev.name = uac2_name; | 530 | uac2->pdev.name = uac2_name; |
531 | uac2->pdev.dev.release = snd_uac2_release; | ||
526 | 532 | ||
527 | /* Register snd_uac2 driver */ | 533 | /* Register snd_uac2 driver */ |
528 | err = platform_driver_register(&uac2->pdrv); | 534 | err = platform_driver_register(&uac2->pdrv); |
@@ -772,6 +778,7 @@ struct usb_endpoint_descriptor fs_epout_desc = { | |||
772 | 778 | ||
773 | .bEndpointAddress = USB_DIR_OUT, | 779 | .bEndpointAddress = USB_DIR_OUT, |
774 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | 780 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, |
781 | .wMaxPacketSize = cpu_to_le16(1023), | ||
775 | .bInterval = 1, | 782 | .bInterval = 1, |
776 | }; | 783 | }; |
777 | 784 | ||
@@ -780,6 +787,7 @@ struct usb_endpoint_descriptor hs_epout_desc = { | |||
780 | .bDescriptorType = USB_DT_ENDPOINT, | 787 | .bDescriptorType = USB_DT_ENDPOINT, |
781 | 788 | ||
782 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | 789 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, |
790 | .wMaxPacketSize = cpu_to_le16(1024), | ||
783 | .bInterval = 4, | 791 | .bInterval = 4, |
784 | }; | 792 | }; |
785 | 793 | ||
@@ -847,6 +855,7 @@ struct usb_endpoint_descriptor fs_epin_desc = { | |||
847 | 855 | ||
848 | .bEndpointAddress = USB_DIR_IN, | 856 | .bEndpointAddress = USB_DIR_IN, |
849 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | 857 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, |
858 | .wMaxPacketSize = cpu_to_le16(1023), | ||
850 | .bInterval = 1, | 859 | .bInterval = 1, |
851 | }; | 860 | }; |
852 | 861 | ||
@@ -855,6 +864,7 @@ struct usb_endpoint_descriptor hs_epin_desc = { | |||
855 | .bDescriptorType = USB_DT_ENDPOINT, | 864 | .bDescriptorType = USB_DT_ENDPOINT, |
856 | 865 | ||
857 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | 866 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, |
867 | .wMaxPacketSize = cpu_to_le16(1024), | ||
858 | .bInterval = 4, | 868 | .bInterval = 4, |
859 | }; | 869 | }; |
860 | 870 | ||
@@ -947,6 +957,9 @@ free_ep(struct uac2_rtd_params *prm, struct usb_ep *ep) | |||
947 | struct snd_uac2_chip *uac2 = prm->uac2; | 957 | struct snd_uac2_chip *uac2 = prm->uac2; |
948 | int i; | 958 | int i; |
949 | 959 | ||
960 | if (!prm->ep_enabled) | ||
961 | return; | ||
962 | |||
950 | prm->ep_enabled = false; | 963 | prm->ep_enabled = false; |
951 | 964 | ||
952 | for (i = 0; i < USB_XFERS; i++) { | 965 | for (i = 0; i < USB_XFERS; i++) { |
@@ -1071,7 +1084,7 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) | |||
1071 | prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); | 1084 | prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); |
1072 | if (!prm->rbuf) { | 1085 | if (!prm->rbuf) { |
1073 | prm->max_psize = 0; | 1086 | prm->max_psize = 0; |
1074 | goto err; | 1087 | goto err_free_descs; |
1075 | } | 1088 | } |
1076 | 1089 | ||
1077 | prm = &agdev->uac2.p_prm; | 1090 | prm = &agdev->uac2.p_prm; |
@@ -1079,17 +1092,19 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) | |||
1079 | prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); | 1092 | prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); |
1080 | if (!prm->rbuf) { | 1093 | if (!prm->rbuf) { |
1081 | prm->max_psize = 0; | 1094 | prm->max_psize = 0; |
1082 | goto err; | 1095 | goto err_free_descs; |
1083 | } | 1096 | } |
1084 | 1097 | ||
1085 | ret = alsa_uac2_init(agdev); | 1098 | ret = alsa_uac2_init(agdev); |
1086 | if (ret) | 1099 | if (ret) |
1087 | goto err; | 1100 | goto err_free_descs; |
1088 | return 0; | 1101 | return 0; |
1102 | |||
1103 | err_free_descs: | ||
1104 | usb_free_all_descriptors(fn); | ||
1089 | err: | 1105 | err: |
1090 | kfree(agdev->uac2.p_prm.rbuf); | 1106 | kfree(agdev->uac2.p_prm.rbuf); |
1091 | kfree(agdev->uac2.c_prm.rbuf); | 1107 | kfree(agdev->uac2.c_prm.rbuf); |
1092 | usb_free_all_descriptors(fn); | ||
1093 | if (agdev->in_ep) | 1108 | if (agdev->in_ep) |
1094 | agdev->in_ep->driver_data = NULL; | 1109 | agdev->in_ep->driver_data = NULL; |
1095 | if (agdev->out_ep) | 1110 | if (agdev->out_ep) |