linux/drivers/iio/light/ltr501.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Support for Lite-On LTR501 and similar ambient light and proximity sensors.
 *
 * Copyright 2014 Peter Meerwald <[email protected]>
 *
 * 7-bit I2C slave address 0x23
 *
 * TODO: IR LED characteristics
 */

#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/i2c.h>
#include <linux/err.h>
#include <linux/delay.h>
#include <linux/regmap.h>
#include <linux/acpi.h>
#include <linux/regulator/consumer.h>

#include <linux/iio/iio.h>
#include <linux/iio/events.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/buffer.h>
#include <linux/iio/triggered_buffer.h>

#define LTR501_DRV_NAME

#define LTR501_ALS_CONTR
#define LTR501_PS_CONTR
#define LTR501_PS_MEAS_RATE
#define LTR501_ALS_MEAS_RATE
#define LTR501_PART_ID
#define LTR501_MANUFAC_ID
#define LTR501_ALS_DATA1
#define LTR501_ALS_DATA1_UPPER
#define LTR501_ALS_DATA0
#define LTR501_ALS_DATA0_UPPER
#define LTR501_ALS_PS_STATUS
#define LTR501_PS_DATA
#define LTR501_PS_DATA_UPPER
#define LTR501_INTR
#define LTR501_PS_THRESH_UP
#define LTR501_PS_THRESH_LOW
#define LTR501_ALS_THRESH_UP
#define LTR501_ALS_THRESH_LOW
#define LTR501_INTR_PRST
#define LTR501_MAX_REG

#define LTR501_ALS_CONTR_SW_RESET
#define LTR501_CONTR_PS_GAIN_MASK
#define LTR501_CONTR_PS_GAIN_SHIFT
#define LTR501_CONTR_ALS_GAIN_MASK
#define LTR501_CONTR_ACTIVE

#define LTR501_STATUS_ALS_INTR
#define LTR501_STATUS_ALS_RDY
#define LTR501_STATUS_PS_INTR
#define LTR501_STATUS_PS_RDY

#define LTR501_PS_DATA_MASK
#define LTR501_PS_THRESH_MASK
#define LTR501_ALS_THRESH_MASK

#define LTR501_ALS_DEF_PERIOD
#define LTR501_PS_DEF_PERIOD

#define LTR501_REGMAP_NAME

#define LTR501_LUX_CONV(vis_coeff, vis_data, ir_coeff, ir_data)

static const int int_time_mapping[] =;

static const struct reg_field reg_field_it =;
static const struct reg_field reg_field_als_intr =;
static const struct reg_field reg_field_ps_intr =;
static const struct reg_field reg_field_als_rate =;
static const struct reg_field reg_field_ps_rate =;
static const struct reg_field reg_field_als_prst =;
static const struct reg_field reg_field_ps_prst =;

struct ltr501_samp_table {};

#define LTR501_RESERVED_GAIN

enum {};

struct ltr501_gain {};

static const struct ltr501_gain ltr501_als_gain_tbl[] =;

static const struct ltr501_gain ltr559_als_gain_tbl[] =;

static const struct ltr501_gain ltr501_ps_gain_tbl[] =;

static const struct ltr501_gain ltr559_ps_gain_tbl[] =;

struct ltr501_chip_info {};

struct ltr501_data {};

static const struct ltr501_samp_table ltr501_als_samp_table[] =;

static const struct ltr501_samp_table ltr501_ps_samp_table[] =;

static int ltr501_match_samp_freq(const struct ltr501_samp_table *tab,
					   int len, int val, int val2)
{}

static int ltr501_als_read_samp_freq(const struct ltr501_data *data,
				     int *val, int *val2)
{}

static int ltr501_ps_read_samp_freq(const struct ltr501_data *data,
				    int *val, int *val2)
{}

static int ltr501_als_write_samp_freq(struct ltr501_data *data,
				      int val, int val2)
{}

static int ltr501_ps_write_samp_freq(struct ltr501_data *data,
				     int val, int val2)
{}

static int ltr501_als_read_samp_period(const struct ltr501_data *data, int *val)
{}

static int ltr501_ps_read_samp_period(const struct ltr501_data *data, int *val)
{}

/* IR and visible spectrum coeff's are given in data sheet */
static unsigned long ltr501_calculate_lux(u16 vis_data, u16 ir_data)
{}

static int ltr501_drdy(const struct ltr501_data *data, u8 drdy_mask)
{}

static int ltr501_set_it_time(struct ltr501_data *data, int it)
{}

/* read int time in micro seconds */
static int ltr501_read_it_time(const struct ltr501_data *data,
			       int *val, int *val2)
{}

static int ltr501_read_als(const struct ltr501_data *data, __le16 buf[2])
{}

static int ltr501_read_ps(const struct ltr501_data *data)
{}

static int ltr501_read_intr_prst(const struct ltr501_data *data,
				 enum iio_chan_type type,
				 int *val2)
{}

static int ltr501_write_intr_prst(struct ltr501_data *data,
				  enum iio_chan_type type,
				  int val, int val2)
{}

static ssize_t ltr501_read_near_level(struct iio_dev *indio_dev,
				      uintptr_t priv,
				      const struct iio_chan_spec *chan,
				      char *buf)
{}

static const struct iio_chan_spec_ext_info ltr501_ext_info[] =;

static const struct iio_event_spec ltr501_als_event_spec[] =;

static const struct iio_event_spec ltr501_pxs_event_spec[] =;

#define LTR501_INTENSITY_CHANNEL(_idx, _addr, _mod, _shared, \
				 _evspec, _evsize)

#define LTR501_LIGHT_CHANNEL()

static const struct iio_chan_spec ltr501_channels[] =;

static const struct iio_chan_spec ltr301_channels[] =;

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

static int ltr501_get_gain_index(const struct ltr501_gain *gain, int size,
				 int val, int val2)
{}

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

static int ltr501_read_thresh(const 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 ltr501_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 ltr501_read_event(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 ltr501_write_event(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 ltr501_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 ltr501_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 ssize_t ltr501_show_proximity_scale_avail(struct device *dev,
						 struct device_attribute *attr,
						 char *buf)
{}

static ssize_t ltr501_show_intensity_scale_avail(struct device *dev,
						 struct device_attribute *attr,
						 char *buf)
{}

static IIO_CONST_ATTR_INT_TIME_AVAIL("0.05 0.1 0.2 0.4");
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("20 10 5 2 1 0.5");

static IIO_DEVICE_ATTR(in_proximity_scale_available, S_IRUGO,
		       ltr501_show_proximity_scale_avail, NULL, 0);
static IIO_DEVICE_ATTR(in_intensity_scale_available, S_IRUGO,
		       ltr501_show_intensity_scale_avail, NULL, 0);

static struct attribute *ltr501_attributes[] =;

static struct attribute *ltr301_attributes[] =;

static const struct attribute_group ltr501_attribute_group =;

static const struct attribute_group ltr301_attribute_group =;

static const struct iio_info ltr501_info_no_irq =;

static const struct iio_info ltr501_info =;

static const struct iio_info ltr301_info_no_irq =;

static const struct iio_info ltr301_info =;

static const struct ltr501_chip_info ltr501_chip_info_tbl[] =;

static int ltr501_write_contr(struct ltr501_data *data, u8 als_val, u8 ps_val)
{}

static irqreturn_t ltr501_trigger_handler(int irq, void *p)
{}

static irqreturn_t ltr501_interrupt_handler(int irq, void *private)
{}

static int ltr501_init(struct ltr501_data *data)
{}

static bool ltr501_is_volatile_reg(struct device *dev, unsigned int reg)
{}

static const struct regmap_config ltr501_regmap_config =;

static int ltr501_powerdown(struct ltr501_data *data)
{}

static const char *ltr501_match_acpi_device(struct device *dev, int *chip_idx)
{}

static int ltr501_probe(struct i2c_client *client)
{}

static void ltr501_remove(struct i2c_client *client)
{}

static int ltr501_suspend(struct device *dev)
{}

static int ltr501_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(ltr501_pm_ops, ltr501_suspend, ltr501_resume);

static const struct acpi_device_id ltr_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, ltr_acpi_match);

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

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

static struct i2c_driver ltr501_driver =;

module_i2c_driver();

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