linux/drivers/i2c/busses/i2c-diolan-u2c.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Driver for the Diolan u2c-12 USB-I2C adapter
 *
 * Copyright (c) 2010-2011 Ericsson AB
 *
 * Derived from:
 *  i2c-tiny-usb.c
 *  Copyright (C) 2006-2007 Till Harbaum ([email protected])
 */

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

#define DRIVER_NAME

#define USB_VENDOR_ID_DIOLAN
#define USB_DEVICE_ID_DIOLAN_U2C


/* commands via USB, must match command ids in the firmware */
#define CMD_I2C_READ
#define CMD_I2C_WRITE
#define CMD_I2C_SCAN
#define CMD_I2C_RELEASE_SDA
#define CMD_I2C_RELEASE_SCL
#define CMD_I2C_DROP_SDA
#define CMD_I2C_DROP_SCL
#define CMD_I2C_READ_SDA
#define CMD_I2C_READ_SCL
#define CMD_GET_FW_VERSION
#define CMD_GET_SERIAL
#define CMD_I2C_START
#define CMD_I2C_STOP
#define CMD_I2C_REPEATED_START
#define CMD_I2C_PUT_BYTE
#define CMD_I2C_GET_BYTE
#define CMD_I2C_PUT_ACK
#define CMD_I2C_GET_ACK
#define CMD_I2C_PUT_BYTE_ACK
#define CMD_I2C_GET_BYTE_ACK
#define CMD_I2C_SET_SPEED
#define CMD_I2C_GET_SPEED
#define CMD_I2C_SET_CLK_SYNC
#define CMD_I2C_GET_CLK_SYNC
#define CMD_I2C_SET_CLK_SYNC_TO
#define CMD_I2C_GET_CLK_SYNC_TO

#define RESP_OK
#define RESP_FAILED
#define RESP_BAD_MEMADDR
#define RESP_DATA_ERR
#define RESP_NOT_IMPLEMENTED
#define RESP_NACK
#define RESP_TIMEOUT

#define U2C_I2C_SPEED_FAST
#define U2C_I2C_SPEED_STD
#define U2C_I2C_SPEED_2KHZ
#define U2C_I2C_SPEED(f)

#define U2C_I2C_FREQ(s)

#define DIOLAN_USB_TIMEOUT
#define DIOLAN_SYNC_TIMEOUT

#define DIOLAN_OUTBUF_LEN
#define DIOLAN_FLUSH_LEN
#define DIOLAN_INBUF_LEN

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

static uint frequency =;	/* I2C clock frequency in Hz */

module_param(frequency, uint, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();

/* usb layer */

/* Send command to device, and get response. */
static int diolan_usb_transfer(struct i2c_diolan_u2c *dev)
{}

static int diolan_write_cmd(struct i2c_diolan_u2c *dev, bool flush)
{}

/* Send command (no data) */
static int diolan_usb_cmd(struct i2c_diolan_u2c *dev, u8 command, bool flush)
{}

/* Send command with one byte of data */
static int diolan_usb_cmd_data(struct i2c_diolan_u2c *dev, u8 command, u8 data,
			       bool flush)
{}

/* Send command with two bytes of data */
static int diolan_usb_cmd_data2(struct i2c_diolan_u2c *dev, u8 command, u8 d1,
				u8 d2, bool flush)
{}

/*
 * Flush input queue.
 * If we don't do this at startup and the controller has queued up
 * messages which were not retrieved, it will stop responding
 * at some point.
 */
static void diolan_flush_input(struct i2c_diolan_u2c *dev)
{}

static int diolan_i2c_start(struct i2c_diolan_u2c *dev)
{}

static int diolan_i2c_repeated_start(struct i2c_diolan_u2c *dev)
{}

static int diolan_i2c_stop(struct i2c_diolan_u2c *dev)
{}

static int diolan_i2c_get_byte_ack(struct i2c_diolan_u2c *dev, bool ack,
				   u8 *byte)
{}

static int diolan_i2c_put_byte_ack(struct i2c_diolan_u2c *dev, u8 byte)
{}

static int diolan_set_speed(struct i2c_diolan_u2c *dev, u8 speed)
{}

/* Enable or disable clock synchronization (stretching) */
static int diolan_set_clock_synch(struct i2c_diolan_u2c *dev, bool enable)
{}

/* Set clock synchronization timeout in ms */
static int diolan_set_clock_synch_timeout(struct i2c_diolan_u2c *dev, int ms)
{}

static void diolan_fw_version(struct i2c_diolan_u2c *dev)
{}

static void diolan_get_serial(struct i2c_diolan_u2c *dev)
{}

static int diolan_init(struct i2c_diolan_u2c *dev)
{}

/* i2c layer */

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

/*
 * Return list of supported functionality.
 */
static u32 diolan_usb_func(struct i2c_adapter *a)
{}

static const struct i2c_algorithm diolan_usb_algorithm =;

/* device layer */

static const struct usb_device_id diolan_u2c_table[] =;

MODULE_DEVICE_TABLE(usb, diolan_u2c_table);

static void diolan_u2c_free(struct i2c_diolan_u2c *dev)
{}

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

static void diolan_u2c_disconnect(struct usb_interface *interface)
{}

static struct usb_driver diolan_u2c_driver =;

module_usb_driver();

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