Skip to contentSkip to conversation

new driver: w1_ds2406

DISCUSSION Scott Alfter 3 participants 3 messages Jun 6, 2014 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1853313.sEkU5HsBDk@kaylee

A message that is not in the archive (sent off-list or not yet received): [email protected]

Scott Alfter

author Acked-by Evgeniy Polyakov Reviewed-by Evgeniy Polyakov
#2 lore raw
Quoted 8 lines · Evgeniy Polyakov

04.06.2014, 08:25, "Scott Alfter" <[email protected]>:

Quoted 4 lines

I have a project for which I needed support for the DS2406 addressable switch, so I started with an existing driver and modified it as needed. It allows the switch outputs to be controlled over the bus, which is what I needed from it.

Driver seems good, although debug prints like 'mutex is locked' are better to be dropped.

Those were in the DS2413 driver, which I used as a base for my changes. I've taken them out. Also, I fixed a typo I made in the description in a Kconfig file.

Quoted 3 lines

Please send this patch to linux-kernel@ and add me and [email protected] to copy, and patch will be pulled upstream.
Feel free to add my acked/reviewed-by tags.

drivers/w1/slaves/Kconfig +7 -0
index 5e6a3c9..6b04f0f 100644
@@ -38,6 +38,13 @@ config W1_SLAVE_DS2413
 	  Say Y here if you want to use a 1-wire
 	  DS2413 Dual Channel Addressable Switch device support
 
+config W1_SLAVE_DS2406
+	tristate "Dual Channel Addressable Switch 0x12 family support (DS2406)"
+	help
+	  Say Y or M here if you want to use a 1-wire
+	  DS2406 Dual Channel Addressable Switch.  EPROM read/write
+	  support for these devices is not implemented.
+
 config W1_SLAVE_DS2423
 	tristate "Counter 1-wire device (DS2423)"
 	select CRC16
drivers/w1/slaves/Makefile +1 -0
index 06529f3..1e9989a 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_W1_SLAVE_THERM)	+= w1_therm.o
 obj-$(CONFIG_W1_SLAVE_SMEM)	+= w1_smem.o
 obj-$(CONFIG_W1_SLAVE_DS2408)	+= w1_ds2408.o
 obj-$(CONFIG_W1_SLAVE_DS2413)	+= w1_ds2413.o
+obj-$(CONFIG_W1_SLAVE_DS2406)	+= w1_ds2406.o
 obj-$(CONFIG_W1_SLAVE_DS2423)	+= w1_ds2423.o
 obj-$(CONFIG_W1_SLAVE_DS2431)	+= w1_ds2431.o
 obj-$(CONFIG_W1_SLAVE_DS2433)	+= w1_ds2433.o
drivers/w1/w1_family.h +1 -0
index 625dd08..56d8a0c 100644
@@ -40,6 +40,7 @@
 #define W1_FAMILY_DS2760	0x30
 #define W1_FAMILY_DS2780	0x32
 #define W1_FAMILY_DS2413	0x3A
+#define W1_FAMILY_DS2406	0x12
 #define W1_THERM_DS1825		0x3B
 #define W1_FAMILY_DS2781	0x3D
 #define W1_THERM_DS28EA00	0x42
Documentation/w1/slaves/w1_ds2406 new file +22 -0
new file mode 100644
index 0000000..1aa409a
@@ -0,0 +1,22 @@
+w1_ds2406 kernel driver
+=======================
+
+Supported chips:
+  * Maxim DS2406 (and other family 0x12) addressable switches
+
+Author: Scott Alfter <[email protected]>
+
+Description
+-----------
+
+The w1_ds2406 driver allows connected devices to be switched on and off. 
+These chips also provide 128 bytes of OTP EPROM, but reading/writing it is
+not supported.  In TSOC-6 form, the DS2406 provides two switch outputs and
+can be provided with power on a dedicated input.  In TO-92 form, it provides
+one output and uses parasitic power only.
+
+The driver provides two sysfs files.  state is readable; it gives the
+current state of each switch, with PIO A in bit 0 and PIO B in bit 1.  The
+driver ORs this state with 0x30, so shell scripts get an ASCII 0/1/2/3 to
+work with.  output is writable; bits 0 and 1 control PIO A and B,
+respectively.  Bits 2-7 are ignored, so it's safe to write ASCII data.
drivers/w1/slaves/w1_ds2406.c new file +159 -0

159 lines not on this page · raw message

#3 lore raw

Hi everyone

Greg, please pull this patch into the tree

06.06.2014, 21:47, "Scott Alfter" <[email protected]>:

Quoted 19 lines · Evgeniy Polyakov
Quoted 7 lines

 04.06.2014, 08:25, "Scott Alfter" <[email protected]>:

Quoted 4 lines

 I have a project for which I needed support for the DS2406 addressable switch, so I started with an existing driver and modified it as needed. It allows the switch outputs to be controlled over the bus, which is what I needed from it.

 Driver seems good, although debug prints like 'mutex is locked' are better to be dropped.

Those were in the DS2413 driver, which I used as a base for my changes. I've taken them out.  Also, I fixed a typo I made in the description in a Kconfig file.

Quoted 3 lines

 Please send this patch to linux-kernel@ and add me and [email protected] to copy, and patch will be pulled upstream.
 Feel free to add my acked/reviewed-by tags.

#4 lore raw
Quoted 3 lines · Evgeniy Polyakov

Hi everyone

Greg, please pull this patch into the tree

Will do after 3.16-rc1 is out, thanks.

greg k-h