linux/drivers/iio/light/bh1745.c

// SPDX-License-Identifier: GPL-2.0
/*
 * ROHM BH1745 digital colour sensor driver
 *
 * Copyright (C) Mudit Sharma <[email protected]>
 *
 * 7-bit I2C slave addresses:
 *  0x38 (ADDR pin low)
 *  0x39 (ADDR pin high)
 */

#include <linux/i2c.h>
#include <linux/mutex.h>
#include <linux/util_macros.h>
#include <linux/iio/events.h>
#include <linux/regmap.h>
#include <linux/bits.h>
#include <linux/bitfield.h>

#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/iio-gts-helper.h>

/* BH1745 configuration registers */

/* System control */
#define BH1745_SYS_CTRL
#define BH1745_SYS_CTRL_SW_RESET
#define BH1745_SYS_CTRL_INTR_RESET
#define BH1745_SYS_CTRL_PART_ID_MASK
#define BH1745_PART_ID

/* Mode control 1 */
#define BH1745_MODE_CTRL1
#define BH1745_CTRL1_MEASUREMENT_TIME_MASK

/* Mode control 2 */
#define BH1745_MODE_CTRL2
#define BH1745_CTRL2_RGBC_EN
#define BH1745_CTRL2_ADC_GAIN_MASK

/* Interrupt */
#define BH1745_INTR
#define BH1745_INTR_STATUS
#define BH1745_INTR_SOURCE_MASK
#define BH1745_INTR_ENABLE

#define BH1745_PERSISTENCE

/* Threshold high */
#define BH1745_TH_LSB
#define BH1745_TH_MSB

/* Threshold low */
#define BH1745_TL_LSB
#define BH1745_TL_MSB

/* BH1745 data output regs */
#define BH1745_RED_LSB
#define BH1745_RED_MSB
#define BH1745_GREEN_LSB
#define BH1745_GREEN_MSB
#define BH1745_BLUE_LSB
#define BH1745_BLUE_MSB
#define BH1745_CLEAR_LSB
#define BH1745_CLEAR_MSB

#define BH1745_MANU_ID_REG

/* From 16x max HW gain and 32x max integration time */
#define BH1745_MAX_GAIN

enum bh1745_int_source {};

enum bh1745_gain {};

enum bh1745_measurement_time {};

enum bh1745_presistence_value {};

static const struct iio_gain_sel_pair bh1745_gain[] =;

static const struct iio_itime_sel_mul bh1745_itimes[] =;

struct bh1745_data {};

static const struct regmap_range bh1745_volatile_ranges[] =;

static const struct regmap_access_table bh1745_volatile_regs =;

static const struct regmap_range bh1745_readable_ranges[] =;

static const struct regmap_access_table bh1745_readable_regs =;

static const struct regmap_range bh1745_writable_ranges[] =;

static const struct regmap_access_table bh1745_writable_regs =;

static const struct regmap_config bh1745_regmap =;

static const struct iio_event_spec bh1745_event_spec[] =;

#define BH1745_CHANNEL(_colour, _si, _addr)

static const struct iio_chan_spec bh1745_channels[] =;

static int bh1745_reset(struct bh1745_data *data)
{}

static int bh1745_power_on(struct bh1745_data *data)
{}

static void bh1745_power_off(void *data_ptr)
{}

static int bh1745_get_scale(struct bh1745_data *data, int *val, int *val2)
{}

static int bh1745_set_scale(struct bh1745_data *data, int val)
{}

static int bh1745_get_int_time(struct bh1745_data *data, int *val)
{}

static int bh1745_set_int_time(struct bh1745_data *data, int val, int val2)
{}

static int bh1745_read_raw(struct iio_dev *indio_dev,
			   struct iio_chan_spec const *chan,
			   int *val, int *val2, long mask)
{}

static int bh1745_write_raw(struct iio_dev *indio_dev,
			    struct iio_chan_spec const *chan,
			    int val, int val2, long mask)
{}

static int bh1745_write_raw_get_fmt(struct iio_dev *indio_dev,
				    struct iio_chan_spec const *chan,
				    long mask)
{}

static int bh1745_read_thresh(struct iio_dev *indio_dev,
			      const struct iio_chan_spec *chan,
			      enum iio_event_type type,
			      enum iio_event_direction dir,
			      enum iio_event_info info, int *val, int *val2)
{}

static int bh1745_write_thresh(struct iio_dev *indio_dev,
			       const struct iio_chan_spec *chan,
			       enum iio_event_type type,
			       enum iio_event_direction dir,
			       enum iio_event_info info, int val, int val2)
{}

static int bh1745_read_event_config(struct iio_dev *indio_dev,
				    const struct iio_chan_spec *chan,
				    enum iio_event_type type,
				    enum iio_event_direction dir)
{}

static int bh1745_write_event_config(struct iio_dev *indio_dev,
				     const struct iio_chan_spec *chan,
				     enum iio_event_type type,
				     enum iio_event_direction dir, int state)
{}

static int bh1745_read_avail(struct iio_dev *indio_dev,
			     struct iio_chan_spec const *chan, const int **vals,
			     int *type, int *length, long mask)
{}

static const struct iio_info bh1745_info =;

static irqreturn_t bh1745_interrupt_handler(int interrupt, void *p)
{}

static irqreturn_t bh1745_trigger_handler(int interrupt, void *p)
{}

static int bh1745_setup_triggered_buffer(struct iio_dev *indio_dev,
					 struct device *parent,
					 int irq)
{}

static int bh1745_init(struct bh1745_data *data)
{}

static int bh1745_probe(struct i2c_client *client)
{}

static const struct i2c_device_id bh1745_idtable[] =;
MODULE_DEVICE_TABLE(i2c, bh1745_idtable);

static const struct of_device_id bh1745_of_match[] =;
MODULE_DEVICE_TABLE(of, bh1745_of_match);

static struct i2c_driver bh1745_driver =;
module_i2c_driver();

MODULE_LICENSE();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_IMPORT_NS();