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