xref: /OK3568_Linux_fs/kernel/drivers/w1/slaves/w1_ds2408.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-only
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  *	w1_ds2408.c - w1 family 29 (DS2408) driver
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright (c) 2010 Jean-Francois Dagenais <dagenaisj@sonatest.com>
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #include <linux/kernel.h>
9*4882a593Smuzhiyun #include <linux/module.h>
10*4882a593Smuzhiyun #include <linux/moduleparam.h>
11*4882a593Smuzhiyun #include <linux/device.h>
12*4882a593Smuzhiyun #include <linux/types.h>
13*4882a593Smuzhiyun #include <linux/delay.h>
14*4882a593Smuzhiyun #include <linux/slab.h>
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun #include <linux/w1.h>
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun #define W1_FAMILY_DS2408	0x29
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun #define W1_F29_RETRIES		3
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun #define W1_F29_REG_LOGIG_STATE             0x88 /* R */
23*4882a593Smuzhiyun #define W1_F29_REG_OUTPUT_LATCH_STATE      0x89 /* R */
24*4882a593Smuzhiyun #define W1_F29_REG_ACTIVITY_LATCH_STATE    0x8A /* R */
25*4882a593Smuzhiyun #define W1_F29_REG_COND_SEARCH_SELECT_MASK 0x8B /* RW */
26*4882a593Smuzhiyun #define W1_F29_REG_COND_SEARCH_POL_SELECT  0x8C /* RW */
27*4882a593Smuzhiyun #define W1_F29_REG_CONTROL_AND_STATUS      0x8D /* RW */
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun #define W1_F29_FUNC_READ_PIO_REGS          0xF0
30*4882a593Smuzhiyun #define W1_F29_FUNC_CHANN_ACCESS_READ      0xF5
31*4882a593Smuzhiyun #define W1_F29_FUNC_CHANN_ACCESS_WRITE     0x5A
32*4882a593Smuzhiyun /* also used to write the control/status reg (0x8D): */
33*4882a593Smuzhiyun #define W1_F29_FUNC_WRITE_COND_SEARCH_REG  0xCC
34*4882a593Smuzhiyun #define W1_F29_FUNC_RESET_ACTIVITY_LATCHES 0xC3
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun #define W1_F29_SUCCESS_CONFIRM_BYTE        0xAA
37*4882a593Smuzhiyun 
_read_reg(struct w1_slave * sl,u8 address,unsigned char * buf)38*4882a593Smuzhiyun static int _read_reg(struct w1_slave *sl, u8 address, unsigned char* buf)
39*4882a593Smuzhiyun {
40*4882a593Smuzhiyun 	u8 wrbuf[3];
41*4882a593Smuzhiyun 	dev_dbg(&sl->dev,
42*4882a593Smuzhiyun 			"Reading with slave: %p, reg addr: %0#4x, buff addr: %p",
43*4882a593Smuzhiyun 			sl, (unsigned int)address, buf);
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun 	if (!buf)
46*4882a593Smuzhiyun 		return -EINVAL;
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun 	mutex_lock(&sl->master->bus_mutex);
49*4882a593Smuzhiyun 	dev_dbg(&sl->dev, "mutex locked");
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun 	if (w1_reset_select_slave(sl)) {
52*4882a593Smuzhiyun 		mutex_unlock(&sl->master->bus_mutex);
53*4882a593Smuzhiyun 		return -EIO;
54*4882a593Smuzhiyun 	}
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun 	wrbuf[0] = W1_F29_FUNC_READ_PIO_REGS;
57*4882a593Smuzhiyun 	wrbuf[1] = address;
58*4882a593Smuzhiyun 	wrbuf[2] = 0;
59*4882a593Smuzhiyun 	w1_write_block(sl->master, wrbuf, 3);
60*4882a593Smuzhiyun 	*buf = w1_read_8(sl->master);
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun 	mutex_unlock(&sl->master->bus_mutex);
63*4882a593Smuzhiyun 	dev_dbg(&sl->dev, "mutex unlocked");
64*4882a593Smuzhiyun 	return 1;
65*4882a593Smuzhiyun }
66*4882a593Smuzhiyun 
state_read(struct file * filp,struct kobject * kobj,struct bin_attribute * bin_attr,char * buf,loff_t off,size_t count)67*4882a593Smuzhiyun static ssize_t state_read(struct file *filp, struct kobject *kobj,
68*4882a593Smuzhiyun 			  struct bin_attribute *bin_attr, char *buf, loff_t off,
69*4882a593Smuzhiyun 			  size_t count)
70*4882a593Smuzhiyun {
71*4882a593Smuzhiyun 	dev_dbg(&kobj_to_w1_slave(kobj)->dev,
72*4882a593Smuzhiyun 		"Reading %s kobj: %p, off: %0#10x, count: %zu, buff addr: %p",
73*4882a593Smuzhiyun 		bin_attr->attr.name, kobj, (unsigned int)off, count, buf);
74*4882a593Smuzhiyun 	if (count != 1 || off != 0)
75*4882a593Smuzhiyun 		return -EFAULT;
76*4882a593Smuzhiyun 	return _read_reg(kobj_to_w1_slave(kobj), W1_F29_REG_LOGIG_STATE, buf);
77*4882a593Smuzhiyun }
78*4882a593Smuzhiyun 
output_read(struct file * filp,struct kobject * kobj,struct bin_attribute * bin_attr,char * buf,loff_t off,size_t count)79*4882a593Smuzhiyun static ssize_t output_read(struct file *filp, struct kobject *kobj,
80*4882a593Smuzhiyun 			   struct bin_attribute *bin_attr, char *buf,
81*4882a593Smuzhiyun 			   loff_t off, size_t count)
82*4882a593Smuzhiyun {
83*4882a593Smuzhiyun 	dev_dbg(&kobj_to_w1_slave(kobj)->dev,
84*4882a593Smuzhiyun 		"Reading %s kobj: %p, off: %0#10x, count: %zu, buff addr: %p",
85*4882a593Smuzhiyun 		bin_attr->attr.name, kobj, (unsigned int)off, count, buf);
86*4882a593Smuzhiyun 	if (count != 1 || off != 0)
87*4882a593Smuzhiyun 		return -EFAULT;
88*4882a593Smuzhiyun 	return _read_reg(kobj_to_w1_slave(kobj),
89*4882a593Smuzhiyun 					 W1_F29_REG_OUTPUT_LATCH_STATE, buf);
90*4882a593Smuzhiyun }
91*4882a593Smuzhiyun 
activity_read(struct file * filp,struct kobject * kobj,struct bin_attribute * bin_attr,char * buf,loff_t off,size_t count)92*4882a593Smuzhiyun static ssize_t activity_read(struct file *filp, struct kobject *kobj,
93*4882a593Smuzhiyun 			     struct bin_attribute *bin_attr, char *buf,
94*4882a593Smuzhiyun 			     loff_t off, size_t count)
95*4882a593Smuzhiyun {
96*4882a593Smuzhiyun 	dev_dbg(&kobj_to_w1_slave(kobj)->dev,
97*4882a593Smuzhiyun 		"Reading %s kobj: %p, off: %0#10x, count: %zu, buff addr: %p",
98*4882a593Smuzhiyun 		bin_attr->attr.name, kobj, (unsigned int)off, count, buf);
99*4882a593Smuzhiyun 	if (count != 1 || off != 0)
100*4882a593Smuzhiyun 		return -EFAULT;
101*4882a593Smuzhiyun 	return _read_reg(kobj_to_w1_slave(kobj),
102*4882a593Smuzhiyun 					 W1_F29_REG_ACTIVITY_LATCH_STATE, buf);
103*4882a593Smuzhiyun }
104*4882a593Smuzhiyun 
cond_search_mask_read(struct file * filp,struct kobject * kobj,struct bin_attribute * bin_attr,char * buf,loff_t off,size_t count)105*4882a593Smuzhiyun static ssize_t cond_search_mask_read(struct file *filp, struct kobject *kobj,
106*4882a593Smuzhiyun 				     struct bin_attribute *bin_attr, char *buf,
107*4882a593Smuzhiyun 				     loff_t off, size_t count)
108*4882a593Smuzhiyun {
109*4882a593Smuzhiyun 	dev_dbg(&kobj_to_w1_slave(kobj)->dev,
110*4882a593Smuzhiyun 		"Reading %s kobj: %p, off: %0#10x, count: %zu, buff addr: %p",
111*4882a593Smuzhiyun 		bin_attr->attr.name, kobj, (unsigned int)off, count, buf);
112*4882a593Smuzhiyun 	if (count != 1 || off != 0)
113*4882a593Smuzhiyun 		return -EFAULT;
114*4882a593Smuzhiyun 	return _read_reg(kobj_to_w1_slave(kobj),
115*4882a593Smuzhiyun 		W1_F29_REG_COND_SEARCH_SELECT_MASK, buf);
116*4882a593Smuzhiyun }
117*4882a593Smuzhiyun 
cond_search_polarity_read(struct file * filp,struct kobject * kobj,struct bin_attribute * bin_attr,char * buf,loff_t off,size_t count)118*4882a593Smuzhiyun static ssize_t cond_search_polarity_read(struct file *filp,
119*4882a593Smuzhiyun 					 struct kobject *kobj,
120*4882a593Smuzhiyun 					 struct bin_attribute *bin_attr,
121*4882a593Smuzhiyun 					 char *buf, loff_t off, size_t count)
122*4882a593Smuzhiyun {
123*4882a593Smuzhiyun 	if (count != 1 || off != 0)
124*4882a593Smuzhiyun 		return -EFAULT;
125*4882a593Smuzhiyun 	return _read_reg(kobj_to_w1_slave(kobj),
126*4882a593Smuzhiyun 		W1_F29_REG_COND_SEARCH_POL_SELECT, buf);
127*4882a593Smuzhiyun }
128*4882a593Smuzhiyun 
status_control_read(struct file * filp,struct kobject * kobj,struct bin_attribute * bin_attr,char * buf,loff_t off,size_t count)129*4882a593Smuzhiyun static ssize_t status_control_read(struct file *filp, struct kobject *kobj,
130*4882a593Smuzhiyun 				   struct bin_attribute *bin_attr, char *buf,
131*4882a593Smuzhiyun 				   loff_t off, size_t count)
132*4882a593Smuzhiyun {
133*4882a593Smuzhiyun 	if (count != 1 || off != 0)
134*4882a593Smuzhiyun 		return -EFAULT;
135*4882a593Smuzhiyun 	return _read_reg(kobj_to_w1_slave(kobj),
136*4882a593Smuzhiyun 		W1_F29_REG_CONTROL_AND_STATUS, buf);
137*4882a593Smuzhiyun }
138*4882a593Smuzhiyun 
139*4882a593Smuzhiyun #ifdef CONFIG_W1_SLAVE_DS2408_READBACK
optional_read_back_valid(struct w1_slave * sl,u8 expected)140*4882a593Smuzhiyun static bool optional_read_back_valid(struct w1_slave *sl, u8 expected)
141*4882a593Smuzhiyun {
142*4882a593Smuzhiyun 	u8 w1_buf[3];
143*4882a593Smuzhiyun 
144*4882a593Smuzhiyun 	if (w1_reset_resume_command(sl->master))
145*4882a593Smuzhiyun 		return false;
146*4882a593Smuzhiyun 
147*4882a593Smuzhiyun 	w1_buf[0] = W1_F29_FUNC_READ_PIO_REGS;
148*4882a593Smuzhiyun 	w1_buf[1] = W1_F29_REG_OUTPUT_LATCH_STATE;
149*4882a593Smuzhiyun 	w1_buf[2] = 0;
150*4882a593Smuzhiyun 
151*4882a593Smuzhiyun 	w1_write_block(sl->master, w1_buf, 3);
152*4882a593Smuzhiyun 
153*4882a593Smuzhiyun 	return (w1_read_8(sl->master) == expected);
154*4882a593Smuzhiyun }
155*4882a593Smuzhiyun #else
optional_read_back_valid(struct w1_slave * sl,u8 expected)156*4882a593Smuzhiyun static bool optional_read_back_valid(struct w1_slave *sl, u8 expected)
157*4882a593Smuzhiyun {
158*4882a593Smuzhiyun 	return true;
159*4882a593Smuzhiyun }
160*4882a593Smuzhiyun #endif
161*4882a593Smuzhiyun 
output_write(struct file * filp,struct kobject * kobj,struct bin_attribute * bin_attr,char * buf,loff_t off,size_t count)162*4882a593Smuzhiyun static ssize_t output_write(struct file *filp, struct kobject *kobj,
163*4882a593Smuzhiyun 			    struct bin_attribute *bin_attr, char *buf,
164*4882a593Smuzhiyun 			    loff_t off, size_t count)
165*4882a593Smuzhiyun {
166*4882a593Smuzhiyun 	struct w1_slave *sl = kobj_to_w1_slave(kobj);
167*4882a593Smuzhiyun 	u8 w1_buf[3];
168*4882a593Smuzhiyun 	unsigned int retries = W1_F29_RETRIES;
169*4882a593Smuzhiyun 	ssize_t bytes_written = -EIO;
170*4882a593Smuzhiyun 
171*4882a593Smuzhiyun 	if (count != 1 || off != 0)
172*4882a593Smuzhiyun 		return -EFAULT;
173*4882a593Smuzhiyun 
174*4882a593Smuzhiyun 	dev_dbg(&sl->dev, "locking mutex for write_output");
175*4882a593Smuzhiyun 	mutex_lock(&sl->master->bus_mutex);
176*4882a593Smuzhiyun 	dev_dbg(&sl->dev, "mutex locked");
177*4882a593Smuzhiyun 
178*4882a593Smuzhiyun 	if (w1_reset_select_slave(sl))
179*4882a593Smuzhiyun 		goto out;
180*4882a593Smuzhiyun 
181*4882a593Smuzhiyun 	do {
182*4882a593Smuzhiyun 		w1_buf[0] = W1_F29_FUNC_CHANN_ACCESS_WRITE;
183*4882a593Smuzhiyun 		w1_buf[1] = *buf;
184*4882a593Smuzhiyun 		w1_buf[2] = ~(*buf);
185*4882a593Smuzhiyun 
186*4882a593Smuzhiyun 		w1_write_block(sl->master, w1_buf, 3);
187*4882a593Smuzhiyun 
188*4882a593Smuzhiyun 		if (w1_read_8(sl->master) == W1_F29_SUCCESS_CONFIRM_BYTE &&
189*4882a593Smuzhiyun 		    optional_read_back_valid(sl, *buf)) {
190*4882a593Smuzhiyun 			bytes_written = 1;
191*4882a593Smuzhiyun 			goto out;
192*4882a593Smuzhiyun 		}
193*4882a593Smuzhiyun 
194*4882a593Smuzhiyun 		if (w1_reset_resume_command(sl->master))
195*4882a593Smuzhiyun 			goto out; /* unrecoverable error */
196*4882a593Smuzhiyun 		/* try again, the slave is ready for a command */
197*4882a593Smuzhiyun 	} while (--retries);
198*4882a593Smuzhiyun 
199*4882a593Smuzhiyun out:
200*4882a593Smuzhiyun 	mutex_unlock(&sl->master->bus_mutex);
201*4882a593Smuzhiyun 
202*4882a593Smuzhiyun 	dev_dbg(&sl->dev, "%s, mutex unlocked retries:%d\n",
203*4882a593Smuzhiyun 		(bytes_written > 0) ? "succeeded" : "error", retries);
204*4882a593Smuzhiyun 
205*4882a593Smuzhiyun 	return bytes_written;
206*4882a593Smuzhiyun }
207*4882a593Smuzhiyun 
208*4882a593Smuzhiyun 
209*4882a593Smuzhiyun /**
210*4882a593Smuzhiyun  * Writing to the activity file resets the activity latches.
211*4882a593Smuzhiyun  */
activity_write(struct file * filp,struct kobject * kobj,struct bin_attribute * bin_attr,char * buf,loff_t off,size_t count)212*4882a593Smuzhiyun static ssize_t activity_write(struct file *filp, struct kobject *kobj,
213*4882a593Smuzhiyun 			      struct bin_attribute *bin_attr, char *buf,
214*4882a593Smuzhiyun 			      loff_t off, size_t count)
215*4882a593Smuzhiyun {
216*4882a593Smuzhiyun 	struct w1_slave *sl = kobj_to_w1_slave(kobj);
217*4882a593Smuzhiyun 	unsigned int retries = W1_F29_RETRIES;
218*4882a593Smuzhiyun 
219*4882a593Smuzhiyun 	if (count != 1 || off != 0)
220*4882a593Smuzhiyun 		return -EFAULT;
221*4882a593Smuzhiyun 
222*4882a593Smuzhiyun 	mutex_lock(&sl->master->bus_mutex);
223*4882a593Smuzhiyun 
224*4882a593Smuzhiyun 	if (w1_reset_select_slave(sl))
225*4882a593Smuzhiyun 		goto error;
226*4882a593Smuzhiyun 
227*4882a593Smuzhiyun 	while (retries--) {
228*4882a593Smuzhiyun 		w1_write_8(sl->master, W1_F29_FUNC_RESET_ACTIVITY_LATCHES);
229*4882a593Smuzhiyun 		if (w1_read_8(sl->master) == W1_F29_SUCCESS_CONFIRM_BYTE) {
230*4882a593Smuzhiyun 			mutex_unlock(&sl->master->bus_mutex);
231*4882a593Smuzhiyun 			return 1;
232*4882a593Smuzhiyun 		}
233*4882a593Smuzhiyun 		if (w1_reset_resume_command(sl->master))
234*4882a593Smuzhiyun 			goto error;
235*4882a593Smuzhiyun 	}
236*4882a593Smuzhiyun 
237*4882a593Smuzhiyun error:
238*4882a593Smuzhiyun 	mutex_unlock(&sl->master->bus_mutex);
239*4882a593Smuzhiyun 	return -EIO;
240*4882a593Smuzhiyun }
241*4882a593Smuzhiyun 
status_control_write(struct file * filp,struct kobject * kobj,struct bin_attribute * bin_attr,char * buf,loff_t off,size_t count)242*4882a593Smuzhiyun static ssize_t status_control_write(struct file *filp, struct kobject *kobj,
243*4882a593Smuzhiyun 				    struct bin_attribute *bin_attr, char *buf,
244*4882a593Smuzhiyun 				    loff_t off, size_t count)
245*4882a593Smuzhiyun {
246*4882a593Smuzhiyun 	struct w1_slave *sl = kobj_to_w1_slave(kobj);
247*4882a593Smuzhiyun 	u8 w1_buf[4];
248*4882a593Smuzhiyun 	unsigned int retries = W1_F29_RETRIES;
249*4882a593Smuzhiyun 
250*4882a593Smuzhiyun 	if (count != 1 || off != 0)
251*4882a593Smuzhiyun 		return -EFAULT;
252*4882a593Smuzhiyun 
253*4882a593Smuzhiyun 	mutex_lock(&sl->master->bus_mutex);
254*4882a593Smuzhiyun 
255*4882a593Smuzhiyun 	if (w1_reset_select_slave(sl))
256*4882a593Smuzhiyun 		goto error;
257*4882a593Smuzhiyun 
258*4882a593Smuzhiyun 	while (retries--) {
259*4882a593Smuzhiyun 		w1_buf[0] = W1_F29_FUNC_WRITE_COND_SEARCH_REG;
260*4882a593Smuzhiyun 		w1_buf[1] = W1_F29_REG_CONTROL_AND_STATUS;
261*4882a593Smuzhiyun 		w1_buf[2] = 0;
262*4882a593Smuzhiyun 		w1_buf[3] = *buf;
263*4882a593Smuzhiyun 
264*4882a593Smuzhiyun 		w1_write_block(sl->master, w1_buf, 4);
265*4882a593Smuzhiyun 		if (w1_reset_resume_command(sl->master))
266*4882a593Smuzhiyun 			goto error;
267*4882a593Smuzhiyun 
268*4882a593Smuzhiyun 		w1_buf[0] = W1_F29_FUNC_READ_PIO_REGS;
269*4882a593Smuzhiyun 		w1_buf[1] = W1_F29_REG_CONTROL_AND_STATUS;
270*4882a593Smuzhiyun 		w1_buf[2] = 0;
271*4882a593Smuzhiyun 
272*4882a593Smuzhiyun 		w1_write_block(sl->master, w1_buf, 3);
273*4882a593Smuzhiyun 		if (w1_read_8(sl->master) == *buf) {
274*4882a593Smuzhiyun 			/* success! */
275*4882a593Smuzhiyun 			mutex_unlock(&sl->master->bus_mutex);
276*4882a593Smuzhiyun 			return 1;
277*4882a593Smuzhiyun 		}
278*4882a593Smuzhiyun 	}
279*4882a593Smuzhiyun error:
280*4882a593Smuzhiyun 	mutex_unlock(&sl->master->bus_mutex);
281*4882a593Smuzhiyun 
282*4882a593Smuzhiyun 	return -EIO;
283*4882a593Smuzhiyun }
284*4882a593Smuzhiyun 
285*4882a593Smuzhiyun /*
286*4882a593Smuzhiyun  * This is a special sequence we must do to ensure the P0 output is not stuck
287*4882a593Smuzhiyun  * in test mode. This is described in rev 2 of the ds2408's datasheet
288*4882a593Smuzhiyun  * (http://datasheets.maximintegrated.com/en/ds/DS2408.pdf) under
289*4882a593Smuzhiyun  * "APPLICATION INFORMATION/Power-up timing".
290*4882a593Smuzhiyun  */
w1_f29_disable_test_mode(struct w1_slave * sl)291*4882a593Smuzhiyun static int w1_f29_disable_test_mode(struct w1_slave *sl)
292*4882a593Smuzhiyun {
293*4882a593Smuzhiyun 	int res;
294*4882a593Smuzhiyun 	u8 magic[10] = {0x96, };
295*4882a593Smuzhiyun 	u64 rn = le64_to_cpu(*((u64*)&sl->reg_num));
296*4882a593Smuzhiyun 
297*4882a593Smuzhiyun 	memcpy(&magic[1], &rn, 8);
298*4882a593Smuzhiyun 	magic[9] = 0x3C;
299*4882a593Smuzhiyun 
300*4882a593Smuzhiyun 	mutex_lock(&sl->master->bus_mutex);
301*4882a593Smuzhiyun 
302*4882a593Smuzhiyun 	res = w1_reset_bus(sl->master);
303*4882a593Smuzhiyun 	if (res)
304*4882a593Smuzhiyun 		goto out;
305*4882a593Smuzhiyun 	w1_write_block(sl->master, magic, ARRAY_SIZE(magic));
306*4882a593Smuzhiyun 
307*4882a593Smuzhiyun 	res = w1_reset_bus(sl->master);
308*4882a593Smuzhiyun out:
309*4882a593Smuzhiyun 	mutex_unlock(&sl->master->bus_mutex);
310*4882a593Smuzhiyun 	return res;
311*4882a593Smuzhiyun }
312*4882a593Smuzhiyun 
313*4882a593Smuzhiyun static BIN_ATTR_RO(state, 1);
314*4882a593Smuzhiyun static BIN_ATTR_RW(output, 1);
315*4882a593Smuzhiyun static BIN_ATTR_RW(activity, 1);
316*4882a593Smuzhiyun static BIN_ATTR_RO(cond_search_mask, 1);
317*4882a593Smuzhiyun static BIN_ATTR_RO(cond_search_polarity, 1);
318*4882a593Smuzhiyun static BIN_ATTR_RW(status_control, 1);
319*4882a593Smuzhiyun 
320*4882a593Smuzhiyun static struct bin_attribute *w1_f29_bin_attrs[] = {
321*4882a593Smuzhiyun 	&bin_attr_state,
322*4882a593Smuzhiyun 	&bin_attr_output,
323*4882a593Smuzhiyun 	&bin_attr_activity,
324*4882a593Smuzhiyun 	&bin_attr_cond_search_mask,
325*4882a593Smuzhiyun 	&bin_attr_cond_search_polarity,
326*4882a593Smuzhiyun 	&bin_attr_status_control,
327*4882a593Smuzhiyun 	NULL,
328*4882a593Smuzhiyun };
329*4882a593Smuzhiyun 
330*4882a593Smuzhiyun static const struct attribute_group w1_f29_group = {
331*4882a593Smuzhiyun 	.bin_attrs = w1_f29_bin_attrs,
332*4882a593Smuzhiyun };
333*4882a593Smuzhiyun 
334*4882a593Smuzhiyun static const struct attribute_group *w1_f29_groups[] = {
335*4882a593Smuzhiyun 	&w1_f29_group,
336*4882a593Smuzhiyun 	NULL,
337*4882a593Smuzhiyun };
338*4882a593Smuzhiyun 
339*4882a593Smuzhiyun static const struct w1_family_ops w1_f29_fops = {
340*4882a593Smuzhiyun 	.add_slave      = w1_f29_disable_test_mode,
341*4882a593Smuzhiyun 	.groups		= w1_f29_groups,
342*4882a593Smuzhiyun };
343*4882a593Smuzhiyun 
344*4882a593Smuzhiyun static struct w1_family w1_family_29 = {
345*4882a593Smuzhiyun 	.fid = W1_FAMILY_DS2408,
346*4882a593Smuzhiyun 	.fops = &w1_f29_fops,
347*4882a593Smuzhiyun };
348*4882a593Smuzhiyun module_w1_family(w1_family_29);
349*4882a593Smuzhiyun 
350*4882a593Smuzhiyun MODULE_AUTHOR("Jean-Francois Dagenais <dagenaisj@sonatest.com>");
351*4882a593Smuzhiyun MODULE_DESCRIPTION("w1 family 29 driver for DS2408 8 Pin IO");
352*4882a593Smuzhiyun MODULE_LICENSE("GPL");
353*4882a593Smuzhiyun MODULE_ALIAS("w1-family-" __stringify(W1_FAMILY_DS2408));
354