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

Commit efb3116f authored by Dedy Lansky's avatar Dedy Lansky Committed by Alexei Avshalom Lazar
Browse files

wil6210: support configurable board file via sysfs



Add a sysfs allowing to override the board file containing
the RF characteristics of the 11ad device.
The new board file will be used the next time the interface
is brought up.
This change is intended to support platforms with multiple
11ad devices connected. Each 11ad device can be connected
to a different antenna module and the HW cannot automatically
detect the type of antenna connected, so the board file must
be explicitly specified for each device.

Change-Id: I40746032d9314057c64575bca96f3445816e5457
Signed-off-by: default avatarDedy Lansky <dlansky@codeaurora.org>
Signed-off-by: default avatarLior David <liord@codeaurora.org>
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
[liord@codeaurora.org: merge conflicts, checkpatch errors]
Signed-off-by: default avatarLior David <liord@codeaurora.org>
Signed-off-by: default avatarAlexei Avshalom Lazar <ailizaro@codeaurora.org>
parent 5899ce50
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -832,6 +832,7 @@ void wil_priv_deinit(struct wil6210_priv *wil)
	wmi_event_flush(wil);
	destroy_workqueue(wil->wq_service);
	destroy_workqueue(wil->wmi_wq);
	kfree(wil->board_file);
	kfree(wil->brd_info);
}

+45 −0
Original line number Diff line number Diff line
@@ -81,6 +81,50 @@ ftm_txrx_offset_store(struct device *dev,

static DEVICE_ATTR_RW(ftm_txrx_offset);

static ssize_t
board_file_show(struct device *dev,
		struct device_attribute *attr,
		char *buf)
{
	struct wil6210_priv *wil = dev_get_drvdata(dev);

	wil_get_board_file(wil, buf, PAGE_SIZE);
	strlcat(buf, "\n", PAGE_SIZE);
	return strlen(buf);
}

static ssize_t
board_file_store(struct device *dev,
		 struct device_attribute *attr,
		 const char *buf, size_t count)
{
	struct wil6210_priv *wil = dev_get_drvdata(dev);
	size_t len;

	mutex_lock(&wil->mutex);

	kfree(wil->board_file);
	wil->board_file = NULL;

	len = count;
	if (buf[count - 1] == '\n')
		len--;
	len = strnlen(buf, len);
	if (len > 0) {
		wil->board_file = kmalloc(len + 1, GFP_KERNEL);
		if (!wil->board_file) {
			mutex_unlock(&wil->mutex);
			return -ENOMEM;
		}
		strlcpy(wil->board_file, buf, len + 1);
	}
	mutex_unlock(&wil->mutex);

	return count;
}

static DEVICE_ATTR_RW(board_file);

static ssize_t
thermal_throttling_show(struct device *dev, struct device_attribute *attr,
			char *buf)
@@ -291,6 +335,7 @@ static DEVICE_ATTR_RW(snr_thresh);

static struct attribute *wil6210_sysfs_entries[] = {
	&dev_attr_ftm_txrx_offset.attr,
	&dev_attr_board_file.attr,
	&dev_attr_thermal_throttling.attr,
	&dev_attr_fst_link_loss.attr,
	&dev_attr_snr_thresh.attr,