xref: /illumos-gate/usr/src/uts/sun4u/sys/i2c/clients/tda8444_impl.h (revision 69a119caa6570c7077699161b7c28b6ee9f8b0f4)
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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _TDA844_IMPL_H
28 #define	_TDA844_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 #define	TDA8444_MAX_DACS	16
39 #define	TDA8444_CHANS		8
40 #define	TDA8444_BUSY		0x01
41 #define	TDA8444_SUSPENDED	0x02
42 
43 #define	TDA8444_REGBASE		0xf0
44 
45 #define	TDA8444_UNKNOWN_OUT	-1
46 #define	TDA8444_MAX_OUT		0x3f
47 #define	TDA8444_MIN_OUT		0x0
48 
49 #define	TDA8444_MINOR_TO_DEVINST(x) ((x & 0xf00) >> 8)
50 #define	TDA8444_MINOR_TO_CHANNEL(x) (x & 0x00f)
51 
52 #define	TDA8444_CHANNEL_TO_MINOR(x) x
53 #define	TDA8444_DEVINST_TO_MINOR(x) (x << 8)
54 
55 #define	TDA8444_NODE_TYPE "ddi_i2c:adio"
56 
57 /*
58  * Defines for debug printing
59  */
60 #define	DPRINTF(print_flag, args)                       \
61     if (tda8444_debug & (print_flag)) { prom_printf args; }
62 
63 #define	RESUME	0x01
64 #define	IO	0x02
65 
66 struct tda8444_unit {
67 	i2c_transfer_t		*tda8444_transfer;
68 	kmutex_t		tda8444_mutex;
69 	kcondvar_t		tda8444_cv;
70 	uint8_t			tda8444_flags;
71 	int8_t			tda8444_output[TDA8444_MAX_DACS];
72 	i2c_client_hdl_t	tda8444_hdl;
73 	char			tda8444_name[12];
74 	uint16_t		tda8444_oflag[TDA8444_MAX_DACS];
75 };
76 
77 #ifdef	__cplusplus
78 }
79 #endif
80 
81 #endif /* _TDA844_IMPL_H */
82