audio.c (4ba24fef3eb3b142197135223b90ced2f319cd53) | audio.c (c94e289f195e0e13cf34d27f9338d28221a85751) |
---|---|
1/* 2 * audio.c -- Audio gadget driver 3 * 4 * Copyright (C) 2008 Bryan Wu <cooloney@kernel.org> 5 * Copyright (C) 2008 Analog Devices, Inc 6 * 7 * Enter bugs at http://blackfin.uclinux.org/ 8 * --- 153 unchanged lines hidden (view full) --- 162 163static const struct usb_descriptor_header *otg_desc[] = { 164 (struct usb_descriptor_header *) &otg_descriptor, 165 NULL, 166}; 167 168/*-------------------------------------------------------------------------*/ 169 | 1/* 2 * audio.c -- Audio gadget driver 3 * 4 * Copyright (C) 2008 Bryan Wu <cooloney@kernel.org> 5 * Copyright (C) 2008 Analog Devices, Inc 6 * 7 * Enter bugs at http://blackfin.uclinux.org/ 8 * --- 153 unchanged lines hidden (view full) --- 162 163static const struct usb_descriptor_header *otg_desc[] = { 164 (struct usb_descriptor_header *) &otg_descriptor, 165 NULL, 166}; 167 168/*-------------------------------------------------------------------------*/ 169 |
170static int __init audio_do_config(struct usb_configuration *c) | 170static int audio_do_config(struct usb_configuration *c) |
171{ 172 int status; 173 174 /* FIXME alloc iConfiguration string, set it in c->strings */ 175 176 if (gadget_is_otg(c->cdev->gadget)) { 177 c->descriptors = otg_desc; 178 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP; --- 32 unchanged lines hidden (view full) --- 211 .label = DRIVER_DESC, 212 .bConfigurationValue = 1, 213 /* .iConfiguration = DYNAMIC */ 214 .bmAttributes = USB_CONFIG_ATT_SELFPOWER, 215}; 216 217/*-------------------------------------------------------------------------*/ 218 | 171{ 172 int status; 173 174 /* FIXME alloc iConfiguration string, set it in c->strings */ 175 176 if (gadget_is_otg(c->cdev->gadget)) { 177 c->descriptors = otg_desc; 178 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP; --- 32 unchanged lines hidden (view full) --- 211 .label = DRIVER_DESC, 212 .bConfigurationValue = 1, 213 /* .iConfiguration = DYNAMIC */ 214 .bmAttributes = USB_CONFIG_ATT_SELFPOWER, 215}; 216 217/*-------------------------------------------------------------------------*/ 218 |
219static int __init audio_bind(struct usb_composite_dev *cdev) | 219static int audio_bind(struct usb_composite_dev *cdev) |
220{ 221#ifndef CONFIG_GADGET_UAC1 222 struct f_uac2_opts *uac2_opts; 223#else 224 struct f_uac1_opts *uac1_opts; 225#endif 226 int status; 227 --- 43 unchanged lines hidden (view full) --- 271#ifndef CONFIG_GADGET_UAC1 272 usb_put_function_instance(fi_uac2); 273#else 274 usb_put_function_instance(fi_uac1); 275#endif 276 return status; 277} 278 | 220{ 221#ifndef CONFIG_GADGET_UAC1 222 struct f_uac2_opts *uac2_opts; 223#else 224 struct f_uac1_opts *uac1_opts; 225#endif 226 int status; 227 --- 43 unchanged lines hidden (view full) --- 271#ifndef CONFIG_GADGET_UAC1 272 usb_put_function_instance(fi_uac2); 273#else 274 usb_put_function_instance(fi_uac1); 275#endif 276 return status; 277} 278 |
279static int __exit audio_unbind(struct usb_composite_dev *cdev) | 279static int audio_unbind(struct usb_composite_dev *cdev) |
280{ 281#ifdef CONFIG_GADGET_UAC1 282 if (!IS_ERR_OR_NULL(f_uac1)) 283 usb_put_function(f_uac1); 284 if (!IS_ERR_OR_NULL(fi_uac1)) 285 usb_put_function_instance(fi_uac1); 286#else 287 if (!IS_ERR_OR_NULL(f_uac2)) 288 usb_put_function(f_uac2); 289 if (!IS_ERR_OR_NULL(fi_uac2)) 290 usb_put_function_instance(fi_uac2); 291#endif 292 return 0; 293} 294 | 280{ 281#ifdef CONFIG_GADGET_UAC1 282 if (!IS_ERR_OR_NULL(f_uac1)) 283 usb_put_function(f_uac1); 284 if (!IS_ERR_OR_NULL(fi_uac1)) 285 usb_put_function_instance(fi_uac1); 286#else 287 if (!IS_ERR_OR_NULL(f_uac2)) 288 usb_put_function(f_uac2); 289 if (!IS_ERR_OR_NULL(fi_uac2)) 290 usb_put_function_instance(fi_uac2); 291#endif 292 return 0; 293} 294 |
295static __refdata struct usb_composite_driver audio_driver = { | 295static struct usb_composite_driver audio_driver = { |
296 .name = "g_audio", 297 .dev = &device_desc, 298 .strings = audio_strings, 299 .max_speed = USB_SPEED_HIGH, 300 .bind = audio_bind, | 296 .name = "g_audio", 297 .dev = &device_desc, 298 .strings = audio_strings, 299 .max_speed = USB_SPEED_HIGH, 300 .bind = audio_bind, |
301 .unbind = __exit_p(audio_unbind), | 301 .unbind = audio_unbind, |
302}; 303 304module_usb_composite_driver(audio_driver); 305 306MODULE_DESCRIPTION(DRIVER_DESC); 307MODULE_AUTHOR("Bryan Wu <cooloney@kernel.org>"); 308MODULE_LICENSE("GPL"); 309 | 302}; 303 304module_usb_composite_driver(audio_driver); 305 306MODULE_DESCRIPTION(DRIVER_DESC); 307MODULE_AUTHOR("Bryan Wu <cooloney@kernel.org>"); 308MODULE_LICENSE("GPL"); 309 |