^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) =======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) Kernel driver w1_ds2413
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) =======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) Supported chips:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Maxim DS2413 1-Wire Dual Channel Addressable Switch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) supported family codes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) ================ ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) W1_FAMILY_DS2413 0x3A
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) ================ ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) Author: Mariusz Bialonczyk <manio@skyboo.net>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) The DS2413 chip has two open-drain outputs (PIO A and PIO B).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) Support is provided through the sysfs files "output" and "state".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) Reading state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) -------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) The "state" file provides one-byte value which is in the same format as for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) the chip PIO_ACCESS_READ command (refer the datasheet for details):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) ======== =============================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) Bit 0: PIOA Pin State
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) Bit 1: PIOA Output Latch State
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) Bit 2: PIOB Pin State
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) Bit 3: PIOB Output Latch State
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) Bit 4-7: Complement of Bit 3 to Bit 0 (verified by the kernel module)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) ======== =============================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) This file is readonly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) Writing output
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) --------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) You can set the PIO pins using the "output" file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) It is writable, you can write one-byte value to this sysfs file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) Similarly the byte format is the same as for the PIO_ACCESS_WRITE command:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) ======== ======================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) Bit 0: PIOA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) Bit 1: PIOB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) Bit 2-7: No matter (driver will set it to "1"s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) ======== ======================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) The chip has some kind of basic protection against transmission errors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) When reading the state, there is a four complement bits.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) The driver is checking this complement, and when it is wrong then it is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) returning I/O error.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) When writing output, the master must repeat the PIO Output Data byte in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) its inverted form and it is waiting for a confirmation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) If the write is unsuccessful for three times, the write also returns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) I/O error.