162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * This header declares the utility functions used by "Gadget Zero", plus
462306a36Sopenharmony_ci * interfaces to its two single-configuration function drivers.
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#ifndef __G_ZERO_H
862306a36Sopenharmony_ci#define __G_ZERO_H
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#define GZERO_BULK_BUFLEN	4096
1162306a36Sopenharmony_ci#define GZERO_QLEN		32
1262306a36Sopenharmony_ci#define GZERO_ISOC_INTERVAL	4
1362306a36Sopenharmony_ci#define GZERO_ISOC_MAXPACKET	1024
1462306a36Sopenharmony_ci#define GZERO_SS_BULK_QLEN	1
1562306a36Sopenharmony_ci#define GZERO_SS_ISO_QLEN	8
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_cistruct usb_zero_options {
1862306a36Sopenharmony_ci	unsigned pattern;
1962306a36Sopenharmony_ci	unsigned isoc_interval;
2062306a36Sopenharmony_ci	unsigned isoc_maxpacket;
2162306a36Sopenharmony_ci	unsigned isoc_mult;
2262306a36Sopenharmony_ci	unsigned isoc_maxburst;
2362306a36Sopenharmony_ci	unsigned bulk_buflen;
2462306a36Sopenharmony_ci	unsigned qlen;
2562306a36Sopenharmony_ci	unsigned ss_bulk_qlen;
2662306a36Sopenharmony_ci	unsigned ss_iso_qlen;
2762306a36Sopenharmony_ci};
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_cistruct f_ss_opts {
3062306a36Sopenharmony_ci	struct usb_function_instance func_inst;
3162306a36Sopenharmony_ci	unsigned pattern;
3262306a36Sopenharmony_ci	unsigned isoc_interval;
3362306a36Sopenharmony_ci	unsigned isoc_maxpacket;
3462306a36Sopenharmony_ci	unsigned isoc_mult;
3562306a36Sopenharmony_ci	unsigned isoc_maxburst;
3662306a36Sopenharmony_ci	unsigned bulk_buflen;
3762306a36Sopenharmony_ci	unsigned bulk_qlen;
3862306a36Sopenharmony_ci	unsigned iso_qlen;
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci	/*
4162306a36Sopenharmony_ci	 * Read/write access to configfs attributes is handled by configfs.
4262306a36Sopenharmony_ci	 *
4362306a36Sopenharmony_ci	 * This is to protect the data from concurrent access by read/write
4462306a36Sopenharmony_ci	 * and create symlink/remove symlink.
4562306a36Sopenharmony_ci	 */
4662306a36Sopenharmony_ci	struct mutex			lock;
4762306a36Sopenharmony_ci	int				refcnt;
4862306a36Sopenharmony_ci};
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_cistruct f_lb_opts {
5162306a36Sopenharmony_ci	struct usb_function_instance func_inst;
5262306a36Sopenharmony_ci	unsigned bulk_buflen;
5362306a36Sopenharmony_ci	unsigned qlen;
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci	/*
5662306a36Sopenharmony_ci	 * Read/write access to configfs attributes is handled by configfs.
5762306a36Sopenharmony_ci	 *
5862306a36Sopenharmony_ci	 * This is to protect the data from concurrent access by read/write
5962306a36Sopenharmony_ci	 * and create symlink/remove symlink.
6062306a36Sopenharmony_ci	 */
6162306a36Sopenharmony_ci	struct mutex			lock;
6262306a36Sopenharmony_ci	int				refcnt;
6362306a36Sopenharmony_ci};
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_civoid lb_modexit(void);
6662306a36Sopenharmony_ciint lb_modinit(void);
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci/* common utilities */
6962306a36Sopenharmony_civoid disable_endpoints(struct usb_composite_dev *cdev,
7062306a36Sopenharmony_ci		struct usb_ep *in, struct usb_ep *out,
7162306a36Sopenharmony_ci		struct usb_ep *iso_in, struct usb_ep *iso_out);
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci#endif /* __G_ZERO_H */
74