#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/module.h>
#define BH1750_POWER_DOWN …
#define BH1750_ONE_TIME_H_RES_MODE …
#define BH1750_CHANGE_INT_TIME_H_BIT …
#define BH1750_CHANGE_INT_TIME_L_BIT …
enum { … };
struct bh1750_chip_info;
struct bh1750_data { … };
struct bh1750_chip_info { … };
static const struct bh1750_chip_info bh1750_chip_info_tbl[] = …;
static int bh1750_change_int_time(struct bh1750_data *data, int usec)
{ … }
static int bh1750_read(struct bh1750_data *data, int *val)
{ … }
static int bh1750_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int bh1750_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val, int val2, long mask)
{ … }
static ssize_t bh1750_show_int_time_available(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static IIO_DEV_ATTR_INT_TIME_AVAIL(bh1750_show_int_time_available);
static struct attribute *bh1750_attributes[] = …;
static const struct attribute_group bh1750_attribute_group = …;
static const struct iio_info bh1750_info = …;
static const struct iio_chan_spec bh1750_channels[] = …;
static int bh1750_probe(struct i2c_client *client)
{ … }
static void bh1750_remove(struct i2c_client *client)
{ … }
static int bh1750_suspend(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(bh1750_pm_ops, bh1750_suspend, NULL);
static const struct i2c_device_id bh1750_id[] = …;
MODULE_DEVICE_TABLE(i2c, bh1750_id);
static const struct of_device_id bh1750_of_match[] = …;
MODULE_DEVICE_TABLE(of, bh1750_of_match);
static struct i2c_driver bh1750_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;