Skip to content

Commit ebc4768

Browse files
iankagregkh
authored andcommitted
add w1_ds28e17 driver for the DS28E17 Onewire to I2C master bridge
This subpatch adds a driver for the DS28E17 Onewire to I2C master bridge. Signed-off-by: Jan Kandziora <jjj@gmx.de> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent eb8470d commit ebc4768

6 files changed

Lines changed: 878 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
What: /sys/bus/w1/devices/19-<id>/speed
2+
Date: Sep 2017
3+
KernelVersion: 4.14
4+
Contact: Jan Kandziora <jjj@gmx.de>
5+
Description: When written, this file sets the I2C speed on the connected
6+
DS28E17 chip. When read, it reads the current setting from
7+
the DS28E17 chip.
8+
Valid values: 100, 400, 900 [kBaud].
9+
Default 100, can be set by w1_ds28e17.speed= module parameter.
10+
Users: w1_ds28e17 driver
11+
12+
What: /sys/bus/w1/devices/19-<id>/stretch
13+
Date: Sep 2017
14+
KernelVersion: 4.14
15+
Contact: Jan Kandziora <jjj@gmx.de>
16+
Description: When written, this file sets the multiplier used to calculate
17+
the busy timeout for I2C operations on the connected DS28E17
18+
chip. When read, returns the current setting.
19+
Valid values: 1 to 9.
20+
Default 1, can be set by w1_ds28e17.stretch= module parameter.
21+
Users: w1_ds28e17 driver

‎Documentation/w1/slaves/00-INDEX‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ w1_ds2438
1010
- The Maxim/Dallas Semiconductor ds2438 smart battery monitor.
1111
w1_ds28e04
1212
- The Maxim/Dallas Semiconductor ds28e04 eeprom.
13+
w1_ds28e17
14+
- The Maxim/Dallas Semiconductor ds28e17 1-Wire-to-I2C Master Bridge.

‎Documentation/w1/slaves/w1_ds28e17‎

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
Kernel driver w1_ds28e17
2+
========================
3+
4+
Supported chips:
5+
* Maxim DS28E17 1-Wire-to-I2C Master Bridge
6+
7+
supported family codes:
8+
W1_FAMILY_DS28E17 0x19
9+
10+
Author: Jan Kandziora <jjj@gmx.de>
11+
12+
13+
Description
14+
-----------
15+
The DS28E17 is a Onewire slave device which acts as an I2C bus master.
16+
17+
This driver creates a new I2C bus for any DS28E17 device detected. I2C buses
18+
come and go as the DS28E17 devices come and go. I2C slave devices connected to
19+
a DS28E17 can be accessed by the kernel or userspace tools as if they were
20+
connected to a "native" I2C bus master.
21+
22+
23+
An udev rule like the following
24+
-------------------------------------------------------------------------------
25+
SUBSYSTEM=="i2c-dev", KERNEL=="i2c-[0-9]*", ATTRS{name}=="w1-19-*", \
26+
SYMLINK+="i2c-$attr{name}"
27+
-------------------------------------------------------------------------------
28+
may be used to create stable /dev/i2c- entries based on the unique id of the
29+
DS28E17 chip.
30+
31+
32+
Driver parameters are:
33+
34+
speed:
35+
This sets up the default I2C speed a DS28E17 get configured for as soon
36+
it is connected. The power-on default of the DS28E17 is 400kBaud, but
37+
chips may come and go on the Onewire bus without being de-powered and
38+
as soon the "w1_ds28e17" driver notices a freshly connected, or
39+
reconnected DS28E17 device on the Onewire bus, it will re-apply this
40+
setting.
41+
42+
Valid values are 100, 400, 900 [kBaud]. Any other value means to leave
43+
alone the current DS28E17 setting on detect. The default value is 100.
44+
45+
stretch:
46+
This sets up the default stretch value used for freshly connected
47+
DS28E17 devices. It is a multiplier used on the calculation of the busy
48+
wait time for an I2C transfer. This is to account for I2C slave devices
49+
which make heavy use of the I2C clock stretching feature and thus, the
50+
needed timeout cannot be pre-calculated correctly. As the w1_ds28e17
51+
driver checks the DS28E17's busy flag in a loop after the precalculated
52+
wait time, it should be hardly needed to tweak this setting.
53+
54+
Leave it at 1 unless you get ETIMEDOUT errors and a "w1_slave_driver
55+
19-00000002dbd8: busy timeout" in the kernel log.
56+
57+
Valid values are 1 to 9. The default is 1.
58+
59+
60+
The driver creates sysfs files /sys/bus/w1/devices/19-<id>/speed and
61+
/sys/bus/w1/devices/19-<id>/stretch for each device, preloaded with the default
62+
settings from the driver parameters. They may be changed anytime. In addition a
63+
directory /sys/bus/w1/devices/19-<id>/i2c-<nnn> for the I2C bus master sysfs
64+
structure is created.
65+
66+
67+
See https://github.com/ianka/w1_ds28e17 for even more information.
68+

‎drivers/w1/slaves/Kconfig‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,19 @@ config W1_SLAVE_DS28E04
148148

149149
If you are unsure, say N.
150150

151+
config W1_SLAVE_DS28E17
152+
tristate "1-wire-to-I2C master bridge (DS28E17)"
153+
select CRC16
154+
depends on I2C
155+
help
156+
Say Y here if you want to use the DS28E17 1-wire-to-I2C master bridge.
157+
For each DS28E17 detected, a new I2C adapter is created within the
158+
kernel. I2C devices on that bus can be configured to be used by the
159+
kernel and userspace tools as on any other "native" I2C bus.
160+
161+
This driver is also available as a module. If so, the module
162+
will be called w1_ds28e17.
163+
164+
If you are unsure, say N.
165+
151166
endmenu

‎drivers/w1/slaves/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ obj-$(CONFIG_W1_SLAVE_DS2760) += w1_ds2760.o
1717
obj-$(CONFIG_W1_SLAVE_DS2780) += w1_ds2780.o
1818
obj-$(CONFIG_W1_SLAVE_DS2781) += w1_ds2781.o
1919
obj-$(CONFIG_W1_SLAVE_DS28E04) += w1_ds28e04.o
20+
obj-$(CONFIG_W1_SLAVE_DS28E17) += w1_ds28e17.o

0 commit comments

Comments
 (0)