mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 08:07:32 -04:00
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: Dedy Lansky <dlansky@codeaurora.org> Signed-off-by: Lior David <liord@codeaurora.org> Signed-off-by: Maya Erez <merez@codeaurora.org> [liord@codeaurora.org: merge conflicts, checkpatch errors] Signed-off-by: Lior David <liord@codeaurora.org> Signed-off-by: Alexei Avshalom Lazar <ailizaro@codeaurora.org>
This commit is contained in:
parent
5899ce5022
commit
efb3116f2a
2 changed files with 46 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue