diff options
Diffstat (limited to 'drivers/w1/w1.c')
| -rw-r--r-- | drivers/w1/w1.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 181f41cb960b..c9a7ff67d395 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
| @@ -46,11 +46,15 @@ MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); | |||
| 46 | MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol."); | 46 | MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol."); |
| 47 | 47 | ||
| 48 | static int w1_timeout = 10; | 48 | static int w1_timeout = 10; |
| 49 | static int w1_timeout_us = 0; | ||
| 49 | int w1_max_slave_count = 64; | 50 | int w1_max_slave_count = 64; |
| 50 | int w1_max_slave_ttl = 10; | 51 | int w1_max_slave_ttl = 10; |
| 51 | 52 | ||
| 52 | module_param_named(timeout, w1_timeout, int, 0); | 53 | module_param_named(timeout, w1_timeout, int, 0); |
| 53 | MODULE_PARM_DESC(timeout, "time in seconds between automatic slave searches"); | 54 | MODULE_PARM_DESC(timeout, "time in seconds between automatic slave searches"); |
| 55 | module_param_named(timeout_us, w1_timeout_us, int, 0); | ||
| 56 | MODULE_PARM_DESC(timeout, "time in microseconds between automatic slave" | ||
| 57 | " searches"); | ||
| 54 | /* A search stops when w1_max_slave_count devices have been found in that | 58 | /* A search stops when w1_max_slave_count devices have been found in that |
| 55 | * search. The next search will start over and detect the same set of devices | 59 | * search. The next search will start over and detect the same set of devices |
| 56 | * on a static 1-wire bus. Memory is not allocated based on this number, just | 60 | * on a static 1-wire bus. Memory is not allocated based on this number, just |
| @@ -317,6 +321,14 @@ static ssize_t w1_master_attribute_show_timeout(struct device *dev, struct devic | |||
| 317 | return count; | 321 | return count; |
| 318 | } | 322 | } |
| 319 | 323 | ||
| 324 | static ssize_t w1_master_attribute_show_timeout_us(struct device *dev, | ||
| 325 | struct device_attribute *attr, char *buf) | ||
| 326 | { | ||
| 327 | ssize_t count; | ||
| 328 | count = sprintf(buf, "%d\n", w1_timeout_us); | ||
| 329 | return count; | ||
| 330 | } | ||
| 331 | |||
| 320 | static ssize_t w1_master_attribute_store_max_slave_count(struct device *dev, | 332 | static ssize_t w1_master_attribute_store_max_slave_count(struct device *dev, |
| 321 | struct device_attribute *attr, const char *buf, size_t count) | 333 | struct device_attribute *attr, const char *buf, size_t count) |
| 322 | { | 334 | { |
| @@ -543,6 +555,7 @@ static W1_MASTER_ATTR_RO(slave_count, S_IRUGO); | |||
| 543 | static W1_MASTER_ATTR_RW(max_slave_count, S_IRUGO | S_IWUSR | S_IWGRP); | 555 | static W1_MASTER_ATTR_RW(max_slave_count, S_IRUGO | S_IWUSR | S_IWGRP); |
| 544 | static W1_MASTER_ATTR_RO(attempts, S_IRUGO); | 556 | static W1_MASTER_ATTR_RO(attempts, S_IRUGO); |
| 545 | static W1_MASTER_ATTR_RO(timeout, S_IRUGO); | 557 | static W1_MASTER_ATTR_RO(timeout, S_IRUGO); |
| 558 | static W1_MASTER_ATTR_RO(timeout_us, S_IRUGO); | ||
| 546 | static W1_MASTER_ATTR_RO(pointer, S_IRUGO); | 559 | static W1_MASTER_ATTR_RO(pointer, S_IRUGO); |
| 547 | static W1_MASTER_ATTR_RW(search, S_IRUGO | S_IWUSR | S_IWGRP); | 560 | static W1_MASTER_ATTR_RW(search, S_IRUGO | S_IWUSR | S_IWGRP); |
| 548 | static W1_MASTER_ATTR_RW(pullup, S_IRUGO | S_IWUSR | S_IWGRP); | 561 | static W1_MASTER_ATTR_RW(pullup, S_IRUGO | S_IWUSR | S_IWGRP); |
| @@ -556,6 +569,7 @@ static struct attribute *w1_master_default_attrs[] = { | |||
| 556 | &w1_master_attribute_max_slave_count.attr, | 569 | &w1_master_attribute_max_slave_count.attr, |
| 557 | &w1_master_attribute_attempts.attr, | 570 | &w1_master_attribute_attempts.attr, |
| 558 | &w1_master_attribute_timeout.attr, | 571 | &w1_master_attribute_timeout.attr, |
| 572 | &w1_master_attribute_timeout_us.attr, | ||
| 559 | &w1_master_attribute_pointer.attr, | 573 | &w1_master_attribute_pointer.attr, |
| 560 | &w1_master_attribute_search.attr, | 574 | &w1_master_attribute_search.attr, |
| 561 | &w1_master_attribute_pullup.attr, | 575 | &w1_master_attribute_pullup.attr, |
| @@ -1108,7 +1122,8 @@ int w1_process(void *data) | |||
| 1108 | /* As long as w1_timeout is only set by a module parameter the sleep | 1122 | /* As long as w1_timeout is only set by a module parameter the sleep |
| 1109 | * time can be calculated in jiffies once. | 1123 | * time can be calculated in jiffies once. |
| 1110 | */ | 1124 | */ |
| 1111 | const unsigned long jtime = msecs_to_jiffies(w1_timeout * 1000); | 1125 | const unsigned long jtime = |
| 1126 | usecs_to_jiffies(w1_timeout * 1000000 + w1_timeout_us); | ||
| 1112 | /* remainder if it woke up early */ | 1127 | /* remainder if it woke up early */ |
| 1113 | unsigned long jremain = 0; | 1128 | unsigned long jremain = 0; |
| 1114 | 1129 | ||
