1/*	$NetBSD: si70xxvar.h,v 1.3 2021/11/11 14:16:04 brad Exp $	*/
2
3/*
4 * Copyright (c) 2017 Brad Spencer <brad@anduin.eldar.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#ifndef _DEV_I2C_SI70XXVAR_H_
20#define _DEV_I2C_SI70XXVAR_H_
21
22#define SI70XX_NUM_SENSORS	2
23#define SI70XX_HUMIDITY_SENSOR 0
24#define SI70XX_TEMP_SENSOR 1
25
26#define SI70XX_RES_NAME 12
27
28struct si70xx_sc {
29	int 		sc_si70xxdebug;
30	device_t 	sc_dev;
31	i2c_tag_t 	sc_tag;
32	i2c_addr_t 	sc_addr;
33	kmutex_t 	sc_mutex;
34	int 		sc_numsensors;
35	struct sysmon_envsys *sc_sme;
36	envsys_data_t 	sc_sensors[SI70XX_NUM_SENSORS];
37	struct sysctllog *sc_si70xxlog;
38	char 		sc_resolution[SI70XX_RES_NAME];
39	int 		sc_resnumber;
40	bool 		sc_ignorecrc;
41	bool 		sc_vddok;
42	bool 		sc_heateron;
43	int 		sc_heaterval;
44#ifdef HAVE_I2C_EXECV
45	uint32_t 	sc_clockstretch;
46#endif
47	int 		sc_readattempts;
48	bool		sc_noheater;
49	bool		sc_nofw;
50};
51
52struct si70xx_sensor {
53	const char     *desc;
54	enum envsys_units type;
55};
56
57struct si70xx_resolution {
58	const char     *text;
59	int 		num;
60};
61
62#endif
63