#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/gpio/driver.h>
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/platform_data/max732x.h>
#define PORT_NONE …
#define PORT_OUTPUT …
#define PORT_INPUT …
#define PORT_OPENDRAIN …
#define IO_4I4O …
#define IO_4P4O …
#define IO_8I …
#define IO_8P …
#define IO_8O …
#define GROUP_A(x) …
#define GROUP_B(x) …
#define INT_NONE …
#define INT_NO_MASK …
#define INT_INDEP_MASK …
#define INT_MERGED_MASK …
#define INT_CAPS(x) …
enum { … };
static uint64_t max732x_features[] = …;
static const struct i2c_device_id max732x_id[] = …;
MODULE_DEVICE_TABLE(i2c, max732x_id);
static const struct of_device_id max732x_of_table[] = …;
MODULE_DEVICE_TABLE(of, max732x_of_table);
struct max732x_chip { … };
static int max732x_writeb(struct max732x_chip *chip, int group_a, uint8_t val)
{ … }
static int max732x_readb(struct max732x_chip *chip, int group_a, uint8_t *val)
{ … }
static inline int is_group_a(struct max732x_chip *chip, unsigned off)
{ … }
static int max732x_gpio_get_value(struct gpio_chip *gc, unsigned off)
{ … }
static void max732x_gpio_set_mask(struct gpio_chip *gc, unsigned off, int mask,
int val)
{ … }
static void max732x_gpio_set_value(struct gpio_chip *gc, unsigned off, int val)
{ … }
static void max732x_gpio_set_multiple(struct gpio_chip *gc,
unsigned long *mask, unsigned long *bits)
{ … }
static int max732x_gpio_direction_input(struct gpio_chip *gc, unsigned off)
{ … }
static int max732x_gpio_direction_output(struct gpio_chip *gc,
unsigned off, int val)
{ … }
#ifdef CONFIG_GPIO_MAX732X_IRQ
static int max732x_writew(struct max732x_chip *chip, uint16_t val)
{ … }
static int max732x_readw(struct max732x_chip *chip, uint16_t *val)
{ … }
static void max732x_irq_update_mask(struct max732x_chip *chip)
{ … }
static void max732x_irq_mask(struct irq_data *d)
{ … }
static void max732x_irq_unmask(struct irq_data *d)
{ … }
static void max732x_irq_bus_lock(struct irq_data *d)
{ … }
static void max732x_irq_bus_sync_unlock(struct irq_data *d)
{ … }
static int max732x_irq_set_type(struct irq_data *d, unsigned int type)
{ … }
static int max732x_irq_set_wake(struct irq_data *data, unsigned int on)
{ … }
static const struct irq_chip max732x_irq_chip = …;
static uint8_t max732x_irq_pending(struct max732x_chip *chip)
{ … }
static irqreturn_t max732x_irq_handler(int irq, void *devid)
{ … }
static int max732x_irq_setup(struct max732x_chip *chip,
const struct i2c_device_id *id)
{ … }
#else
static int max732x_irq_setup(struct max732x_chip *chip,
const struct i2c_device_id *id)
{
struct i2c_client *client = chip->client;
int has_irq = max732x_features[id->driver_data] >> 32;
if (client->irq && has_irq != INT_NONE)
dev_warn(&client->dev, "interrupt support not compiled in\n");
return 0;
}
#endif
static int max732x_setup_gpio(struct max732x_chip *chip,
const struct i2c_device_id *id,
unsigned gpio_start)
{ … }
static struct max732x_platform_data *of_gpio_max732x(struct device *dev)
{ … }
static int max732x_probe(struct i2c_client *client)
{ … }
static struct i2c_driver max732x_driver = …;
static int __init max732x_init(void)
{ … }
subsys_initcall(max732x_init);
static void __exit max732x_exit(void)
{ … }
module_exit(max732x_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;