197730bbbSRuss Weight /* SPDX-License-Identifier: GPL-2.0 */ 2*f8ae07f4SRuss Weight #ifndef __SYSFS_UPLOAD_H 3*f8ae07f4SRuss Weight #define __SYSFS_UPLOAD_H 497730bbbSRuss Weight 597730bbbSRuss Weight #include <linux/device.h> 697730bbbSRuss Weight 7*f8ae07f4SRuss Weight #include "sysfs.h" 8*f8ae07f4SRuss Weight 997730bbbSRuss Weight /** 1097730bbbSRuss Weight * enum fw_upload_prog - firmware upload progress codes 1197730bbbSRuss Weight * @FW_UPLOAD_PROG_IDLE: there is no firmware upload in progress 1297730bbbSRuss Weight * @FW_UPLOAD_PROG_RECEIVING: worker thread is receiving firmware data 1397730bbbSRuss Weight * @FW_UPLOAD_PROG_PREPARING: target device is preparing for firmware upload 1497730bbbSRuss Weight * @FW_UPLOAD_PROG_TRANSFERRING: data is being copied to the device 1597730bbbSRuss Weight * @FW_UPLOAD_PROG_PROGRAMMING: device is performing the firmware update 1697730bbbSRuss Weight * @FW_UPLOAD_PROG_MAX: Maximum progress code marker 1797730bbbSRuss Weight */ 1897730bbbSRuss Weight enum fw_upload_prog { 1997730bbbSRuss Weight FW_UPLOAD_PROG_IDLE, 2097730bbbSRuss Weight FW_UPLOAD_PROG_RECEIVING, 2197730bbbSRuss Weight FW_UPLOAD_PROG_PREPARING, 2297730bbbSRuss Weight FW_UPLOAD_PROG_TRANSFERRING, 2397730bbbSRuss Weight FW_UPLOAD_PROG_PROGRAMMING, 2497730bbbSRuss Weight FW_UPLOAD_PROG_MAX 2597730bbbSRuss Weight }; 2697730bbbSRuss Weight 2797730bbbSRuss Weight struct fw_upload_priv { 2897730bbbSRuss Weight struct fw_upload *fw_upload; 2997730bbbSRuss Weight struct module *module; 3097730bbbSRuss Weight const char *name; 3197730bbbSRuss Weight const struct fw_upload_ops *ops; 3297730bbbSRuss Weight struct mutex lock; /* protect data structure contents */ 3397730bbbSRuss Weight struct work_struct work; 3497730bbbSRuss Weight const u8 *data; /* pointer to update data */ 3597730bbbSRuss Weight u32 remaining_size; /* size remaining to transfer */ 3697730bbbSRuss Weight enum fw_upload_prog progress; 3797730bbbSRuss Weight enum fw_upload_prog err_progress; /* progress at time of failure */ 3897730bbbSRuss Weight enum fw_upload_err err_code; /* security manager error code */ 3997730bbbSRuss Weight }; 4097730bbbSRuss Weight 41*f8ae07f4SRuss Weight #endif /* __SYSFS_UPLOAD_H */ 42