linux/drivers/i2c/i2c-stub.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
    i2c-stub.c - I2C/SMBus chip emulator

    Copyright (c) 2004 Mark M. Hoffman <[email protected]>
    Copyright (C) 2007-2014 Jean Delvare <[email protected]>

*/

#define pr_fmt(fmt)

#include <linux/errno.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/slab.h>

#define MAX_CHIPS

/*
 * Support for I2C_FUNC_SMBUS_BLOCK_DATA is disabled by default and must
 * be enabled explicitly by setting the I2C_FUNC_SMBUS_BLOCK_DATA bits
 * in the 'functionality' module parameter.
 */
#define STUB_FUNC_DEFAULT

#define STUB_FUNC_ALL

static unsigned short chip_addr[MAX_CHIPS];
module_param_array();
MODULE_PARM_DESC();

static unsigned long functionality =;
module_param(functionality, ulong, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();

/* Some chips have banked register ranges */

static u8 bank_reg[MAX_CHIPS];
module_param_array();
MODULE_PARM_DESC();

static u8 bank_mask[MAX_CHIPS];
module_param_array();
MODULE_PARM_DESC();

static u8 bank_start[MAX_CHIPS];
module_param_array();
MODULE_PARM_DESC();

static u8 bank_end[MAX_CHIPS];
module_param_array();
MODULE_PARM_DESC();

struct smbus_block_data {};

struct stub_chip {};

static struct stub_chip *stub_chips;
static int stub_chips_nr;

static struct smbus_block_data *stub_find_block(struct device *dev,
						struct stub_chip *chip,
						u8 command, bool create)
{}

static u16 *stub_get_wordp(struct stub_chip *chip, u8 offset)
{}

/* Return negative errno on error. */
static s32 stub_xfer(struct i2c_adapter *adap, u16 addr, unsigned short flags,
	char read_write, u8 command, int size, union i2c_smbus_data *data)
{}

static u32 stub_func(struct i2c_adapter *adapter)
{}

static const struct i2c_algorithm smbus_algorithm =;

static struct i2c_adapter stub_adapter =;

static int __init i2c_stub_allocate_banks(int i)
{}

static void i2c_stub_free(void)
{}

static int __init i2c_stub_init(void)
{}

static void __exit i2c_stub_exit(void)
{}

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

module_init(i2c_stub_init);
module_exit(i2c_stub_exit);