#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/pm_runtime.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/bitops.h>
#define BH1780_CMD_BIT …
#define BH1780_REG_CONTROL …
#define BH1780_REG_PARTID …
#define BH1780_REG_MANFID …
#define BH1780_REG_DLOW …
#define BH1780_REG_DHIGH …
#define BH1780_REVMASK …
#define BH1780_POWMASK …
#define BH1780_POFF …
#define BH1780_PON …
#define BH1780_PON_DELAY …
#define BH1780_INTERVAL …
struct bh1780_data { … };
static int bh1780_write(struct bh1780_data *bh1780, u8 reg, u8 val)
{ … }
static int bh1780_read(struct bh1780_data *bh1780, u8 reg)
{ … }
static int bh1780_read_word(struct bh1780_data *bh1780, u8 reg)
{ … }
static int bh1780_debugfs_reg_access(struct iio_dev *indio_dev,
unsigned int reg, unsigned int writeval,
unsigned int *readval)
{ … }
static int bh1780_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static const struct iio_info bh1780_info = …;
static const struct iio_chan_spec bh1780_channels[] = …;
static int bh1780_probe(struct i2c_client *client)
{ … }
static void bh1780_remove(struct i2c_client *client)
{ … }
static int bh1780_runtime_suspend(struct device *dev)
{ … }
static int bh1780_runtime_resume(struct device *dev)
{ … }
static DEFINE_RUNTIME_DEV_PM_OPS(bh1780_dev_pm_ops, bh1780_runtime_suspend,
bh1780_runtime_resume, NULL);
static const struct i2c_device_id bh1780_id[] = …;
MODULE_DEVICE_TABLE(i2c, bh1780_id);
static const struct of_device_id of_bh1780_match[] = …;
MODULE_DEVICE_TABLE(of, of_bh1780_match);
static struct i2c_driver bh1780_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;