diff options
author | Thomas Pugliese <thomas.pugliese@gmail.com> | 2013-06-18 22:31:25 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-25 03:19:02 +0400 |
commit | 8bf1d0712d54bcb7c55b3f03b2c1a2f6fdfa6536 (patch) | |
tree | 370fa341719d56b704138f66e5bcc34f039aeede /drivers/usb/wusbcore/wusbhc.c | |
parent | 8e22978c57087aac4d88693278db1cc3e94f1253 (diff) | |
download | linux-8bf1d0712d54bcb7c55b3f03b2c1a2f6fdfa6536.tar.xz |
wusbcore: add sysfs attribute for DNTS count and interval
This patch adds a sysfs attribute for the wireless USB host controller
device notification transmit slot(DNTS) count and interval. It also
changes the defaults from 16 slots in every MMC to a more reasonable 4
slots every 2ms.
Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/wusbcore/wusbhc.c')
-rw-r--r-- | drivers/usb/wusbcore/wusbhc.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/usb/wusbcore/wusbhc.c b/drivers/usb/wusbcore/wusbhc.c index c35ee4394810..8759aa66da28 100644 --- a/drivers/usb/wusbcore/wusbhc.c +++ b/drivers/usb/wusbcore/wusbhc.c @@ -175,11 +175,42 @@ static ssize_t wusb_phy_rate_store(struct device *dev, } static DEVICE_ATTR(wusb_phy_rate, 0644, wusb_phy_rate_show, wusb_phy_rate_store); +static ssize_t wusb_dnts_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev); + + return sprintf(buf, "num slots: %d\ninterval: %dms\n", + wusbhc->dnts_num_slots, wusbhc->dnts_interval); +} + +static ssize_t wusb_dnts_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t size) +{ + struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev); + uint8_t num_slots, interval; + ssize_t result; + + result = sscanf(buf, "%hhu %hhu", &num_slots, &interval); + + if (result != 2) + return -EINVAL; + + wusbhc->dnts_num_slots = num_slots; + wusbhc->dnts_interval = interval; + + return size; +} +static DEVICE_ATTR(wusb_dnts, 0644, wusb_dnts_show, wusb_dnts_store); + /* Group all the WUSBHC attributes */ static struct attribute *wusbhc_attrs[] = { &dev_attr_wusb_trust_timeout.attr, &dev_attr_wusb_chid.attr, &dev_attr_wusb_phy_rate.attr, + &dev_attr_wusb_dnts.attr, NULL, }; @@ -205,8 +236,11 @@ int wusbhc_create(struct wusbhc *wusbhc) { int result = 0; + /* set defaults. These can be overwritten using sysfs attributes. */ wusbhc->trust_timeout = WUSB_TRUST_TIMEOUT_MS; wusbhc->phy_rate = UWB_PHY_RATE_INVALID - 1; + wusbhc->dnts_num_slots = 4; + wusbhc->dnts_interval = 2; mutex_init(&wusbhc->mutex); result = wusbhc_mmcie_create(wusbhc); |