162306a36Sopenharmony_ci======================= 262306a36Sopenharmony_ciKernel driver w1_ds2413 362306a36Sopenharmony_ci======================= 462306a36Sopenharmony_ci 562306a36Sopenharmony_ciSupported chips: 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci * Maxim DS2413 1-Wire Dual Channel Addressable Switch 862306a36Sopenharmony_ci 962306a36Sopenharmony_cisupported family codes: 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci ================ ==== 1262306a36Sopenharmony_ci W1_FAMILY_DS2413 0x3A 1362306a36Sopenharmony_ci ================ ==== 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ciAuthor: Mariusz Bialonczyk <manio@skyboo.net> 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ciDescription 1862306a36Sopenharmony_ci----------- 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ciThe DS2413 chip has two open-drain outputs (PIO A and PIO B). 2162306a36Sopenharmony_ciSupport is provided through the sysfs files "output" and "state". 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ciReading state 2462306a36Sopenharmony_ci------------- 2562306a36Sopenharmony_ciThe "state" file provides one-byte value which is in the same format as for 2662306a36Sopenharmony_cithe chip PIO_ACCESS_READ command (refer the datasheet for details): 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci======== ============================================================= 2962306a36Sopenharmony_ciBit 0: PIOA Pin State 3062306a36Sopenharmony_ciBit 1: PIOA Output Latch State 3162306a36Sopenharmony_ciBit 2: PIOB Pin State 3262306a36Sopenharmony_ciBit 3: PIOB Output Latch State 3362306a36Sopenharmony_ciBit 4-7: Complement of Bit 3 to Bit 0 (verified by the kernel module) 3462306a36Sopenharmony_ci======== ============================================================= 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ciThis file is readonly. 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ciWriting output 3962306a36Sopenharmony_ci-------------- 4062306a36Sopenharmony_ciYou can set the PIO pins using the "output" file. 4162306a36Sopenharmony_ciIt is writable, you can write one-byte value to this sysfs file. 4262306a36Sopenharmony_ciSimilarly the byte format is the same as for the PIO_ACCESS_WRITE command: 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci======== ====================================== 4562306a36Sopenharmony_ciBit 0: PIOA 4662306a36Sopenharmony_ciBit 1: PIOB 4762306a36Sopenharmony_ciBit 2-7: No matter (driver will set it to "1"s) 4862306a36Sopenharmony_ci======== ====================================== 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ciThe chip has some kind of basic protection against transmission errors. 5262306a36Sopenharmony_ciWhen reading the state, there is a four complement bits. 5362306a36Sopenharmony_ciThe driver is checking this complement, and when it is wrong then it is 5462306a36Sopenharmony_cireturning I/O error. 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ciWhen writing output, the master must repeat the PIO Output Data byte in 5762306a36Sopenharmony_ciits inverted form and it is waiting for a confirmation. 5862306a36Sopenharmony_ciIf the write is unsuccessful for three times, the write also returns 5962306a36Sopenharmony_ciI/O error. 60