/* * Copyright 2015 Red Hat Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Ben Skeggs <[email protected]> */ #include "bus.h" #include "pad.h" #include <core/option.h> /******************************************************************************* * i2c-algo-bit ******************************************************************************/ static int nvkm_i2c_bus_pre_xfer(struct i2c_adapter *adap) { … } static void nvkm_i2c_bus_post_xfer(struct i2c_adapter *adap) { … } static void nvkm_i2c_bus_setscl(void *data, int state) { … } static void nvkm_i2c_bus_setsda(void *data, int state) { … } static int nvkm_i2c_bus_getscl(void *data) { … } static int nvkm_i2c_bus_getsda(void *data) { … } /******************************************************************************* * !i2c-algo-bit (off-chip i2c bus / hw i2c / internal bit-banging algo) ******************************************************************************/ static int nvkm_i2c_bus_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) { … } static u32 nvkm_i2c_bus_func(struct i2c_adapter *adap) { … } static const struct i2c_algorithm nvkm_i2c_bus_algo = …; /******************************************************************************* * nvkm_i2c_bus base ******************************************************************************/ void nvkm_i2c_bus_init(struct nvkm_i2c_bus *bus) { … } void nvkm_i2c_bus_fini(struct nvkm_i2c_bus *bus) { … } void nvkm_i2c_bus_release(struct nvkm_i2c_bus *bus) { … } int nvkm_i2c_bus_acquire(struct nvkm_i2c_bus *bus) { … } int nvkm_i2c_bus_probe(struct nvkm_i2c_bus *bus, const char *what, struct nvkm_i2c_bus_probe *info, bool (*match)(struct nvkm_i2c_bus *, struct i2c_board_info *, void *), void *data) { … } void nvkm_i2c_bus_del(struct nvkm_i2c_bus **pbus) { … } int nvkm_i2c_bus_ctor(const struct nvkm_i2c_bus_func *func, struct nvkm_i2c_pad *pad, int id, struct nvkm_i2c_bus *bus) { … } int nvkm_i2c_bus_new_(const struct nvkm_i2c_bus_func *func, struct nvkm_i2c_pad *pad, int id, struct nvkm_i2c_bus **pbus) { … }