linux/drivers/i2c/algos/i2c-algo-bit.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * i2c-algo-bit.c: i2c driver algorithms for bit-shift adapters
 *
 *   Copyright (C) 1995-2000 Simon G. Vogl
 *
 * With some changes from Frodo Looijaard <[email protected]>, Kyösti Mälkki
 * <[email protected]> and Jean Delvare <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>


/* ----- global defines ----------------------------------------------- */

#ifdef DEBUG
#define bit_dbg(level, dev, format, args...)
#else
#define bit_dbg
#endif /* DEBUG */

/* ----- global variables ---------------------------------------------	*/

static int bit_test;	/* see if the line-setting functions work	*/
module_param(bit_test, int, S_IRUGO);
MODULE_PARM_DESC();

#ifdef DEBUG
static int i2c_debug =;
module_param(i2c_debug, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
#endif

/* --- setting states on the bus with the right timing: ---------------	*/

#define setsda(adap, val)
#define setscl(adap, val)
#define getsda(adap)
#define getscl(adap)

static inline void sdalo(struct i2c_algo_bit_data *adap)
{}

static inline void sdahi(struct i2c_algo_bit_data *adap)
{}

static inline void scllo(struct i2c_algo_bit_data *adap)
{}

/*
 * Raise scl line, and do checking for delays. This is necessary for slower
 * devices.
 */
static int sclhi(struct i2c_algo_bit_data *adap)
{}


/* --- other auxiliary functions --------------------------------------	*/
static void i2c_start(struct i2c_algo_bit_data *adap)
{}

static void i2c_repstart(struct i2c_algo_bit_data *adap)
{}


static void i2c_stop(struct i2c_algo_bit_data *adap)
{}



/* send a byte without start cond., look for arbitration,
   check ackn. from slave */
/* returns:
 * 1 if the device acknowledged
 * 0 if the device did not ack
 * -ETIMEDOUT if an error occurred (while raising the scl line)
 */
static int i2c_outb(struct i2c_adapter *i2c_adap, unsigned char c)
{}


static int i2c_inb(struct i2c_adapter *i2c_adap)
{}

/*
 * Sanity check for the adapter hardware - check the reaction of
 * the bus lines only if it seems to be idle.
 */
static int test_bus(struct i2c_adapter *i2c_adap)
{}

/* ----- Utility functions
 */

/* try_address tries to contact a chip for a number of
 * times before it gives up.
 * return values:
 * 1 chip answered
 * 0 chip did not answer
 * -x transmission error
 */
static int try_address(struct i2c_adapter *i2c_adap,
		       unsigned char addr, int retries)
{}

static int sendbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
{}

static int acknak(struct i2c_adapter *i2c_adap, int is_ack)
{}

static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
{}

/* doAddress initiates the transfer by generating the start condition (in
 * try_address) and transmits the address in the necessary format to handle
 * reads, writes as well as 10bit-addresses.
 * returns:
 *  0 everything went okay, the chip ack'ed, or IGNORE_NAK flag was set
 * -x an error occurred (like: -ENXIO if the device did not answer, or
 *	-ETIMEDOUT, for example if the lines are stuck...)
 */
static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
{}

static int bit_xfer(struct i2c_adapter *i2c_adap,
		    struct i2c_msg msgs[], int num)
{}

/*
 * We print a warning when we are not flagged to support atomic transfers but
 * will try anyhow. That's what the I2C core would do as well. Sadly, we can't
 * modify the algorithm struct at probe time because this struct is exported
 * 'const'.
 */
static int bit_xfer_atomic(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[],
			   int num)
{}

static u32 bit_func(struct i2c_adapter *adap)
{}


/* -----exported algorithm data: -------------------------------------	*/

const struct i2c_algorithm i2c_bit_algo =;
EXPORT_SYMBOL();

static const struct i2c_adapter_quirks i2c_bit_quirk_no_clk_stretch =;

/*
 * registering functions to load algorithms at runtime
 */
static int __i2c_bit_add_bus(struct i2c_adapter *adap,
			     int (*add_adapter)(struct i2c_adapter *))
{}

int i2c_bit_add_bus(struct i2c_adapter *adap)
{}
EXPORT_SYMBOL();

int i2c_bit_add_numbered_bus(struct i2c_adapter *adap)
{}
EXPORT_SYMBOL();

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