Lines Matching defs:config
298 * @config: the configuration
310 int usb_add_function(struct usb_configuration *config,
315 DBG(config->cdev, "adding '%s'/%p to config '%s'/%p\n",
317 config->label, config);
322 function->config = config;
323 list_add_tail(&function->list, &config->functions);
333 value = function->bind(config, function);
336 function->config = NULL;
346 if (!config->fullspeed && function->fs_descriptors)
347 config->fullspeed = true;
348 if (!config->highspeed && function->hs_descriptors)
349 config->highspeed = true;
350 if (!config->superspeed && function->ss_descriptors)
351 config->superspeed = true;
352 if (!config->superspeed_plus && function->ssp_descriptors)
353 config->superspeed_plus = true;
357 DBG(config->cdev, "adding '%s'/%p --> %d\n",
399 struct usb_composite_dev *cdev = function->config->cdev;
430 struct usb_composite_dev *cdev = function->config->cdev;
454 * @config: configuration associated with the interface
475 int usb_interface_id(struct usb_configuration *config,
478 unsigned id = config->next_interface_id;
481 config->interface[id] = function;
482 config->next_interface_id = id + 1;
505 struct usb_gadget *gadget = func->config->cdev->gadget;
512 ERROR(func->config->cdev, "not armed for func remote wakeup\n");
517 if (func->config->interface[id] == func)
521 ERROR(func->config->cdev, "Invalid function\n");
556 WARN(c->cdev, "Clearing wakeup bit for config c.%d\n",
563 static int config_buf(struct usb_configuration *config,
573 /* write the config descriptor */
578 c->bNumInterfaces = config->next_interface_id;
579 c->bConfigurationValue = config->bConfigurationValue;
580 c->iConfiguration = config->iConfiguration;
581 c->bmAttributes = USB_CONFIG_ATT_ONE | config->bmAttributes;
582 c->bMaxPower = encode_bMaxPower(speed, config);
585 if (config->descriptors) {
587 config->descriptors);
595 list_for_each_entry(f, &config->functions, list) {
635 /* This is a lookup by config *INDEX* */
646 /* skip OS Descriptors config which is handled separately */
932 DBG(cdev, "reset config\n");
934 list_for_each_entry(f, &cdev->config->functions, list) {
943 cdev->config = NULL;
965 if (cdev->config)
973 } else { /* Zero configuration value - need to reset the config */
974 if (cdev->config)
979 DBG(cdev, "%s config #%d: %s\n",
987 cdev->config = c;
1065 struct usb_configuration *config)
1069 if (!config->bConfigurationValue)
1074 if (c->bConfigurationValue == config->bConfigurationValue)
1078 config->cdev = cdev;
1079 list_add_tail(&config->list, &cdev->configs);
1081 INIT_LIST_HEAD(&config->functions);
1082 config->next_interface_id = 0;
1083 memset(config->interface, 0, sizeof(config->interface));
1092 * @config: the configuration, with bConfigurationValue assigned
1105 struct usb_configuration *config,
1113 DBG(cdev, "adding config #%u '%s'/%p\n",
1114 config->bConfigurationValue,
1115 config->label, config);
1117 status = usb_add_config_only(cdev, config);
1121 status = bind(config);
1127 while (!list_empty(&config->functions)) {
1130 f = list_first_entry(&config->functions,
1136 f->unbind(config, f);
1140 list_del(&config->list);
1141 config->cdev = NULL;
1146 config->bConfigurationValue, config,
1147 config->superspeed_plus ? " superplus" : "",
1148 config->superspeed ? " super" : "",
1149 config->highspeed ? " high" : "",
1150 config->fullspeed
1157 struct usb_function *f = config->interface[i];
1171 DBG(cdev, "added config '%s'/%u --> %d\n", config->label,
1172 config->bConfigurationValue, status);
1178 struct usb_configuration *config)
1180 while (!list_empty(&config->functions)) {
1183 f = list_first_entry(&config->functions,
1186 usb_remove_function(config, f);
1188 list_del(&config->list);
1189 if (config->unbind) {
1190 DBG(cdev, "unbind config '%s'/%p\n", config->label, config);
1191 config->unbind(config);
1199 * @config: the configuration
1203 * try to enumerate the device while we are changing the config list.
1206 struct usb_configuration *config)
1212 if (cdev->config == config)
1217 remove_config(cdev, config);
1774 * the work is in config and function specific setup.
1883 struct usb_configuration *config;
1886 if (cdev->config)
1887 config = cdev->config;
1889 config = list_first_entry(
1892 if (!config)
1904 memcpy(req->buf, config->descriptors[0], value);
1929 if (cdev->config)
1930 *(u8 *)req->buf = cdev->config->bConfigurationValue;
1940 if (!cdev->config || intf >= MAX_CONFIG_INTERFACES)
1942 f = cdev->config->interface[intf];
1969 if (!cdev->config || intf >= MAX_CONFIG_INTERFACES)
1971 f = cdev->config->interface[intf];
2005 if (!cdev->config || intf >= MAX_CONFIG_INTERFACES)
2007 f = cdev->config->interface[intf];
2017 if (f->config->bmAttributes & USB_CONFIG_ATT_WAKEUP) {
2039 if (!cdev->config || intf >= MAX_CONFIG_INTERFACES)
2041 f = cdev->config->interface[intf];
2049 if (!(f->config->bmAttributes &
2212 if (cdev->config) {
2213 list_for_each_entry(f, &cdev->config->functions, list)
2229 if (!cdev->config || intf >= MAX_CONFIG_INTERFACES)
2231 f = cdev->config->interface[intf];
2235 if (!cdev->config)
2238 list_for_each_entry(iter, &cdev->config->functions, list) {
2252 c = cdev->config;
2256 /* try current config's setup */
2262 /* try the only function in the current config */
2302 /* REVISIT: should we have config and device level
2307 if (cdev->config)
2354 WARN_ON(cdev->config);
2591 /* REVISIT: should we have config level
2595 if (cdev->config) {
2596 list_for_each_entry(f, &cdev->config->functions, list) {
2616 /* REVISIT: should we have config level
2622 if (cdev->config) {
2623 list_for_each_entry(f, &cdev->config->functions, list) {
2633 maxpower = cdev->config->MaxPower ?
2634 cdev->config->MaxPower : CONFIG_USB_GADGET_VBUS_DRAW;