diff options
Diffstat (limited to 'drivers/w1')
-rw-r--r-- | drivers/w1/masters/ds2490.c | 21 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_therm.c | 36 | ||||
-rw-r--r-- | drivers/w1/w1.c | 10 |
3 files changed, 42 insertions, 25 deletions
diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c index b5abaae38e97..4f7e1d770f81 100644 --- a/drivers/w1/masters/ds2490.c +++ b/drivers/w1/masters/ds2490.c | |||
@@ -1002,26 +1002,7 @@ static void ds_disconnect(struct usb_interface *intf) | |||
1002 | kfree(dev); | 1002 | kfree(dev); |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | static int ds_init(void) | 1005 | module_usb_driver(ds_driver); |
1006 | { | ||
1007 | int err; | ||
1008 | |||
1009 | err = usb_register(&ds_driver); | ||
1010 | if (err) { | ||
1011 | printk(KERN_INFO "Failed to register DS9490R USB device: err=%d.\n", err); | ||
1012 | return err; | ||
1013 | } | ||
1014 | |||
1015 | return 0; | ||
1016 | } | ||
1017 | |||
1018 | static void ds_fini(void) | ||
1019 | { | ||
1020 | usb_deregister(&ds_driver); | ||
1021 | } | ||
1022 | |||
1023 | module_init(ds_init); | ||
1024 | module_exit(ds_fini); | ||
1025 | 1006 | ||
1026 | MODULE_LICENSE("GPL"); | 1007 | MODULE_LICENSE("GPL"); |
1027 | MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); | 1008 | MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); |
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c index a1ef9b5b38cf..ff29ae747ee8 100644 --- a/drivers/w1/slaves/w1_therm.c +++ b/drivers/w1/slaves/w1_therm.c | |||
@@ -175,11 +175,13 @@ static ssize_t w1_therm_read(struct device *device, | |||
175 | { | 175 | { |
176 | struct w1_slave *sl = dev_to_w1_slave(device); | 176 | struct w1_slave *sl = dev_to_w1_slave(device); |
177 | struct w1_master *dev = sl->master; | 177 | struct w1_master *dev = sl->master; |
178 | u8 rom[9], crc, verdict; | 178 | u8 rom[9], crc, verdict, external_power; |
179 | int i, max_trying = 10; | 179 | int i, max_trying = 10; |
180 | ssize_t c = PAGE_SIZE; | 180 | ssize_t c = PAGE_SIZE; |
181 | 181 | ||
182 | mutex_lock(&dev->mutex); | 182 | i = mutex_lock_interruptible(&dev->mutex); |
183 | if (i != 0) | ||
184 | return i; | ||
183 | 185 | ||
184 | memset(rom, 0, sizeof(rom)); | 186 | memset(rom, 0, sizeof(rom)); |
185 | 187 | ||
@@ -190,13 +192,37 @@ static ssize_t w1_therm_read(struct device *device, | |||
190 | if (!w1_reset_select_slave(sl)) { | 192 | if (!w1_reset_select_slave(sl)) { |
191 | int count = 0; | 193 | int count = 0; |
192 | unsigned int tm = 750; | 194 | unsigned int tm = 750; |
195 | unsigned long sleep_rem; | ||
196 | |||
197 | w1_write_8(dev, W1_READ_PSUPPLY); | ||
198 | external_power = w1_read_8(dev); | ||
199 | |||
200 | if (w1_reset_select_slave(sl)) | ||
201 | continue; | ||
193 | 202 | ||
194 | /* 750ms strong pullup (or delay) after the convert */ | 203 | /* 750ms strong pullup (or delay) after the convert */ |
195 | if (w1_strong_pullup) | 204 | if (!external_power && w1_strong_pullup) |
196 | w1_next_pullup(dev, tm); | 205 | w1_next_pullup(dev, tm); |
206 | |||
197 | w1_write_8(dev, W1_CONVERT_TEMP); | 207 | w1_write_8(dev, W1_CONVERT_TEMP); |
198 | if (!w1_strong_pullup) | 208 | |
199 | msleep(tm); | 209 | if (external_power) { |
210 | mutex_unlock(&dev->mutex); | ||
211 | |||
212 | sleep_rem = msleep_interruptible(tm); | ||
213 | if (sleep_rem != 0) | ||
214 | return -EINTR; | ||
215 | |||
216 | i = mutex_lock_interruptible(&dev->mutex); | ||
217 | if (i != 0) | ||
218 | return i; | ||
219 | } else if (!w1_strong_pullup) { | ||
220 | sleep_rem = msleep_interruptible(tm); | ||
221 | if (sleep_rem != 0) { | ||
222 | mutex_unlock(&dev->mutex); | ||
223 | return -EINTR; | ||
224 | } | ||
225 | } | ||
200 | 226 | ||
201 | if (!w1_reset_select_slave(sl)) { | 227 | if (!w1_reset_select_slave(sl)) { |
202 | 228 | ||
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index c37497823851..9761950697b4 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
@@ -892,6 +892,16 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb | |||
892 | break; | 892 | break; |
893 | } | 893 | } |
894 | 894 | ||
895 | /* Do fast search on single slave bus */ | ||
896 | if (dev->max_slave_count == 1) { | ||
897 | w1_write_8(dev, W1_READ_ROM); | ||
898 | |||
899 | if (w1_read_block(dev, (u8 *)&rn, 8) == 8 && rn) | ||
900 | cb(dev, rn); | ||
901 | |||
902 | break; | ||
903 | } | ||
904 | |||
895 | /* Start the search */ | 905 | /* Start the search */ |
896 | w1_write_8(dev, search_type); | 906 | w1_write_8(dev, search_type); |
897 | for (i = 0; i < 64; ++i) { | 907 | for (i = 0; i < 64; ++i) { |