summaryrefslogtreecommitdiff
path: root/usr/src/uts/sun4u/sys/i2c/clients/max1617_impl.h
blob: 4c759fbdb9ef9e238e77b787ab915bd804f9a6cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
 * All rights reserved.
 */

#ifndef	_MAX1617_IMPL_H
#define	_MAX1617_IMPL_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef	__cplusplus
extern "C" {
#endif

#define	MAX1617_BUSY	0x01

#define	MAX1617_MAX_REGS		16
#define	MAX1617_LOCAL_TEMP_REG		0
#define	MAX1617_REMOTE_TEMP_REG		1
#define	MAX1617_STATUS_REG		2
#define	MAX1617_CONFIG_REG		3
#define	MAX1617_CONV_RATE_REG		4
#define	MAX1617_LOCALTEMP_HIGH_REG	5
#define	MAX1617_LOCALTEMP_LOW_REG	6
#define	MAX1617_REMOTETEMP_HIGH_REG	7
#define	MAX1617_REMOTETEMP_LOW_REG	8

#define	MAX1617_CONFIG_WR_REG		9
#define	MAX1617_CONV_RATE_WR_REG	10
#define	MAX1617_LOCALTEMP_HIGH_WR_REG	11
#define	MAX1617_LOCALTEMP_LOW_WR_REG	12
#define	MAX1617_REMOTETEMP_HIGH_WR_REG	13
#define	MAX1617_REMOTETEMP_LOW_WR_REG	14
#define	MAX1617_ONE_SHOT_CMD_REG	15

#define	MAX1617_INST_TO_MINOR(x) (x << 4)
#define	MAX1617_MINOR_TO_INST(x) ((x & 0xFFFFFFF0) >> 4)
#define	MAX1617_FCN_TO_MINOR(x)  (x)
#define	MAX1617_MINOR_TO_FCN(x)  (0x0F & x)
#define	MAX1617_AMB_TEMP 0
#define	MAX1617_CPU_TEMP 1

#define	MAX1617_NODE_TYPE "ddi_i2c:temperature_sensor"

struct max1617_cpr_state {
	uint8_t		max1617_config;
	uint8_t		max1617_conv_rate;
	int8_t		max1617_lcl_hlimit;
	int8_t		max1617_lcl_llimit;
	int8_t		max1617_remote_hlimit;
	int8_t		max1617_remote_llimit;
};

struct max1617_unit {
	kmutex_t	max1617_mutex;
	uint8_t		max1617_flags;
	kcondvar_t	max1617_cv;
	uint16_t	max1617_oflag;
	i2c_client_hdl_t	max1617_hdl;
	char		max1617_name[24];
	struct max1617_cpr_state max1617_cpr_state;
};

#ifdef	__cplusplus
}
#endif

#endif	/* _MAX1617_IMPL_H */