1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __SYSFS_UPLOAD_H
3 #define __SYSFS_UPLOAD_H
4 
5 #include <linux/device.h>
6 
7 #include "sysfs.h"
8 
9 /**
10  * enum fw_upload_prog - firmware upload progress codes
11  * @FW_UPLOAD_PROG_IDLE: there is no firmware upload in progress
12  * @FW_UPLOAD_PROG_RECEIVING: worker thread is receiving firmware data
13  * @FW_UPLOAD_PROG_PREPARING: target device is preparing for firmware upload
14  * @FW_UPLOAD_PROG_TRANSFERRING: data is being copied to the device
15  * @FW_UPLOAD_PROG_PROGRAMMING: device is performing the firmware update
16  * @FW_UPLOAD_PROG_MAX: Maximum progress code marker
17  */
18 enum fw_upload_prog {
19 	FW_UPLOAD_PROG_IDLE,
20 	FW_UPLOAD_PROG_RECEIVING,
21 	FW_UPLOAD_PROG_PREPARING,
22 	FW_UPLOAD_PROG_TRANSFERRING,
23 	FW_UPLOAD_PROG_PROGRAMMING,
24 	FW_UPLOAD_PROG_MAX
25 };
26 
27 struct fw_upload_priv {
28 	struct fw_upload *fw_upload;
29 	struct module *module;
30 	const char *name;
31 	const struct fw_upload_ops *ops;
32 	struct mutex lock;		  /* protect data structure contents */
33 	struct work_struct work;
34 	const u8 *data;			  /* pointer to update data */
35 	u32 remaining_size;		  /* size remaining to transfer */
36 	enum fw_upload_prog progress;
37 	enum fw_upload_prog err_progress; /* progress at time of failure */
38 	enum fw_upload_err err_code;	  /* security manager error code */
39 };
40 
41 #endif /* __SYSFS_UPLOAD_H */
42