Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64f17667 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "wil6210: extract firmware version from file header"

parents 66455e1b 4d4fdbb9
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -1604,6 +1604,32 @@ static const struct file_operations fops_fw_capabilities = {
	.llseek		= seq_lseek,
};

/*---------FW version------------*/
static int wil_fw_version_debugfs_show(struct seq_file *s, void *data)
{
	struct wil6210_priv *wil = s->private;

	if (wil->fw_version[0])
		seq_printf(s, "%s\n", wil->fw_version);
	else
		seq_puts(s, "N/A\n");

	return 0;
}

static int wil_fw_version_seq_open(struct inode *inode, struct file *file)
{
	return single_open(file, wil_fw_version_debugfs_show,
			   inode->i_private);
}

static const struct file_operations fops_fw_version = {
	.open		= wil_fw_version_seq_open,
	.release	= single_release,
	.read		= seq_read,
	.llseek		= seq_lseek,
};

/*----------------*/
static void wil6210_debugfs_init_blobs(struct wil6210_priv *wil,
				       struct dentry *dbg)
@@ -1655,6 +1681,7 @@ static const struct {
	{"led_cfg",	S_IRUGO | S_IWUSR,	&fops_led_cfg},
	{"led_blink_time",	S_IRUGO | S_IWUSR,	&fops_led_blink_time},
	{"fw_capabilities",	S_IRUGO,	&fops_fw_capabilities},
	{"fw_version",	S_IRUGO,		&fops_fw_version},
};

static void wil6210_debugfs_init_files(struct wil6210_priv *wil,
@@ -1695,7 +1722,6 @@ static void wil6210_debugfs_init_isr(struct wil6210_priv *wil,
static const struct dbg_off dbg_wil_off[] = {
	WIL_FIELD(privacy,	S_IRUGO,		doff_u32),
	WIL_FIELD(status[0],	S_IRUGO | S_IWUSR,	doff_ulong),
	WIL_FIELD(fw_version,	S_IRUGO,		doff_u32),
	WIL_FIELD(hw_version,	S_IRUGO,		doff_x32),
	WIL_FIELD(recovery_count, S_IRUGO,		doff_u32),
	WIL_FIELD(ap_isolate,	S_IRUGO,		doff_u32),
+3 −0
Original line number Diff line number Diff line
@@ -102,6 +102,9 @@ struct wil_fw_record_verify { /* type == wil_fw_verify */
/* file header
 * First record of every file
 */
/* the FW version prefix in the comment */
#define WIL_FW_VERSION_PREFIX "FW version: "
#define WIL_FW_VERSION_PREFIX_LEN (sizeof(WIL_FW_VERSION_PREFIX) - 1)
struct wil_fw_record_file_header {
	__le32 signature ; /* Wilocity signature */
	__le32 reserved;
+7 −0
Original line number Diff line number Diff line
@@ -223,6 +223,13 @@ static int fw_handle_file_header(struct wil6210_priv *wil, const void *data,
	wil_hex_dump_fw("", DUMP_PREFIX_OFFSET, 16, 1, d->comment,
			sizeof(d->comment), true);

	if (!memcmp(d->comment, WIL_FW_VERSION_PREFIX,
		    WIL_FW_VERSION_PREFIX_LEN))
		memcpy(wil->fw_version,
		       d->comment + WIL_FW_VERSION_PREFIX_LEN,
		       min(sizeof(d->comment) - WIL_FW_VERSION_PREFIX_LEN,
			   sizeof(wil->fw_version) - 1));

	return 0;
}

+1 −0
Original line number Diff line number Diff line
@@ -889,6 +889,7 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
			 WIL_FW2_NAME);

		wil_halt_cpu(wil);
		memset(wil->fw_version, 0, sizeof(wil->fw_version));
		/* Loading f/w from the file */
		rc = wil_request_firmware(wil, WIL_FW_NAME, true);
		if (rc)
+2 −0
Original line number Diff line number Diff line
@@ -221,6 +221,8 @@ int wil_if_add(struct wil6210_priv *wil)

	wil_dbg_misc(wil, "entered");

	strlcpy(wiphy->fw_version, wil->fw_version, sizeof(wiphy->fw_version));

	rc = wiphy_register(wiphy);
	if (rc < 0) {
		wil_err(wil, "failed to register wiphy, err %d\n", rc);
Loading