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