Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Lukasz Majewski | 1d4a0b6 | 2012-08-06 14:41:05 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2012 Samsung Electronics |
| 4 | * Lukasz Majewski <l.majewski@samsung.com> |
Lukasz Majewski | 1d4a0b6 | 2012-08-06 14:41:05 +0200 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __G_DOWNLOAD_H_ |
| 8 | #define __G_DOWNLOAD_H_ |
| 9 | |
| 10 | #include <linux/usb/ch9.h> |
Lukasz Majewski | 1d4a0b6 | 2012-08-06 14:41:05 +0200 | [diff] [blame] | 11 | #include <linux/usb/gadget.h> |
Mateusz Zalega | c4d0e85 | 2014-04-28 21:13:28 +0200 | [diff] [blame] | 12 | #include <linux/usb/composite.h> |
| 13 | #include <linker_lists.h> |
| 14 | |
| 15 | /* |
| 16 | * @usb_fname: unescaped USB function name |
| 17 | * @callback_ptr: bind callback, one per function name |
| 18 | */ |
| 19 | #define DECLARE_GADGET_BIND_CALLBACK(usb_fname, callback_ptr) \ |
| 20 | ll_entry_declare(struct g_dnl_bind_callback, \ |
| 21 | __usb_function_name_##usb_fname, \ |
| 22 | g_dnl_bind_callbacks) = { \ |
| 23 | .usb_function_name = #usb_fname, \ |
| 24 | .fptr = callback_ptr \ |
| 25 | } |
| 26 | |
| 27 | typedef int (*g_dnl_bind_callback_f)(struct usb_configuration *); |
| 28 | |
| 29 | /* used in Gadget downloader callback linker list */ |
| 30 | struct g_dnl_bind_callback { |
| 31 | const char *usb_function_name; |
| 32 | g_dnl_bind_callback_f fptr; |
| 33 | }; |
| 34 | |
Lukasz Majewski | d6eae7b | 2013-10-08 14:30:41 +0200 | [diff] [blame] | 35 | int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *); |
Steve Rae | 05a950c | 2015-07-09 14:26:38 -0700 | [diff] [blame] | 36 | int g_dnl_get_board_bcd_device_number(int gcnum); |
Mateusz Zalega | 75504e9 | 2014-04-30 13:07:48 +0200 | [diff] [blame] | 37 | int g_dnl_board_usb_cable_connected(void); |
Lukasz Majewski | 1d4a0b6 | 2012-08-06 14:41:05 +0200 | [diff] [blame] | 38 | int g_dnl_register(const char *s); |
| 39 | void g_dnl_unregister(void); |
Heiko Schocher | ec9002e | 2013-11-04 14:05:01 +0100 | [diff] [blame] | 40 | void g_dnl_set_serialnumber(char *); |
Patrick Delaunay | bcd677f | 2020-03-18 09:24:46 +0100 | [diff] [blame] | 41 | void g_dnl_set_product(const char *s); |
Lukasz Majewski | 1d4a0b6 | 2012-08-06 14:41:05 +0200 | [diff] [blame] | 42 | |
Rob Herring | fe1b28c | 2014-12-10 14:43:03 -0600 | [diff] [blame] | 43 | bool g_dnl_detach(void); |
| 44 | void g_dnl_trigger_detach(void); |
| 45 | void g_dnl_clear_detach(void); |
B, Ravi | 05341a8 | 2016-07-28 17:39:15 +0530 | [diff] [blame] | 46 | int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget); |
Rob Herring | fe1b28c | 2014-12-10 14:43:03 -0600 | [diff] [blame] | 47 | |
Lukasz Majewski | 1d4a0b6 | 2012-08-06 14:41:05 +0200 | [diff] [blame] | 48 | #endif /* __G_DOWNLOAD_H_ */ |