Home | History | Annotate | Line # | Download | only in ic
      1 /*	$NetBSD: pcf8584var.h,v 1.10 2026/07/09 14:55:03 thorpej Exp $	*/
      2 /*	$OpenBSD: pcf8584var.h,v 1.5 2007/10/20 18:46:21 kettenis Exp $ */
      3 
      4 /*
      5  * Copyright (c) 2006 David Gwynne <dlg (at) openbsd.org>
      6  *
      7  * Permission to use, copy, modify, and distribute this software for any
      8  * purpose with or without fee is hereby granted, provided that the above
      9  * copyright notice and this permission notice appear in all copies.
     10  *
     11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     18  */
     19 
     20 #ifndef _DEV_IC_PCF8584VAR_H_
     21 #define	_DEV_IC_PCF8584VAR_H_
     22 
     23 struct pcfiic_softc {
     24 	device_t		sc_dev;
     25 
     26 	bus_space_tag_t		sc_iot;
     27 	bus_space_handle_t	sc_ioh;
     28 	bus_space_handle_t	sc_mux_ioh;
     29 	u_int8_t		sc_addr;
     30 	u_int8_t		sc_clock;
     31 	u_int8_t		sc_regmap[2];
     32 
     33 	bool			sc_has_mux;
     34 	bool			sc_poll;
     35 
     36 	int			sc_delay;
     37 
     38 	struct i2c_controller	sc_i2c;
     39 };
     40 
     41 /*
     42  * The PCF8584 has only a single address input pin.  These are
     43  * indices into the sc_regmap[] that contain the offsets from
     44  * the base io handle needed to drive that pin according to the
     45  * desired register access.
     46  */
     47 #define	PCF8584_S0		0
     48 #define	PCF8584_S1		1
     49 
     50 void	pcfiic_attach(struct pcfiic_softc *, i2c_addr_t, u_int8_t);
     51 int	pcfiic_intr(void *);
     52 
     53 #endif /* _DEV_IC_PCF8584VAR_H_ */
     54