diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2014-07-22 13:58:40 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-08-20 15:05:05 -0400 |
commit | 605ef833f0c6f9e609e27ff1582a14a4dbc7d341 (patch) | |
tree | 53021edc3e34f99635acb0119ba14aad0539eb98 | |
parent | 0d992dec967d6edc97b3001598db7c4ac4e4b3c1 (diff) |
usb: gadget: f_uac1: remove compatibility layer
There are no users of the old interface left, so it can be removed.
Tested-by: Sebastian Reimers <sebastian.reimers@googlemail.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/gadget/function/f_uac1.c | 102 | ||||
-rw-r--r-- | drivers/usb/gadget/function/u_uac1.c | 33 | ||||
-rw-r--r-- | drivers/usb/gadget/function/u_uac1.h | 4 |
3 files changed, 1 insertions, 138 deletions
diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c index 787ed2bc4dd4..e0399d2aa818 100644 --- a/drivers/usb/gadget/function/f_uac1.c +++ b/drivers/usb/gadget/function/f_uac1.c | |||
@@ -16,24 +16,8 @@ | |||
16 | #include <linux/atomic.h> | 16 | #include <linux/atomic.h> |
17 | 17 | ||
18 | #include "u_uac1.h" | 18 | #include "u_uac1.h" |
19 | #ifdef USBF_UAC1_INCLUDED | ||
20 | #include "u_uac1.c" | ||
21 | #endif | ||
22 | 19 | ||
23 | #define OUT_EP_MAX_PACKET_SIZE 200 | 20 | #define OUT_EP_MAX_PACKET_SIZE 200 |
24 | #ifdef USBF_UAC1_INCLUDED | ||
25 | static int req_buf_size = OUT_EP_MAX_PACKET_SIZE; | ||
26 | module_param(req_buf_size, int, S_IRUGO); | ||
27 | MODULE_PARM_DESC(req_buf_size, "ISO OUT endpoint request buffer size"); | ||
28 | |||
29 | static int req_count = 256; | ||
30 | module_param(req_count, int, S_IRUGO); | ||
31 | MODULE_PARM_DESC(req_count, "ISO OUT endpoint request count"); | ||
32 | |||
33 | static int audio_buf_size = 48000; | ||
34 | module_param(audio_buf_size, int, S_IRUGO); | ||
35 | MODULE_PARM_DESC(audio_buf_size, "Audio buffer size"); | ||
36 | #endif | ||
37 | 21 | ||
38 | static int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value); | 22 | static int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value); |
39 | static int generic_get_cmd(struct usb_audio_control *con, u8 cmd); | 23 | static int generic_get_cmd(struct usb_audio_control *con, u8 cmd); |
@@ -337,17 +321,14 @@ static int f_audio_out_ep_complete(struct usb_ep *ep, struct usb_request *req) | |||
337 | struct f_audio *audio = req->context; | 321 | struct f_audio *audio = req->context; |
338 | struct usb_composite_dev *cdev = audio->card.func.config->cdev; | 322 | struct usb_composite_dev *cdev = audio->card.func.config->cdev; |
339 | struct f_audio_buf *copy_buf = audio->copy_buf; | 323 | struct f_audio_buf *copy_buf = audio->copy_buf; |
340 | #ifndef USBF_UAC1_INCLUDED | ||
341 | struct f_uac1_opts *opts; | 324 | struct f_uac1_opts *opts; |
342 | int audio_buf_size; | 325 | int audio_buf_size; |
343 | #endif | ||
344 | int err; | 326 | int err; |
345 | 327 | ||
346 | #ifndef USBF_UAC1_INCLUDED | ||
347 | opts = container_of(audio->card.func.fi, struct f_uac1_opts, | 328 | opts = container_of(audio->card.func.fi, struct f_uac1_opts, |
348 | func_inst); | 329 | func_inst); |
349 | audio_buf_size = opts->audio_buf_size; | 330 | audio_buf_size = opts->audio_buf_size; |
350 | #endif | 331 | |
351 | if (!copy_buf) | 332 | if (!copy_buf) |
352 | return -EINVAL; | 333 | return -EINVAL; |
353 | 334 | ||
@@ -592,21 +573,17 @@ static int f_audio_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | |||
592 | struct usb_composite_dev *cdev = f->config->cdev; | 573 | struct usb_composite_dev *cdev = f->config->cdev; |
593 | struct usb_ep *out_ep = audio->out_ep; | 574 | struct usb_ep *out_ep = audio->out_ep; |
594 | struct usb_request *req; | 575 | struct usb_request *req; |
595 | #ifndef USBF_UAC1_INCLUDED | ||
596 | struct f_uac1_opts *opts; | 576 | struct f_uac1_opts *opts; |
597 | int req_buf_size, req_count, audio_buf_size; | 577 | int req_buf_size, req_count, audio_buf_size; |
598 | #endif | ||
599 | int i = 0, err = 0; | 578 | int i = 0, err = 0; |
600 | 579 | ||
601 | DBG(cdev, "intf %d, alt %d\n", intf, alt); | 580 | DBG(cdev, "intf %d, alt %d\n", intf, alt); |
602 | 581 | ||
603 | #ifndef USBF_UAC1_INCLUDED | ||
604 | opts = container_of(f->fi, struct f_uac1_opts, func_inst); | 582 | opts = container_of(f->fi, struct f_uac1_opts, func_inst); |
605 | req_buf_size = opts->req_buf_size; | 583 | req_buf_size = opts->req_buf_size; |
606 | req_count = opts->req_count; | 584 | req_count = opts->req_count; |
607 | audio_buf_size = opts->audio_buf_size; | 585 | audio_buf_size = opts->audio_buf_size; |
608 | 586 | ||
609 | #endif | ||
610 | if (intf == 1) { | 587 | if (intf == 1) { |
611 | if (alt == 1) { | 588 | if (alt == 1) { |
612 | usb_ep_enable(out_ep); | 589 | usb_ep_enable(out_ep); |
@@ -689,7 +666,6 @@ f_audio_bind(struct usb_configuration *c, struct usb_function *f) | |||
689 | struct f_audio *audio = func_to_audio(f); | 666 | struct f_audio *audio = func_to_audio(f); |
690 | int status; | 667 | int status; |
691 | struct usb_ep *ep = NULL; | 668 | struct usb_ep *ep = NULL; |
692 | #ifndef USBF_UAC1_INCLUDED | ||
693 | struct f_uac1_opts *audio_opts; | 669 | struct f_uac1_opts *audio_opts; |
694 | 670 | ||
695 | audio_opts = container_of(f->fi, struct f_uac1_opts, func_inst); | 671 | audio_opts = container_of(f->fi, struct f_uac1_opts, func_inst); |
@@ -702,17 +678,10 @@ f_audio_bind(struct usb_configuration *c, struct usb_function *f) | |||
702 | return status; | 678 | return status; |
703 | audio_opts->bound = true; | 679 | audio_opts->bound = true; |
704 | } | 680 | } |
705 | #else | ||
706 | audio->card.gadget = c->cdev->gadget; | ||
707 | #endif | ||
708 | if (strings_uac1[0].id == 0) { | 681 | if (strings_uac1[0].id == 0) { |
709 | status = usb_string_ids_tab(c->cdev, strings_uac1); | 682 | status = usb_string_ids_tab(c->cdev, strings_uac1); |
710 | if (status < 0) | 683 | if (status < 0) |
711 | #ifdef USBF_UAC1_INCLUDED | ||
712 | return status; | ||
713 | #else | ||
714 | goto fail; | 684 | goto fail; |
715 | #endif | ||
716 | ac_interface_desc.iInterface = strings_uac1[STR_AC_IF].id; | 685 | ac_interface_desc.iInterface = strings_uac1[STR_AC_IF].id; |
717 | input_terminal_desc.iTerminal = | 686 | input_terminal_desc.iTerminal = |
718 | strings_uac1[STR_INPUT_TERMINAL].id; | 687 | strings_uac1[STR_INPUT_TERMINAL].id; |
@@ -760,25 +729,12 @@ f_audio_bind(struct usb_configuration *c, struct usb_function *f) | |||
760 | return 0; | 729 | return 0; |
761 | 730 | ||
762 | fail: | 731 | fail: |
763 | #ifndef USBF_UAC1_INCLUDED | ||
764 | gaudio_cleanup(&audio->card); | 732 | gaudio_cleanup(&audio->card); |
765 | #endif | ||
766 | if (ep) | 733 | if (ep) |
767 | ep->driver_data = NULL; | 734 | ep->driver_data = NULL; |
768 | return status; | 735 | return status; |
769 | } | 736 | } |
770 | 737 | ||
771 | #ifdef USBF_UAC1_INCLUDED | ||
772 | static void | ||
773 | old_f_audio_unbind(struct usb_configuration *c, struct usb_function *f) | ||
774 | { | ||
775 | struct f_audio *audio = func_to_audio(f); | ||
776 | |||
777 | usb_free_all_descriptors(f); | ||
778 | kfree(audio); | ||
779 | } | ||
780 | #endif | ||
781 | |||
782 | /*-------------------------------------------------------------------------*/ | 738 | /*-------------------------------------------------------------------------*/ |
783 | 739 | ||
784 | static int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value) | 740 | static int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value) |
@@ -811,61 +767,6 @@ static int control_selector_init(struct f_audio *audio) | |||
811 | return 0; | 767 | return 0; |
812 | } | 768 | } |
813 | 769 | ||
814 | #ifdef USBF_UAC1_INCLUDED | ||
815 | /** | ||
816 | * audio_bind_config - add USB audio function to a configuration | ||
817 | * @c: the configuration to supcard the USB audio function | ||
818 | * Context: single threaded during gadget setup | ||
819 | * | ||
820 | * Returns zero on success, else negative errno. | ||
821 | */ | ||
822 | static int __init audio_bind_config(struct usb_configuration *c) | ||
823 | { | ||
824 | struct f_audio *audio; | ||
825 | int status; | ||
826 | |||
827 | /* allocate and initialize one new instance */ | ||
828 | audio = kzalloc(sizeof *audio, GFP_KERNEL); | ||
829 | if (!audio) | ||
830 | return -ENOMEM; | ||
831 | |||
832 | audio->card.func.name = "g_audio"; | ||
833 | audio->card.gadget = c->cdev->gadget; | ||
834 | |||
835 | INIT_LIST_HEAD(&audio->play_queue); | ||
836 | spin_lock_init(&audio->lock); | ||
837 | |||
838 | /* set up ASLA audio devices */ | ||
839 | status = gaudio_setup(&audio->card); | ||
840 | if (status < 0) | ||
841 | goto setup_fail; | ||
842 | audio->card.func.strings = uac1_strings; | ||
843 | audio->card.func.bind = f_audio_bind; | ||
844 | audio->card.func.unbind = old_f_audio_unbind; | ||
845 | audio->card.func.set_alt = f_audio_set_alt; | ||
846 | audio->card.func.setup = f_audio_setup; | ||
847 | audio->card.func.disable = f_audio_disable; | ||
848 | |||
849 | control_selector_init(audio); | ||
850 | |||
851 | INIT_WORK(&audio->playback_work, f_audio_playback_work); | ||
852 | |||
853 | status = usb_add_function(c, &audio->card.func); | ||
854 | if (status) | ||
855 | goto add_fail; | ||
856 | |||
857 | INFO(c->cdev, "audio_buf_size %d, req_buf_size %d, req_count %d\n", | ||
858 | audio_buf_size, req_buf_size, req_count); | ||
859 | |||
860 | return status; | ||
861 | |||
862 | add_fail: | ||
863 | gaudio_cleanup(); | ||
864 | setup_fail: | ||
865 | kfree(audio); | ||
866 | return status; | ||
867 | } | ||
868 | #else | ||
869 | static void f_audio_free_inst(struct usb_function_instance *f) | 770 | static void f_audio_free_inst(struct usb_function_instance *f) |
870 | { | 771 | { |
871 | struct f_uac1_opts *opts; | 772 | struct f_uac1_opts *opts; |
@@ -932,4 +833,3 @@ static struct usb_function *f_audio_alloc(struct usb_function_instance *fi) | |||
932 | DECLARE_USB_FUNCTION_INIT(uac1, f_audio_alloc_inst, f_audio_alloc); | 833 | DECLARE_USB_FUNCTION_INIT(uac1, f_audio_alloc_inst, f_audio_alloc); |
933 | MODULE_LICENSE("GPL"); | 834 | MODULE_LICENSE("GPL"); |
934 | MODULE_AUTHOR("Bryan Wu"); | 835 | MODULE_AUTHOR("Bryan Wu"); |
935 | #endif | ||
diff --git a/drivers/usb/gadget/function/u_uac1.c b/drivers/usb/gadget/function/u_uac1.c index 9a55e5cf4cd8..a44a07f30281 100644 --- a/drivers/usb/gadget/function/u_uac1.c +++ b/drivers/usb/gadget/function/u_uac1.c | |||
@@ -24,23 +24,6 @@ | |||
24 | * This component encapsulates the ALSA devices for USB audio gadget | 24 | * This component encapsulates the ALSA devices for USB audio gadget |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifdef USBF_UAC1_INCLUDED | ||
28 | #define FILE_PCM_PLAYBACK "/dev/snd/pcmC0D0p" | ||
29 | #define FILE_PCM_CAPTURE "/dev/snd/pcmC0D0c" | ||
30 | #define FILE_CONTROL "/dev/snd/controlC0" | ||
31 | |||
32 | static char *fn_play = FILE_PCM_PLAYBACK; | ||
33 | module_param(fn_play, charp, S_IRUGO); | ||
34 | MODULE_PARM_DESC(fn_play, "Playback PCM device file name"); | ||
35 | |||
36 | static char *fn_cap = FILE_PCM_CAPTURE; | ||
37 | module_param(fn_cap, charp, S_IRUGO); | ||
38 | MODULE_PARM_DESC(fn_cap, "Capture PCM device file name"); | ||
39 | |||
40 | static char *fn_cntl = FILE_CONTROL; | ||
41 | module_param(fn_cntl, charp, S_IRUGO); | ||
42 | MODULE_PARM_DESC(fn_cntl, "Control device file name"); | ||
43 | #endif | ||
44 | /*-------------------------------------------------------------------------*/ | 27 | /*-------------------------------------------------------------------------*/ |
45 | 28 | ||
46 | /** | 29 | /** |
@@ -222,7 +205,6 @@ static int gaudio_open_snd_dev(struct gaudio *card) | |||
222 | { | 205 | { |
223 | struct snd_pcm_file *pcm_file; | 206 | struct snd_pcm_file *pcm_file; |
224 | struct gaudio_snd_dev *snd; | 207 | struct gaudio_snd_dev *snd; |
225 | #ifndef USBF_UAC1_INCLUDED | ||
226 | struct f_uac1_opts *opts; | 208 | struct f_uac1_opts *opts; |
227 | char *fn_play, *fn_cap, *fn_cntl; | 209 | char *fn_play, *fn_cap, *fn_cntl; |
228 | 210 | ||
@@ -230,7 +212,6 @@ static int gaudio_open_snd_dev(struct gaudio *card) | |||
230 | fn_play = opts->fn_play; | 212 | fn_play = opts->fn_play; |
231 | fn_cap = opts->fn_cap; | 213 | fn_cap = opts->fn_cap; |
232 | fn_cntl = opts->fn_cntl; | 214 | fn_cntl = opts->fn_cntl; |
233 | #endif | ||
234 | 215 | ||
235 | if (!card) | 216 | if (!card) |
236 | return -ENODEV; | 217 | return -ENODEV; |
@@ -304,9 +285,6 @@ static int gaudio_close_snd_dev(struct gaudio *gau) | |||
304 | return 0; | 285 | return 0; |
305 | } | 286 | } |
306 | 287 | ||
307 | #ifdef USBF_UAC1_INCLUDED | ||
308 | static struct gaudio *the_card; | ||
309 | #endif | ||
310 | /** | 288 | /** |
311 | * gaudio_setup - setup ALSA interface and preparing for USB transfer | 289 | * gaudio_setup - setup ALSA interface and preparing for USB transfer |
312 | * | 290 | * |
@@ -321,10 +299,6 @@ int gaudio_setup(struct gaudio *card) | |||
321 | ret = gaudio_open_snd_dev(card); | 299 | ret = gaudio_open_snd_dev(card); |
322 | if (ret) | 300 | if (ret) |
323 | ERROR(card, "we need at least one control device\n"); | 301 | ERROR(card, "we need at least one control device\n"); |
324 | #ifdef USBF_UAC1_INCLUDED | ||
325 | else if (!the_card) | ||
326 | the_card = card; | ||
327 | #endif | ||
328 | 302 | ||
329 | return ret; | 303 | return ret; |
330 | 304 | ||
@@ -335,17 +309,10 @@ int gaudio_setup(struct gaudio *card) | |||
335 | * | 309 | * |
336 | * This is called to free all resources allocated by @gaudio_setup(). | 310 | * This is called to free all resources allocated by @gaudio_setup(). |
337 | */ | 311 | */ |
338 | #ifdef USBF_UAC1_INCLUDED | ||
339 | void gaudio_cleanup(void) | ||
340 | #else | ||
341 | void gaudio_cleanup(struct gaudio *the_card) | 312 | void gaudio_cleanup(struct gaudio *the_card) |
342 | #endif | ||
343 | { | 313 | { |
344 | if (the_card) { | 314 | if (the_card) { |
345 | gaudio_close_snd_dev(the_card); | 315 | gaudio_close_snd_dev(the_card); |
346 | #ifdef USBF_UAC1_INCLUDED | ||
347 | the_card = NULL; | ||
348 | #endif | ||
349 | } | 316 | } |
350 | } | 317 | } |
351 | 318 | ||
diff --git a/drivers/usb/gadget/function/u_uac1.h b/drivers/usb/gadget/function/u_uac1.h index 5b4fe9efb8f1..8507c27020c9 100644 --- a/drivers/usb/gadget/function/u_uac1.h +++ b/drivers/usb/gadget/function/u_uac1.h | |||
@@ -63,11 +63,7 @@ struct f_uac1_opts { | |||
63 | }; | 63 | }; |
64 | 64 | ||
65 | int gaudio_setup(struct gaudio *card); | 65 | int gaudio_setup(struct gaudio *card); |
66 | #ifdef USBF_UAC1_INCLUDED | ||
67 | void gaudio_cleanup(void); | ||
68 | #else | ||
69 | void gaudio_cleanup(struct gaudio *the_card); | 66 | void gaudio_cleanup(struct gaudio *the_card); |
70 | #endif | ||
71 | 67 | ||
72 | size_t u_audio_playback(struct gaudio *card, void *buf, size_t count); | 68 | size_t u_audio_playback(struct gaudio *card, void *buf, size_t count); |
73 | int u_audio_get_playback_channels(struct gaudio *card); | 69 | int u_audio_get_playback_channels(struct gaudio *card); |