162306a36Sopenharmony_ci======================= 262306a36Sopenharmony_ciw1_ds2406 kernel driver 362306a36Sopenharmony_ci======================= 462306a36Sopenharmony_ci 562306a36Sopenharmony_ciSupported chips: 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci * Maxim DS2406 (and other family 0x12) addressable switches 862306a36Sopenharmony_ci 962306a36Sopenharmony_ciAuthor: Scott Alfter <scott@alfter.us> 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ciDescription 1262306a36Sopenharmony_ci----------- 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ciThe w1_ds2406 driver allows connected devices to be switched on and off. 1562306a36Sopenharmony_ciThese chips also provide 128 bytes of OTP EPROM, but reading/writing it is 1662306a36Sopenharmony_cinot supported. In TSOC-6 form, the DS2406 provides two switch outputs and 1762306a36Sopenharmony_cican be provided with power on a dedicated input. In TO-92 form, it provides 1862306a36Sopenharmony_cione output and uses parasitic power only. 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ciThe driver provides two sysfs files. state is readable; it gives the 2162306a36Sopenharmony_cicurrent state of each switch, with PIO A in bit 0 and PIO B in bit 1. The 2262306a36Sopenharmony_cidriver ORs this state with 0x30, so shell scripts get an ASCII 0/1/2/3 to 2362306a36Sopenharmony_ciwork with. output is writable; bits 0 and 1 control PIO A and B, 2462306a36Sopenharmony_cirespectively. Bits 2-7 are ignored, so it's safe to write ASCII data. 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ciCRCs are checked on read and write. Failed checks cause an I/O error to be 2762306a36Sopenharmony_cireturned. On a failed write, the switch status is not changed. 28