#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 …
#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 …
struct i2c_diolan_u2c { … };
static uint frequency = …;
module_param(frequency, uint, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(…) …;
static int diolan_usb_transfer(struct i2c_diolan_u2c *dev)
{ … }
static int diolan_write_cmd(struct i2c_diolan_u2c *dev, bool flush)
{ … }
static int diolan_usb_cmd(struct i2c_diolan_u2c *dev, u8 command, bool flush)
{ … }
static int diolan_usb_cmd_data(struct i2c_diolan_u2c *dev, u8 command, u8 data,
bool flush)
{ … }
static int diolan_usb_cmd_data2(struct i2c_diolan_u2c *dev, u8 command, u8 d1,
u8 d2, bool flush)
{ … }
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)
{ … }
static int diolan_set_clock_synch(struct i2c_diolan_u2c *dev, bool enable)
{ … }
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)
{ … }
static int diolan_usb_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,
int num)
{ … }
static u32 diolan_usb_func(struct i2c_adapter *a)
{ … }
static const struct i2c_algorithm diolan_usb_algorithm = …;
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(…) …;