hid.c (4ba24fef3eb3b142197135223b90ced2f319cd53) hid.c (c94e289f195e0e13cf34d27f9338d28221a85751)
1/*
2 * hid.c -- HID Composite driver
3 *
4 * Based on multi.c
5 *
6 * Copyright (C) 2010 Fabien Chouteau <fabien.chouteau@barco.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 92 unchanged lines hidden (view full) ---

101 &stringtab_dev,
102 NULL,
103};
104
105
106
107/****************************** Configurations ******************************/
108
1/*
2 * hid.c -- HID Composite driver
3 *
4 * Based on multi.c
5 *
6 * Copyright (C) 2010 Fabien Chouteau <fabien.chouteau@barco.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 92 unchanged lines hidden (view full) ---

101 &stringtab_dev,
102 NULL,
103};
104
105
106
107/****************************** Configurations ******************************/
108
109static int __init do_config(struct usb_configuration *c)
109static int do_config(struct usb_configuration *c)
110{
111 struct hidg_func_node *e, *n;
112 int status = 0;
113
114 if (gadget_is_otg(c->cdev->gadget)) {
115 c->descriptors = otg_desc;
116 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
117 }

--- 24 unchanged lines hidden (view full) ---

142 .label = "HID Gadget",
143 .bConfigurationValue = 1,
144 /* .iConfiguration = DYNAMIC */
145 .bmAttributes = USB_CONFIG_ATT_SELFPOWER,
146};
147
148/****************************** Gadget Bind ******************************/
149
110{
111 struct hidg_func_node *e, *n;
112 int status = 0;
113
114 if (gadget_is_otg(c->cdev->gadget)) {
115 c->descriptors = otg_desc;
116 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
117 }

--- 24 unchanged lines hidden (view full) ---

142 .label = "HID Gadget",
143 .bConfigurationValue = 1,
144 /* .iConfiguration = DYNAMIC */
145 .bmAttributes = USB_CONFIG_ATT_SELFPOWER,
146};
147
148/****************************** Gadget Bind ******************************/
149
150static int __init hid_bind(struct usb_composite_dev *cdev)
150static int hid_bind(struct usb_composite_dev *cdev)
151{
152 struct usb_gadget *gadget = cdev->gadget;
153 struct list_head *tmp;
154 struct hidg_func_node *n, *m;
155 struct f_hid_opts *hid_opts;
156 int status, funcs = 0;
157
158 list_for_each(tmp, &hidg_func_list)

--- 41 unchanged lines hidden (view full) ---

200 list_for_each_entry(m, &hidg_func_list, node) {
201 if (m == n)
202 break;
203 usb_put_function_instance(m->fi);
204 }
205 return status;
206}
207
151{
152 struct usb_gadget *gadget = cdev->gadget;
153 struct list_head *tmp;
154 struct hidg_func_node *n, *m;
155 struct f_hid_opts *hid_opts;
156 int status, funcs = 0;
157
158 list_for_each(tmp, &hidg_func_list)

--- 41 unchanged lines hidden (view full) ---

200 list_for_each_entry(m, &hidg_func_list, node) {
201 if (m == n)
202 break;
203 usb_put_function_instance(m->fi);
204 }
205 return status;
206}
207
208static int __exit hid_unbind(struct usb_composite_dev *cdev)
208static int hid_unbind(struct usb_composite_dev *cdev)
209{
210 struct hidg_func_node *n;
211
212 list_for_each_entry(n, &hidg_func_list, node) {
213 usb_put_function(n->f);
214 usb_put_function_instance(n->fi);
215 }
216 return 0;
217}
218
209{
210 struct hidg_func_node *n;
211
212 list_for_each_entry(n, &hidg_func_list, node) {
213 usb_put_function(n->f);
214 usb_put_function_instance(n->fi);
215 }
216 return 0;
217}
218
219static int __init hidg_plat_driver_probe(struct platform_device *pdev)
219static int hidg_plat_driver_probe(struct platform_device *pdev)
220{
221 struct hidg_func_descriptor *func = dev_get_platdata(&pdev->dev);
222 struct hidg_func_node *entry;
223
224 if (!func) {
225 dev_err(&pdev->dev, "Platform data missing\n");
226 return -ENODEV;
227 }

--- 19 unchanged lines hidden (view full) ---

247
248 return 0;
249}
250
251
252/****************************** Some noise ******************************/
253
254
220{
221 struct hidg_func_descriptor *func = dev_get_platdata(&pdev->dev);
222 struct hidg_func_node *entry;
223
224 if (!func) {
225 dev_err(&pdev->dev, "Platform data missing\n");
226 return -ENODEV;
227 }

--- 19 unchanged lines hidden (view full) ---

247
248 return 0;
249}
250
251
252/****************************** Some noise ******************************/
253
254
255static __refdata struct usb_composite_driver hidg_driver = {
255static struct usb_composite_driver hidg_driver = {
256 .name = "g_hid",
257 .dev = &device_desc,
258 .strings = dev_strings,
259 .max_speed = USB_SPEED_HIGH,
260 .bind = hid_bind,
256 .name = "g_hid",
257 .dev = &device_desc,
258 .strings = dev_strings,
259 .max_speed = USB_SPEED_HIGH,
260 .bind = hid_bind,
261 .unbind = __exit_p(hid_unbind),
261 .unbind = hid_unbind,
262};
263
264static struct platform_driver hidg_plat_driver = {
265 .remove = hidg_plat_driver_remove,
266 .driver = {
267 .name = "hidg",
268 },
269};

--- 29 unchanged lines hidden ---
262};
263
264static struct platform_driver hidg_plat_driver = {
265 .remove = hidg_plat_driver_remove,
266 .driver = {
267 .name = "hidg",
268 },
269};

--- 29 unchanged lines hidden ---