xref: /illumos-gate/usr/src/uts/sun4u/sys/i2c/clients/max1617_impl.h (revision 45ede40b2394db7967e59f19288fae9b62efd4aa)
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 (c) 1999-2000 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_MAX1617_IMPL_H
28 #define	_MAX1617_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #define	MAX1617_BUSY	0x01
37 
38 #define	MAX1617_MAX_REGS		16
39 #define	MAX1617_LOCAL_TEMP_REG		0
40 #define	MAX1617_REMOTE_TEMP_REG		1
41 #define	MAX1617_STATUS_REG		2
42 #define	MAX1617_CONFIG_REG		3
43 #define	MAX1617_CONV_RATE_REG		4
44 #define	MAX1617_LOCALTEMP_HIGH_REG	5
45 #define	MAX1617_LOCALTEMP_LOW_REG	6
46 #define	MAX1617_REMOTETEMP_HIGH_REG	7
47 #define	MAX1617_REMOTETEMP_LOW_REG	8
48 
49 #define	MAX1617_CONFIG_WR_REG		9
50 #define	MAX1617_CONV_RATE_WR_REG	10
51 #define	MAX1617_LOCALTEMP_HIGH_WR_REG	11
52 #define	MAX1617_LOCALTEMP_LOW_WR_REG	12
53 #define	MAX1617_REMOTETEMP_HIGH_WR_REG	13
54 #define	MAX1617_REMOTETEMP_LOW_WR_REG	14
55 #define	MAX1617_ONE_SHOT_CMD_REG	15
56 
57 #define	MAX1617_INST_TO_MINOR(x) (x << 4)
58 #define	MAX1617_MINOR_TO_INST(x) ((x & 0xFFFFFFF0) >> 4)
59 #define	MAX1617_FCN_TO_MINOR(x)  (x)
60 #define	MAX1617_MINOR_TO_FCN(x)  (0x0F & x)
61 #define	MAX1617_AMB_TEMP 0
62 #define	MAX1617_CPU_TEMP 1
63 
64 #define	MAX1617_NODE_TYPE "ddi_i2c:temperature_sensor"
65 
66 struct max1617_cpr_state {
67 	uint8_t		max1617_config;
68 	uint8_t		max1617_conv_rate;
69 	int8_t		max1617_lcl_hlimit;
70 	int8_t		max1617_lcl_llimit;
71 	int8_t		max1617_remote_hlimit;
72 	int8_t		max1617_remote_llimit;
73 };
74 
75 struct max1617_unit {
76 	kmutex_t	max1617_mutex;
77 	uint8_t		max1617_flags;
78 	kcondvar_t	max1617_cv;
79 	uint16_t	max1617_oflag;
80 	i2c_client_hdl_t	max1617_hdl;
81 	char		max1617_name[24];
82 	struct max1617_cpr_state max1617_cpr_state;
83 };
84 
85 #ifdef	__cplusplus
86 }
87 #endif
88 
89 #endif	/* _MAX1617_IMPL_H */
90