1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _PCA9556_IMPL_H
28 #define	_PCA9556_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/promif.h>
37 
38 /*
39  * Declarations for debug printing
40  */
41 extern int pca9556_debug;
42 
43 #define	PCA9556_NUM_PORTS	1
44 #define	PCA9555_NUM_PORTS	2
45 #define	PCA9556_NUM_REG		3
46 #define	PCA9556_MAX_REG		6
47 
48 #define	PCA9556_BUSYFLAG	0x1
49 #define	PCA9556_MINORFLAG	0x2
50 #define	PCA9556_TBUFFLAG	0x4
51 #define	PCA9556_REGFLAG		0x8
52 
53 #define	PCA9556_INPUT_REG	0x0
54 #define	PCA9556_OUTPUT_REG	0x1
55 #define	PCA9556_POLARITY_REG	0x2
56 #define	PCA9556_CONFIG_REG	0x3
57 
58 #define	PCA9555_INPUT_REG	0x0
59 #define	PCA9555_OUTPUT_REG	0x2
60 #define	PCA9555_POLARITY_REG	0x4
61 #define	PCA9555_CONFIG_REG	0x6
62 
63 #define	PCA9556_NODE_TYPE	"ddi_i2c:gpio_device"
64 #define	PCA9556_MAX_SIZE	8
65 #define	PCA9556_NAME_LEN	16
66 
67 typedef struct pca9556_unit {
68 	dev_info_t		*pca9556_dip;
69 	i2c_transfer_t		*pca9556_transfer;
70 	kmutex_t		pca9556_mutex;
71 	kcondvar_t		pca9556_cv;
72 	uint8_t			pca9556_flags;
73 	i2c_client_hdl_t	pca9556_hdl;
74 	char			pca9556_name[PCA9556_NAME_LEN];
75 	uint16_t		pca9556_oflag;
76 	uint8_t			pca9556_cpr_state[PCA9556_MAX_REG];
77 	boolean_t		pca9555_device;
78 } pca9556_unit_t;
79 
80 #ifdef	__cplusplus
81 }
82 #endif
83 
84 #endif /* _PCA9556_IMPL_H */
85