1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * u_tcm.h 4 * 5 * Utility definitions for the tcm function 6 * 7 * Copyright (c) 2015 Samsung Electronics Co., Ltd. 8 * http://www.samsung.com 9 * 10 * Author: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx> 11 * 12 * This program is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License version 2 as 14 * published by the Free Software Foundation. 15 */ 16 17 #ifndef U_TCM_H 18 #define U_TCM_H 19 20 #include <linux/usb/composite.h> 21 22 /** 23 * @dependent: optional dependent module. Meant for legacy gadget. 24 * If non-null its refcount will be increased when a tpg is created and 25 * decreased when tpg is dropped. 26 * @dep_lock: lock for dependent module operations. 27 * @ready: true if the dependent module information is set. 28 * @can_attach: true a function can be bound to gadget 29 * @has_dep: true if there is a dependent module 30 * 31 */ 32 struct f_tcm_opts { 33 struct usb_function_instance func_inst; 34 struct module *dependent; 35 struct mutex dep_lock; 36 bool ready; 37 bool can_attach; 38 bool has_dep; 39 40 /* 41 * Callbacks to be removed when legacy tcm gadget disappears. 42 * 43 * If you use the new function registration interface 44 * programmatically, you MUST set these callbacks to 45 * something sensible (e.g. probe/remove the composite). 46 */ 47 int (*tcm_register_callback)(struct usb_function_instance *); 48 void (*tcm_unregister_callback)(struct usb_function_instance *); 49 }; 50 51 #endif /* U_TCM_H */ 52