xref: /netbsd-src/sys/dev/i2c/i2c_subr.c (revision 7694d689116a4c726a4530c72ecf2f180b3cf117)
1*7694d689Spgoyette /*	$NetBSD: i2c_subr.c,v 1.2 2022/04/01 15:49:12 pgoyette Exp $	*/
25a065f00Sjmcneill 
35a065f00Sjmcneill /*
45a065f00Sjmcneill  * Copyright (c) 2003 Wasabi Systems, Inc.
55a065f00Sjmcneill  * All rights reserved.
65a065f00Sjmcneill  *
75a065f00Sjmcneill  * Written by Jason R. Thorpe for Wasabi Systems, Inc.
85a065f00Sjmcneill  *
95a065f00Sjmcneill  * Redistribution and use in source and binary forms, with or without
105a065f00Sjmcneill  * modification, are permitted provided that the following conditions
115a065f00Sjmcneill  * are met:
125a065f00Sjmcneill  * 1. Redistributions of source code must retain the above copyright
135a065f00Sjmcneill  *    notice, this list of conditions and the following disclaimer.
145a065f00Sjmcneill  * 2. Redistributions in binary form must reproduce the above copyright
155a065f00Sjmcneill  *    notice, this list of conditions and the following disclaimer in the
165a065f00Sjmcneill  *    documentation and/or other materials provided with the distribution.
175a065f00Sjmcneill  * 3. All advertising materials mentioning features or use of this software
185a065f00Sjmcneill  *    must display the following acknowledgement:
195a065f00Sjmcneill  *      This product includes software developed for the NetBSD Project by
205a065f00Sjmcneill  *      Wasabi Systems, Inc.
215a065f00Sjmcneill  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
225a065f00Sjmcneill  *    or promote products derived from this software without specific prior
235a065f00Sjmcneill  *    written permission.
245a065f00Sjmcneill  *
255a065f00Sjmcneill  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
265a065f00Sjmcneill  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
275a065f00Sjmcneill  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
285a065f00Sjmcneill  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
295a065f00Sjmcneill  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
305a065f00Sjmcneill  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
315a065f00Sjmcneill  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
325a065f00Sjmcneill  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
335a065f00Sjmcneill  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
345a065f00Sjmcneill  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
355a065f00Sjmcneill  * POSSIBILITY OF SUCH DAMAGE.
365a065f00Sjmcneill  */
375a065f00Sjmcneill 
385a065f00Sjmcneill #include <sys/cdefs.h>
39*7694d689Spgoyette __KERNEL_RCSID(0, "$NetBSD: i2c_subr.c,v 1.2 2022/04/01 15:49:12 pgoyette Exp $");
405a065f00Sjmcneill 
415a065f00Sjmcneill #include <sys/param.h>
425a065f00Sjmcneill #include <sys/device.h>
43*7694d689Spgoyette #include <sys/module.h>
445a065f00Sjmcneill 
455a065f00Sjmcneill #include <dev/i2c/i2cvar.h>
465a065f00Sjmcneill 
47*7694d689Spgoyette MODULE(MODULE_CLASS_EXEC, i2c_subr, NULL);
48*7694d689Spgoyette 
49*7694d689Spgoyette static int
i2c_subr_modcmd(modcmd_t cmd,void * opaque)50*7694d689Spgoyette i2c_subr_modcmd(modcmd_t cmd, void *opaque)
51*7694d689Spgoyette {
52*7694d689Spgoyette 
53*7694d689Spgoyette 	switch (cmd) {
54*7694d689Spgoyette 	case MODULE_CMD_INIT:
55*7694d689Spgoyette 	case MODULE_CMD_FINI:
56*7694d689Spgoyette 		return 0;
57*7694d689Spgoyette 	default:
58*7694d689Spgoyette 		return ENOTTY;
59*7694d689Spgoyette 	}
60*7694d689Spgoyette }
61*7694d689Spgoyette 
625a065f00Sjmcneill int
iicbus_print(void * aux,const char * pnp)635a065f00Sjmcneill iicbus_print(void *aux, const char *pnp)
645a065f00Sjmcneill {
655a065f00Sjmcneill 
665a065f00Sjmcneill 	if (pnp != NULL)
675a065f00Sjmcneill 		aprint_normal("iic at %s", pnp);
685a065f00Sjmcneill 
695a065f00Sjmcneill 	return UNCONF;
705a065f00Sjmcneill }
71