linux/drivers/iio/light/ltrf216a.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * LTRF216A Ambient Light Sensor
 *
 * Copyright (C) 2022 Collabora, Ltd.
 * Author: Shreeya Patel <[email protected]>
 *
 * Copyright (C) 2021 Lite-On Technology Corp (Singapore)
 * Author: Shi Zhigang <[email protected]>
 *
 * IIO driver for LTRF216A (7-bit I2C slave address 0x53).
 */

#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/iopoll.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>

#include <linux/iio/iio.h>

#include <linux/unaligned.h>

#define LTRF216A_ALS_RESET_MASK
#define LTRF216A_ALS_DATA_STATUS
#define LTRF216A_ALS_ENABLE_MASK
#define LTRF216A_MAIN_CTRL
#define LTRF216A_ALS_MEAS_RES
#define LTRF216A_ALS_GAIN
#define LTRF216A_PART_ID
#define LTRF216A_MAIN_STATUS
#define LTRF216A_ALS_CLEAR_DATA_0
#define LTRF216A_ALS_CLEAR_DATA_1
#define LTRF216A_ALS_CLEAR_DATA_2
#define LTRF216A_ALS_DATA_0
#define LTRF216A_ALS_DATA_1
#define LTRF216A_ALS_DATA_2
#define LTRF216A_INT_CFG
#define LTRF216A_INT_PST
#define LTRF216A_ALS_THRES_UP_0
#define LTRF216A_ALS_THRES_UP_1
#define LTRF216A_ALS_THRES_UP_2
#define LTRF216A_ALS_THRES_LOW_0
#define LTRF216A_ALS_THRES_LOW_1
#define LTRF216A_ALS_THRES_LOW_2
#define LTRF216A_ALS_READ_DATA_DELAY_US

static const int ltrf216a_int_time_available[][2] =;

static const int ltrf216a_int_time_reg[][2] =;

struct ltr_chip_info {};

/*
 * Window Factor is needed when the device is under Window glass
 * with coated tinted ink. This is to compensate for the light loss
 * due to the lower transmission rate of the window glass and helps
 * in calculating lux.
 */
#define LTRF216A_WIN_FAC

struct ltrf216a_data {};

static const struct iio_chan_spec ltrf216a_channels[] =;

static void ltrf216a_reset(struct iio_dev *indio_dev)
{}

static int ltrf216a_enable(struct iio_dev *indio_dev)
{}

static int ltrf216a_disable(struct iio_dev *indio_dev)
{}

static void ltrf216a_cleanup(void *data)
{}

static int ltrf216a_set_int_time(struct ltrf216a_data *data, int itime)
{}

static int ltrf216a_get_int_time(struct ltrf216a_data *data,
				 int *val, int *val2)
{}

static int ltrf216a_set_power_state(struct ltrf216a_data *data, bool on)
{}

static int ltrf216a_read_data(struct ltrf216a_data *data, u8 addr)
{}

static int ltrf216a_get_lux(struct ltrf216a_data *data)
{}

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

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

static int ltrf216a_read_available(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 ltrf216a_info =;

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

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

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

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

static const struct regmap_config ltrf216a_regmap_config =;

static int ltrf216a_probe(struct i2c_client *client)
{}

static int ltrf216a_runtime_suspend(struct device *dev)
{}

static int ltrf216a_runtime_resume(struct device *dev)
{}

static DEFINE_RUNTIME_DEV_PM_OPS(ltrf216a_pm_ops, ltrf216a_runtime_suspend,
				 ltrf216a_runtime_resume, NULL);

static const struct ltr_chip_info ltr308_chip_info =;

static const struct ltr_chip_info ltrf216a_chip_info =;

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

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

static struct i2c_driver ltrf216a_driver =;
module_i2c_driver();

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