#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/i2c.h>
#include <linux/fs.h>
#include <linux/io.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/jiffies.h>
#include <linux/pci.h>
#include <linux/mutex.h>
#include <linux/ktime.h>
#include <linux/slab.h>
#define PCH_EVENT_SET …
#define PCH_EVENT_NONE …
#define PCH_MAX_CLK …
#define PCH_BUFFER_MODE_ENABLE …
#define PCH_EEPROM_SW_RST_MODE_ENABLE …
#define PCH_I2CSADR …
#define PCH_I2CCTL …
#define PCH_I2CSR …
#define PCH_I2CDR …
#define PCH_I2CMON …
#define PCH_I2CBC …
#define PCH_I2CMOD …
#define PCH_I2CBUFSLV …
#define PCH_I2CBUFSUB …
#define PCH_I2CBUFFOR …
#define PCH_I2CBUFCTL …
#define PCH_I2CBUFMSK …
#define PCH_I2CBUFSTA …
#define PCH_I2CBUFLEV …
#define PCH_I2CESRFOR …
#define PCH_I2CESRCTL …
#define PCH_I2CESRMSK …
#define PCH_I2CESRSTA …
#define PCH_I2CTMR …
#define PCH_I2CSRST …
#define PCH_I2CNF …
#define BUS_IDLE_TIMEOUT …
#define PCH_I2CCTL_I2CMEN …
#define TEN_BIT_ADDR_DEFAULT …
#define TEN_BIT_ADDR_MASK …
#define PCH_START …
#define PCH_RESTART …
#define PCH_ESR_START …
#define PCH_BUFF_START …
#define PCH_REPSTART …
#define PCH_ACK …
#define PCH_GETACK …
#define CLR_REG …
#define I2C_RD …
#define I2CMCF_BIT …
#define I2CMIF_BIT …
#define I2CMAL_BIT …
#define I2CBMFI_BIT …
#define I2CBMAL_BIT …
#define I2CBMNA_BIT …
#define I2CBMTO_BIT …
#define I2CBMIS_BIT …
#define I2CESRFI_BIT …
#define I2CESRTO_BIT …
#define I2CESRFIIE_BIT …
#define I2CESRTOIE_BIT …
#define I2CBMDZ_BIT …
#define I2CBMAG_BIT …
#define I2CMBB_BIT …
#define BUFFER_MODE_MASK …
#define I2C_ADDR_MSK …
#define I2C_MSB_2B_MSK …
#define FAST_MODE_CLK …
#define FAST_MODE_EN …
#define SUB_ADDR_LEN_MAX …
#define BUF_LEN_MAX …
#define PCH_BUFFER_MODE …
#define EEPROM_SW_RST_MODE …
#define NORMAL_INTR_ENBL …
#define EEPROM_RST_INTR_ENBL …
#define EEPROM_RST_INTR_DISBL …
#define BUFFER_MODE_INTR_ENBL …
#define BUFFER_MODE_INTR_DISBL …
#define NORMAL_MODE …
#define BUFFER_MODE …
#define EEPROM_SR_MODE …
#define I2C_TX_MODE …
#define PCH_BUF_TX …
#define PCH_BUF_RD …
#define I2C_ERROR_MASK …
#define I2CMAL_EVENT …
#define I2CMCF_EVENT …
#define I2CBMFI_EVENT …
#define I2CBMAL_EVENT …
#define I2CBMNA_EVENT …
#define I2CBMTO_EVENT …
#define I2CBMIS_EVENT …
#define I2CESRFI_EVENT …
#define I2CESRTO_EVENT …
#define PCI_DEVICE_ID_PCH_I2C …
#define pch_dbg(adap, fmt, arg...) …
#define pch_err(adap, fmt, arg...) …
#define pch_pci_err(pdev, fmt, arg...) …
#define pch_pci_dbg(pdev, fmt, arg...) …
#define PCH_I2C_MAX_DEV …
struct i2c_algo_pch_data { … };
struct adapter_info { … };
static int pch_i2c_speed = …;
static int pch_clk = …;
static wait_queue_head_t pch_event;
static DEFINE_MUTEX(pch_mutex);
#define PCI_DEVICE_ID_ML7213_I2C …
#define PCI_DEVICE_ID_ML7223_I2C …
#define PCI_DEVICE_ID_ML7831_I2C …
static const struct pci_device_id pch_pcidev_id[] = …;
MODULE_DEVICE_TABLE(pci, pch_pcidev_id);
static irqreturn_t pch_i2c_handler(int irq, void *pData);
static inline void pch_setbit(void __iomem *addr, u32 offset, u32 bitmask)
{ … }
static inline void pch_clrbit(void __iomem *addr, u32 offset, u32 bitmask)
{ … }
static void pch_i2c_init(struct i2c_algo_pch_data *adap)
{ … }
static s32 pch_i2c_wait_for_bus_idle(struct i2c_algo_pch_data *adap,
s32 timeout)
{ … }
static void pch_i2c_start(struct i2c_algo_pch_data *adap)
{ … }
static void pch_i2c_stop(struct i2c_algo_pch_data *adap)
{ … }
static int pch_i2c_wait_for_check_xfer(struct i2c_algo_pch_data *adap)
{ … }
static void pch_i2c_repstart(struct i2c_algo_pch_data *adap)
{ … }
static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
struct i2c_msg *msgs, u32 last, u32 first)
{ … }
static void pch_i2c_sendack(struct i2c_algo_pch_data *adap)
{ … }
static void pch_i2c_sendnack(struct i2c_algo_pch_data *adap)
{ … }
static void pch_i2c_restart(struct i2c_algo_pch_data *adap)
{ … }
static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
u32 last, u32 first)
{ … }
static void pch_i2c_cb(struct i2c_algo_pch_data *adap)
{ … }
static irqreturn_t pch_i2c_handler(int irq, void *pData)
{ … }
static s32 pch_i2c_xfer(struct i2c_adapter *i2c_adap,
struct i2c_msg *msgs, s32 num)
{ … }
static u32 pch_i2c_func(struct i2c_adapter *adap)
{ … }
static const struct i2c_algorithm pch_algorithm = …;
static void pch_i2c_disbl_int(struct i2c_algo_pch_data *adap)
{ … }
static int pch_i2c_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{ … }
static void pch_i2c_remove(struct pci_dev *pdev)
{ … }
static int __maybe_unused pch_i2c_suspend(struct device *dev)
{ … }
static int __maybe_unused pch_i2c_resume(struct device *dev)
{ … }
static SIMPLE_DEV_PM_OPS(pch_i2c_pm_ops, pch_i2c_suspend, pch_i2c_resume);
static struct pci_driver pch_pcidriver = …;
module_pci_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
module_param(pch_i2c_speed, int, (S_IRUSR | S_IWUSR));
module_param(pch_clk, int, (S_IRUSR | S_IWUSR));