linux/drivers/i2c/busses/i2c-cp2615.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * i2c support for Silicon Labs' CP2615 Digital Audio Bridge
 *
 * (c) 2021, Bence Csókás <[email protected]>
 */

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

/** CP2615 I/O Protocol implementation */

#define CP2615_VID
#define CP2615_PID

#define IOP_EP_IN
#define IOP_EP_OUT
#define IOP_IFN
#define IOP_ALTSETTING

#define MAX_IOP_SIZE
#define MAX_IOP_PAYLOAD_SIZE
#define MAX_I2C_SIZE

enum cp2615_iop_msg_type {};

struct __packed cp2615_iop_msg {};

#define PART_ID_A01
#define PART_ID_A02

struct __packed cp2615_iop_accessory_info {};

struct __packed cp2615_i2c_transfer {};

/* Possible values for struct cp2615_i2c_transfer_result.status */
enum cp2615_i2c_status {};

struct __packed cp2615_i2c_transfer_result {};

static int cp2615_init_iop_msg(struct cp2615_iop_msg *ret, enum cp2615_iop_msg_type msg,
			const void *data, size_t data_len)
{}

static int cp2615_init_i2c_msg(struct cp2615_iop_msg *ret, const struct cp2615_i2c_transfer *data)
{}

/* Translates status codes to Linux errno's */
static int cp2615_check_status(enum cp2615_i2c_status status)
{}

/** Driver code */

static int
cp2615_i2c_send(struct usb_interface *usbif, struct cp2615_i2c_transfer *i2c_w)
{}

static int
cp2615_i2c_recv(struct usb_interface *usbif, unsigned char tag, void *buf)
{}

/* Checks if the IOP is functional by querying the part's ID */
static int cp2615_check_iop(struct usb_interface *usbif)
{}

static int
cp2615_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
{}

static u32
cp2615_i2c_func(struct i2c_adapter *adap)
{}

static const struct i2c_algorithm cp2615_i2c_algo =;

/*
 * This chip has some limitations: one is that the USB endpoint
 * can only receive 64 bytes/transfer, that leaves 54 bytes for
 * the I2C transfer. On top of that, EITHER read_len OR write_len
 * may be zero, but not both. If both are non-zero, the adapter
 * issues a write followed by a read. And the chip does not
 * support repeated START between the write and read phases.
 */
static struct i2c_adapter_quirks cp2615_i2c_quirks =;

static void
cp2615_i2c_remove(struct usb_interface *usbif)
{}

static int
cp2615_i2c_probe(struct usb_interface *usbif, const struct usb_device_id *id)
{}

static const struct usb_device_id id_table[] =;

MODULE_DEVICE_TABLE(usb, id_table);

static struct usb_driver cp2615_i2c_driver =;

module_usb_driver();

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