#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/clk.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/cpufreq.h>
#include <linux/gpio/consumer.h>
#include <linux/of.h>
#include <linux/platform_data/i2c-davinci.h>
#include <linux/pm_runtime.h>
#define DAVINCI_I2C_TIMEOUT …
#define DAVINCI_I2C_MAX_TRIES …
#define DAVINCI_I2C_OWN_ADDRESS …
#define I2C_DAVINCI_INTR_ALL …
#define DAVINCI_I2C_OAR_REG …
#define DAVINCI_I2C_IMR_REG …
#define DAVINCI_I2C_STR_REG …
#define DAVINCI_I2C_CLKL_REG …
#define DAVINCI_I2C_CLKH_REG …
#define DAVINCI_I2C_CNT_REG …
#define DAVINCI_I2C_DRR_REG …
#define DAVINCI_I2C_SAR_REG …
#define DAVINCI_I2C_DXR_REG …
#define DAVINCI_I2C_MDR_REG …
#define DAVINCI_I2C_IVR_REG …
#define DAVINCI_I2C_EMDR_REG …
#define DAVINCI_I2C_PSC_REG …
#define DAVINCI_I2C_FUNC_REG …
#define DAVINCI_I2C_DIR_REG …
#define DAVINCI_I2C_DIN_REG …
#define DAVINCI_I2C_DOUT_REG …
#define DAVINCI_I2C_DSET_REG …
#define DAVINCI_I2C_DCLR_REG …
#define DAVINCI_I2C_IVR_AAS …
#define DAVINCI_I2C_IVR_SCD …
#define DAVINCI_I2C_IVR_XRDY …
#define DAVINCI_I2C_IVR_RDR …
#define DAVINCI_I2C_IVR_ARDY …
#define DAVINCI_I2C_IVR_NACK …
#define DAVINCI_I2C_IVR_AL …
#define DAVINCI_I2C_STR_BB …
#define DAVINCI_I2C_STR_RSFULL …
#define DAVINCI_I2C_STR_SCD …
#define DAVINCI_I2C_STR_ARDY …
#define DAVINCI_I2C_STR_NACK …
#define DAVINCI_I2C_STR_AL …
#define DAVINCI_I2C_MDR_NACK …
#define DAVINCI_I2C_MDR_STT …
#define DAVINCI_I2C_MDR_STP …
#define DAVINCI_I2C_MDR_MST …
#define DAVINCI_I2C_MDR_TRX …
#define DAVINCI_I2C_MDR_XA …
#define DAVINCI_I2C_MDR_RM …
#define DAVINCI_I2C_MDR_IRS …
#define DAVINCI_I2C_IMR_AAS …
#define DAVINCI_I2C_IMR_SCD …
#define DAVINCI_I2C_IMR_XRDY …
#define DAVINCI_I2C_IMR_RRDY …
#define DAVINCI_I2C_IMR_ARDY …
#define DAVINCI_I2C_IMR_NACK …
#define DAVINCI_I2C_IMR_AL …
#define DAVINCI_I2C_FUNC_PFUNC0 …
#define DAVINCI_I2C_DIR_PDIR0 …
#define DAVINCI_I2C_DIR_PDIR1 …
#define DAVINCI_I2C_DIN_PDIN0 …
#define DAVINCI_I2C_DIN_PDIN1 …
#define DAVINCI_I2C_DSET_PDSET0 …
#define DAVINCI_I2C_DSET_PDSET1 …
#define DAVINCI_I2C_DCLR_PDCLR0 …
#define DAVINCI_I2C_DCLR_PDCLR1 …
#define DAVINCI_I2C_PM_TIMEOUT …
struct davinci_i2c_dev { … };
static struct davinci_i2c_platform_data davinci_i2c_platform_data_default = …;
static inline void davinci_i2c_write_reg(struct davinci_i2c_dev *i2c_dev,
int reg, u16 val)
{ … }
static inline u16 davinci_i2c_read_reg(struct davinci_i2c_dev *i2c_dev, int reg)
{ … }
static inline void davinci_i2c_reset_ctrl(struct davinci_i2c_dev *i2c_dev,
int val)
{ … }
static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev)
{ … }
static int i2c_davinci_init(struct davinci_i2c_dev *dev)
{ … }
static void davinci_i2c_prepare_recovery(struct i2c_adapter *adap)
{ … }
static void davinci_i2c_unprepare_recovery(struct i2c_adapter *adap)
{ … }
static struct i2c_bus_recovery_info davinci_i2c_gpio_recovery_info = …;
static void davinci_i2c_set_scl(struct i2c_adapter *adap, int val)
{ … }
static int davinci_i2c_get_scl(struct i2c_adapter *adap)
{ … }
static int davinci_i2c_get_sda(struct i2c_adapter *adap)
{ … }
static void davinci_i2c_scl_prepare_recovery(struct i2c_adapter *adap)
{ … }
static void davinci_i2c_scl_unprepare_recovery(struct i2c_adapter *adap)
{ … }
static struct i2c_bus_recovery_info davinci_i2c_scl_recovery_info = …;
static int i2c_davinci_wait_bus_not_busy(struct davinci_i2c_dev *dev)
{ … }
static int
i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
{ … }
static int
i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
{ … }
static u32 i2c_davinci_func(struct i2c_adapter *adap)
{ … }
static void terminate_read(struct davinci_i2c_dev *dev)
{ … }
static void terminate_write(struct davinci_i2c_dev *dev)
{ … }
static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
{ … }
#ifdef CONFIG_CPU_FREQ
static int i2c_davinci_cpufreq_transition(struct notifier_block *nb,
unsigned long val, void *data)
{ … }
static inline int i2c_davinci_cpufreq_register(struct davinci_i2c_dev *dev)
{ … }
static inline void i2c_davinci_cpufreq_deregister(struct davinci_i2c_dev *dev)
{ … }
#else
static inline int i2c_davinci_cpufreq_register(struct davinci_i2c_dev *dev)
{
return 0;
}
static inline void i2c_davinci_cpufreq_deregister(struct davinci_i2c_dev *dev)
{
}
#endif
static const struct i2c_algorithm i2c_davinci_algo = …;
static const struct of_device_id davinci_i2c_of_match[] = …;
MODULE_DEVICE_TABLE(of, davinci_i2c_of_match);
static int davinci_i2c_probe(struct platform_device *pdev)
{ … }
static void davinci_i2c_remove(struct platform_device *pdev)
{ … }
static int davinci_i2c_suspend(struct device *dev)
{ … }
static int davinci_i2c_resume(struct device *dev)
{ … }
static const struct dev_pm_ops davinci_i2c_pm = …;
static const struct platform_device_id davinci_i2c_driver_ids[] = …;
MODULE_DEVICE_TABLE(platform, davinci_i2c_driver_ids);
static struct platform_driver davinci_i2c_driver = …;
static int __init davinci_i2c_init_driver(void)
{ … }
subsys_initcall(davinci_i2c_init_driver);
static void __exit davinci_i2c_exit_driver(void)
{ … }
module_exit(davinci_i2c_exit_driver);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;