#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/i2c.h>
#include <linux/i2c-smbus.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#define XLP9XX_I2C_DIV …
#define XLP9XX_I2C_CTRL …
#define XLP9XX_I2C_CMD …
#define XLP9XX_I2C_STATUS …
#define XLP9XX_I2C_MTXFIFO …
#define XLP9XX_I2C_MRXFIFO …
#define XLP9XX_I2C_MFIFOCTRL …
#define XLP9XX_I2C_STXFIFO …
#define XLP9XX_I2C_SRXFIFO …
#define XLP9XX_I2C_SFIFOCTRL …
#define XLP9XX_I2C_SLAVEADDR …
#define XLP9XX_I2C_OWNADDR …
#define XLP9XX_I2C_FIFOWCNT …
#define XLP9XX_I2C_INTEN …
#define XLP9XX_I2C_INTST …
#define XLP9XX_I2C_WAITCNT …
#define XLP9XX_I2C_TIMEOUT …
#define XLP9XX_I2C_GENCALLADDR …
#define XLP9XX_I2C_STATUS_BUSY …
#define XLP9XX_I2C_CMD_START …
#define XLP9XX_I2C_CMD_STOP …
#define XLP9XX_I2C_CMD_READ …
#define XLP9XX_I2C_CMD_WRITE …
#define XLP9XX_I2C_CMD_ACK …
#define XLP9XX_I2C_CTRL_MCTLEN_SHIFT …
#define XLP9XX_I2C_CTRL_MCTLEN_MASK …
#define XLP9XX_I2C_CTRL_RST …
#define XLP9XX_I2C_CTRL_EN …
#define XLP9XX_I2C_CTRL_MASTER …
#define XLP9XX_I2C_CTRL_FIFORD …
#define XLP9XX_I2C_CTRL_ADDMODE …
#define XLP9XX_I2C_INTEN_NACKADDR …
#define XLP9XX_I2C_INTEN_SADDR …
#define XLP9XX_I2C_INTEN_DATADONE …
#define XLP9XX_I2C_INTEN_ARLOST …
#define XLP9XX_I2C_INTEN_MFIFOFULL …
#define XLP9XX_I2C_INTEN_MFIFOEMTY …
#define XLP9XX_I2C_INTEN_MFIFOHI …
#define XLP9XX_I2C_INTEN_BUSERR …
#define XLP9XX_I2C_MFIFOCTRL_HITH_SHIFT …
#define XLP9XX_I2C_MFIFOCTRL_LOTH_SHIFT …
#define XLP9XX_I2C_MFIFOCTRL_RST …
#define XLP9XX_I2C_SLAVEADDR_RW …
#define XLP9XX_I2C_SLAVEADDR_ADDR_SHIFT …
#define XLP9XX_I2C_IP_CLK_FREQ …
#define XLP9XX_I2C_FIFO_SIZE …
#define XLP9XX_I2C_TIMEOUT_MS …
#define XLP9XX_I2C_BUSY_TIMEOUT …
#define XLP9XX_I2C_FIFO_WCNT_MASK …
#define XLP9XX_I2C_STATUS_ERRMASK …
struct xlp9xx_i2c_dev { … };
static inline void xlp9xx_write_i2c_reg(struct xlp9xx_i2c_dev *priv,
unsigned long reg, u32 val)
{ … }
static inline u32 xlp9xx_read_i2c_reg(struct xlp9xx_i2c_dev *priv,
unsigned long reg)
{ … }
static void xlp9xx_i2c_mask_irq(struct xlp9xx_i2c_dev *priv, u32 mask)
{ … }
static void xlp9xx_i2c_unmask_irq(struct xlp9xx_i2c_dev *priv, u32 mask)
{ … }
static void xlp9xx_i2c_update_rx_fifo_thres(struct xlp9xx_i2c_dev *priv)
{ … }
static void xlp9xx_i2c_fill_tx_fifo(struct xlp9xx_i2c_dev *priv)
{ … }
static void xlp9xx_i2c_update_rlen(struct xlp9xx_i2c_dev *priv)
{ … }
static void xlp9xx_i2c_drain_rx_fifo(struct xlp9xx_i2c_dev *priv)
{ … }
static irqreturn_t xlp9xx_i2c_isr(int irq, void *dev_id)
{ … }
static int xlp9xx_i2c_check_bus_status(struct xlp9xx_i2c_dev *priv)
{ … }
static int xlp9xx_i2c_init(struct xlp9xx_i2c_dev *priv)
{ … }
static int xlp9xx_i2c_xfer_msg(struct xlp9xx_i2c_dev *priv, struct i2c_msg *msg,
int last_msg)
{ … }
static int xlp9xx_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
int num)
{ … }
static u32 xlp9xx_i2c_functionality(struct i2c_adapter *adapter)
{ … }
static const struct i2c_algorithm xlp9xx_i2c_algo = …;
static int xlp9xx_i2c_get_frequency(struct platform_device *pdev,
struct xlp9xx_i2c_dev *priv)
{ … }
static int xlp9xx_i2c_smbus_setup(struct xlp9xx_i2c_dev *priv,
struct platform_device *pdev)
{ … }
static int xlp9xx_i2c_probe(struct platform_device *pdev)
{ … }
static void xlp9xx_i2c_remove(struct platform_device *pdev)
{ … }
#ifdef CONFIG_ACPI
static const struct acpi_device_id xlp9xx_i2c_acpi_ids[] = …;
MODULE_DEVICE_TABLE(acpi, xlp9xx_i2c_acpi_ids);
#endif
static struct platform_driver xlp9xx_i2c_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;