xref: /freebsd/sys/dev/iicbus/mux/iicmux_if.m (revision 031beb4e239bfce798af17f5fe8dba8bcaf13d99)
1*422d05daSIan Lepore#-
2*422d05daSIan Lepore# SPDX-License-Identifier: BSD-2-Clause
3*422d05daSIan Lepore#
4*422d05daSIan Lepore# Copyright (c) 2019 Ian Lepore <ian@freebsd.org>
5*422d05daSIan Lepore#
6*422d05daSIan Lepore# Redistribution and use in source and binary forms, with or without
7*422d05daSIan Lepore# modification, are permitted provided that the following conditions
8*422d05daSIan Lepore# are met:
9*422d05daSIan Lepore# 1. Redistributions of source code must retain the above copyright
10*422d05daSIan Lepore#    notice, this list of conditions and the following disclaimer.
11*422d05daSIan Lepore# 2. Redistributions in binary form must reproduce the above copyright
12*422d05daSIan Lepore#    notice, this list of conditions and the following disclaimer in the
13*422d05daSIan Lepore#    documentation and/or other materials provided with the distribution.
14*422d05daSIan Lepore#
15*422d05daSIan Lepore# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16*422d05daSIan Lepore# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17*422d05daSIan Lepore# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*422d05daSIan Lepore# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19*422d05daSIan Lepore# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20*422d05daSIan Lepore# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21*422d05daSIan Lepore# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22*422d05daSIan Lepore# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23*422d05daSIan Lepore# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24*422d05daSIan Lepore# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25*422d05daSIan Lepore# SUCH DAMAGE.
26*422d05daSIan Lepore#
27*422d05daSIan Lepore#
28*422d05daSIan Lepore
29*422d05daSIan Lepore#include <sys/bus.h>
30*422d05daSIan Lepore
31*422d05daSIan LeporeINTERFACE iicmux;
32*422d05daSIan Lepore
33*422d05daSIan LeporeHEADER {
34*422d05daSIan Lepore	struct iic_reqbus_data;
35*422d05daSIan Lepore}
36*422d05daSIan Lepore
37*422d05daSIan Lepore#
38*422d05daSIan Lepore# iicmux_bus_select(device_t dev, int busidx, struct iic_reqbus_data *rd)
39*422d05daSIan Lepore#  Do whatever the mux hardware requires to connect the downstream
40*422d05daSIan Lepore#  bus selected by busidx to the upstream bus.  This must return
41*422d05daSIan Lepore#  an IIC adapter-layer error code; standard errno values returned
42*422d05daSIan Lepore#  from this must be encoded using iic2errno().
43*422d05daSIan Lepore#
44*422d05daSIan LeporeMETHOD int bus_select {
45*422d05daSIan Lepore	device_t dev;
46*422d05daSIan Lepore	int busidx;
47*422d05daSIan Lepore	struct iic_reqbus_data *rd;
48*422d05daSIan Lepore};
49