#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/workqueue.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/mfd/tps65010.h>
#include <linux/gpio/driver.h>
#define DRIVER_VERSION …
#define DRIVER_NAME …
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
static struct i2c_driver tps65010_driver;
enum tps_model { … };
struct tps65010 { … };
#define POWER_POLL_DELAY …
#if defined(DEBUG) || defined(CONFIG_DEBUG_FS)
static void dbg_chgstat(char *buf, size_t len, u8 chgstatus)
{ … }
static void dbg_regstat(char *buf, size_t len, u8 regstatus)
{ … }
static void dbg_chgconf(int por, char *buf, size_t len, u8 chgconfig)
{ … }
#endif
#ifdef DEBUG
static void show_chgstatus(const char *label, u8 chgstatus)
{
char buf [100];
dbg_chgstat(buf, sizeof buf, chgstatus);
pr_debug("%s: %s %s", DRIVER_NAME, label, buf);
}
static void show_regstatus(const char *label, u8 regstatus)
{
char buf [100];
dbg_regstat(buf, sizeof buf, regstatus);
pr_debug("%s: %s %s", DRIVER_NAME, label, buf);
}
static void show_chgconfig(int por, const char *label, u8 chgconfig)
{
char buf [100];
dbg_chgconf(por, buf, sizeof buf, chgconfig);
pr_debug("%s: %s %s", DRIVER_NAME, label, buf);
}
#else
static inline void show_chgstatus(const char *label, u8 chgstatus) { … }
static inline void show_regstatus(const char *label, u8 chgstatus) { … }
static inline void show_chgconfig(int por, const char *label, u8 chgconfig) { … }
#endif
#ifdef CONFIG_DEBUG_FS
static int dbg_show(struct seq_file *s, void *_)
{ … }
static int dbg_tps_open(struct inode *inode, struct file *file)
{ … }
static const struct file_operations debug_fops = …;
#define DEBUG_FOPS …
#else
#define DEBUG_FOPS …
#endif
static void tps65010_interrupt(struct tps65010 *tps)
{ … }
static void tps65010_work(struct work_struct *work)
{ … }
static irqreturn_t tps65010_irq(int irq, void *_tps)
{ … }
static void
tps65010_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{ … }
static int
tps65010_output(struct gpio_chip *chip, unsigned offset, int value)
{ … }
static int tps65010_gpio_get(struct gpio_chip *chip, unsigned offset)
{ … }
static struct tps65010 *the_tps;
static void tps65010_remove(struct i2c_client *client)
{ … }
static int tps65010_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id tps65010_id[] = …;
MODULE_DEVICE_TABLE(i2c, tps65010_id);
static struct i2c_driver tps65010_driver = …;
int tps65010_set_vbus_draw(unsigned mA)
{ … }
EXPORT_SYMBOL(…);
int tps65010_set_gpio_out_value(unsigned gpio, unsigned value)
{ … }
EXPORT_SYMBOL(…);
int tps65010_set_led(unsigned led, unsigned mode)
{ … }
EXPORT_SYMBOL(…);
int tps65010_set_vib(unsigned value)
{ … }
EXPORT_SYMBOL(…);
int tps65010_set_low_pwr(unsigned mode)
{ … }
EXPORT_SYMBOL(…);
int tps65010_config_vregs1(unsigned value)
{ … }
EXPORT_SYMBOL(…);
int tps65010_config_vdcdc2(unsigned value)
{ … }
EXPORT_SYMBOL(…);
int tps65013_set_low_pwr(unsigned mode)
{ … }
EXPORT_SYMBOL(…);
static int __init tps_init(void)
{ … }
subsys_initcall(tps_init);
static void __exit tps_exit(void)
{ … }
module_exit(tps_exit);