linux/drivers/i2c/busses/i2c-tiny-usb.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * driver for the i2c-tiny-usb adapter - 1.0
 * http://www.harbaum.org/till/i2c_tiny_usb
 *
 * Copyright (C) 2006-2007 Till Harbaum ([email protected])
 */

#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/types.h>

/* include interfaces to usb layer */
#include <linux/usb.h>

/* include interface to i2c layer */
#include <linux/i2c.h>

/* commands via USB, must match command ids in the firmware */
#define CMD_ECHO
#define CMD_GET_FUNC
#define CMD_SET_DELAY
#define CMD_GET_STATUS

#define CMD_I2C_IO
#define CMD_I2C_IO_BEGIN
#define CMD_I2C_IO_END

/* i2c bit delay, default is 10us -> 100kHz max
   (in practice, due to additional delays in the i2c bitbanging
   code this results in a i2c clock of about 50kHz) */
static unsigned short delay =;
module_param(delay, ushort, 0);
MODULE_PARM_DESC();

static int usb_read(struct i2c_adapter *adapter, int cmd,
		    int value, int index, void *data, int len);

static int usb_write(struct i2c_adapter *adapter, int cmd,
		     int value, int index, void *data, int len);

/* ----- begin of i2c layer ---------------------------------------------- */

#define STATUS_IDLE
#define STATUS_ADDRESS_ACK
#define STATUS_ADDRESS_NAK

static int usb_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
{}

static u32 usb_func(struct i2c_adapter *adapter)
{}

/* This is the actual algorithm we define */
static const struct i2c_algorithm usb_algorithm =;

/* ----- end of i2c layer ------------------------------------------------ */

/* ----- begin of usb layer ---------------------------------------------- */

/*
 * Initially the usb i2c interface uses a vid/pid pair donated by
 * Future Technology Devices International Ltd., later a pair was
 * bought from EZPrototypes
 */
static const struct usb_device_id i2c_tiny_usb_table[] =;

MODULE_DEVICE_TABLE(usb, i2c_tiny_usb_table);

/* Structure to hold all of our device specific stuff */
struct i2c_tiny_usb {};

static int usb_read(struct i2c_adapter *adapter, int cmd,
		    int value, int index, void *data, int len)
{}

static int usb_write(struct i2c_adapter *adapter, int cmd,
		     int value, int index, void *data, int len)
{}

static void i2c_tiny_usb_free(struct i2c_tiny_usb *dev)
{}

static int i2c_tiny_usb_probe(struct usb_interface *interface,
			      const struct usb_device_id *id)
{}

static void i2c_tiny_usb_disconnect(struct usb_interface *interface)
{}

static struct usb_driver i2c_tiny_usb_driver =;

module_usb_driver();

/* ----- end of usb layer ------------------------------------------------ */

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