xref: /illumos-gate/usr/src/uts/sun4u/sys/i2c/clients/max1617_impl.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_MAX1617_IMPL_H
28*7c478bd9Sstevel@tonic-gate #define	_MAX1617_IMPL_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #define	MAX1617_BUSY	0x01
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate #define	MAX1617_MAX_REGS		16
39*7c478bd9Sstevel@tonic-gate #define	MAX1617_LOCAL_TEMP_REG		0
40*7c478bd9Sstevel@tonic-gate #define	MAX1617_REMOTE_TEMP_REG		1
41*7c478bd9Sstevel@tonic-gate #define	MAX1617_STATUS_REG		2
42*7c478bd9Sstevel@tonic-gate #define	MAX1617_CONFIG_REG		3
43*7c478bd9Sstevel@tonic-gate #define	MAX1617_CONV_RATE_REG		4
44*7c478bd9Sstevel@tonic-gate #define	MAX1617_LOCALTEMP_HIGH_REG	5
45*7c478bd9Sstevel@tonic-gate #define	MAX1617_LOCALTEMP_LOW_REG	6
46*7c478bd9Sstevel@tonic-gate #define	MAX1617_REMOTETEMP_HIGH_REG	7
47*7c478bd9Sstevel@tonic-gate #define	MAX1617_REMOTETEMP_LOW_REG	8
48*7c478bd9Sstevel@tonic-gate 
49*7c478bd9Sstevel@tonic-gate #define	MAX1617_CONFIG_WR_REG		9
50*7c478bd9Sstevel@tonic-gate #define	MAX1617_CONV_RATE_WR_REG	10
51*7c478bd9Sstevel@tonic-gate #define	MAX1617_LOCALTEMP_HIGH_WR_REG	11
52*7c478bd9Sstevel@tonic-gate #define	MAX1617_LOCALTEMP_LOW_WR_REG	12
53*7c478bd9Sstevel@tonic-gate #define	MAX1617_REMOTETEMP_HIGH_WR_REG	13
54*7c478bd9Sstevel@tonic-gate #define	MAX1617_REMOTETEMP_LOW_WR_REG	14
55*7c478bd9Sstevel@tonic-gate #define	MAX1617_ONE_SHOT_CMD_REG	15
56*7c478bd9Sstevel@tonic-gate 
57*7c478bd9Sstevel@tonic-gate #define	MAX1617_INST_TO_MINOR(x) (x << 4)
58*7c478bd9Sstevel@tonic-gate #define	MAX1617_MINOR_TO_INST(x) ((x & 0xFFFFFFF0) >> 4)
59*7c478bd9Sstevel@tonic-gate #define	MAX1617_FCN_TO_MINOR(x)  (x)
60*7c478bd9Sstevel@tonic-gate #define	MAX1617_MINOR_TO_FCN(x)  (0x0F & x)
61*7c478bd9Sstevel@tonic-gate #define	MAX1617_AMB_TEMP 0
62*7c478bd9Sstevel@tonic-gate #define	MAX1617_CPU_TEMP 1
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate #define	MAX1617_NODE_TYPE "ddi_i2c:temperature_sensor"
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate struct max1617_cpr_state {
67*7c478bd9Sstevel@tonic-gate 	uint8_t		max1617_config;
68*7c478bd9Sstevel@tonic-gate 	uint8_t		max1617_conv_rate;
69*7c478bd9Sstevel@tonic-gate 	int8_t		max1617_lcl_hlimit;
70*7c478bd9Sstevel@tonic-gate 	int8_t		max1617_lcl_llimit;
71*7c478bd9Sstevel@tonic-gate 	int8_t		max1617_remote_hlimit;
72*7c478bd9Sstevel@tonic-gate 	int8_t		max1617_remote_llimit;
73*7c478bd9Sstevel@tonic-gate };
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate struct max1617_unit {
76*7c478bd9Sstevel@tonic-gate 	kmutex_t	max1617_mutex;
77*7c478bd9Sstevel@tonic-gate 	uint8_t		max1617_flags;
78*7c478bd9Sstevel@tonic-gate 	kcondvar_t	max1617_cv;
79*7c478bd9Sstevel@tonic-gate 	uint16_t	max1617_oflag;
80*7c478bd9Sstevel@tonic-gate 	i2c_client_hdl_t	max1617_hdl;
81*7c478bd9Sstevel@tonic-gate 	char		max1617_name[24];
82*7c478bd9Sstevel@tonic-gate 	struct max1617_cpr_state max1617_cpr_state;
83*7c478bd9Sstevel@tonic-gate };
84*7c478bd9Sstevel@tonic-gate 
85*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
86*7c478bd9Sstevel@tonic-gate }
87*7c478bd9Sstevel@tonic-gate #endif
88*7c478bd9Sstevel@tonic-gate 
89*7c478bd9Sstevel@tonic-gate #endif	/* _MAX1617_IMPL_H */
90