Home | History | Annotate | Line # | Download | only in i2c
      1 /*	$NetBSD: si70xxvar.h,v 1.4 2025/01/23 19:13:19 brad Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2017 Brad Spencer <brad (at) 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 
     28 struct 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 	bool	 	sc_clockstretch;
     45 	int 		sc_readattempts;
     46 	bool		sc_noheater;
     47 	bool		sc_nofw;
     48 };
     49 
     50 struct si70xx_sensor {
     51 	const char     *desc;
     52 	enum envsys_units type;
     53 };
     54 
     55 struct si70xx_resolution {
     56 	const char     *text;
     57 	int 		num;
     58 };
     59 
     60 #endif
     61