Home | History | Annotate | Line # | Download | only in i2c
      1 /*	$NetBSD: ds2482owvar.h,v 1.3 2024/11/06 19:42:25 riastradh Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2024 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_DS2482VAR_H_
     20 #define _DEV_I2C_DS2482VAR_H_
     21 
     22 #include <sys/types.h>
     23 
     24 #include <sys/device_if.h>
     25 #include <sys/mutex.h>
     26 
     27 #include <dev/i2c/i2cvar.h>
     28 #include <dev/onewire/onewirevar.h>
     29 
     30 #define DS2482_NUM_INSTANCES	8
     31 
     32 struct ds2482ow_sc;
     33 
     34 struct ds2482_instance {
     35 	int				sc_i_channel;
     36 	struct onewire_bus		sc_i_ow_bus;
     37 	device_t			sc_i_ow_dev;
     38 	struct ds2482ow_sc		*sc;
     39 };
     40 
     41 struct ds2482ow_sc {
     42 	int 		sc_ds2482debug;
     43 	device_t 	sc_dev;
     44 	i2c_tag_t 	sc_tag;
     45 	i2c_addr_t 	sc_addr;
     46 	kmutex_t 	sc_mutex;
     47 	struct sysctllog *sc_ds2482log;
     48 	bool		sc_activepullup;
     49 	bool		sc_strongpullup;
     50 	bool		sc_is_800;
     51 	struct		ds2482_instance	sc_instances[DS2482_NUM_INSTANCES];
     52 };
     53 
     54 #endif	/* _DEV_I2C_DS2482VAR_H_ */
     55