linux/drivers/misc/isl29003.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  isl29003.c - Linux kernel module for
 * 	Intersil ISL29003 ambient light sensor
 *
 *  See file:Documentation/misc-devices/isl29003.rst
 *
 *  Copyright (c) 2009 Daniel Mack <[email protected]>
 *
 *  Based on code written by
 *  	Rodolfo Giometti <[email protected]>
 *  	Eurotech S.p.A. <[email protected]>
 */

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/mutex.h>
#include <linux/delay.h>

#define ISL29003_DRV_NAME
#define DRIVER_VERSION

#define ISL29003_REG_COMMAND
#define ISL29003_ADC_ENABLED
#define ISL29003_ADC_PD
#define ISL29003_TIMING_INT
#define ISL29003_MODE_SHIFT
#define ISL29003_MODE_MASK
#define ISL29003_RES_SHIFT
#define ISL29003_RES_MASK

#define ISL29003_REG_CONTROL
#define ISL29003_INT_FLG
#define ISL29003_RANGE_SHIFT
#define ISL29003_RANGE_MASK
#define ISL29003_INT_PERSISTS_SHIFT
#define ISL29003_INT_PERSISTS_MASK

#define ISL29003_REG_IRQ_THRESH_HI
#define ISL29003_REG_IRQ_THRESH_LO
#define ISL29003_REG_LSB_SENSOR
#define ISL29003_REG_MSB_SENSOR
#define ISL29003_REG_LSB_TIMER
#define ISL29003_REG_MSB_TIMER

#define ISL29003_NUM_CACHABLE_REGS

struct isl29003_data {};

static int gain_range[] =;

/*
 * register access helpers
 */

static int __isl29003_read_reg(struct i2c_client *client,
			       u32 reg, u8 mask, u8 shift)
{}

static int __isl29003_write_reg(struct i2c_client *client,
				u32 reg, u8 mask, u8 shift, u8 val)
{}

/*
 * internally used functions
 */

/* range */
static int isl29003_get_range(struct i2c_client *client)
{}

static int isl29003_set_range(struct i2c_client *client, int range)
{}

/* resolution */
static int isl29003_get_resolution(struct i2c_client *client)
{}

static int isl29003_set_resolution(struct i2c_client *client, int res)
{}

/* mode */
static int isl29003_get_mode(struct i2c_client *client)
{}

static int isl29003_set_mode(struct i2c_client *client, int mode)
{}

/* power_state */
static int isl29003_set_power_state(struct i2c_client *client, int state)
{}

static int isl29003_get_power_state(struct i2c_client *client)
{}

static int isl29003_get_adc_value(struct i2c_client *client)
{}

/*
 * sysfs layer
 */

/* range */
static ssize_t isl29003_show_range(struct device *dev,
				   struct device_attribute *attr, char *buf)
{}

static ssize_t isl29003_store_range(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t count)
{}

static DEVICE_ATTR(range, S_IWUSR | S_IRUGO,
		   isl29003_show_range, isl29003_store_range);


/* resolution */
static ssize_t isl29003_show_resolution(struct device *dev,
					struct device_attribute *attr,
					char *buf)
{}

static ssize_t isl29003_store_resolution(struct device *dev,
					 struct device_attribute *attr,
					 const char *buf, size_t count)
{}

static DEVICE_ATTR(resolution, S_IWUSR | S_IRUGO,
		   isl29003_show_resolution, isl29003_store_resolution);

/* mode */
static ssize_t isl29003_show_mode(struct device *dev,
				  struct device_attribute *attr, char *buf)
{}

static ssize_t isl29003_store_mode(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{}

static DEVICE_ATTR(mode, S_IWUSR | S_IRUGO,
		   isl29003_show_mode, isl29003_store_mode);


/* power state */
static ssize_t isl29003_show_power_state(struct device *dev,
					 struct device_attribute *attr,
					 char *buf)
{}

static ssize_t isl29003_store_power_state(struct device *dev,
					  struct device_attribute *attr,
					  const char *buf, size_t count)
{}

static DEVICE_ATTR(power_state, S_IWUSR | S_IRUGO,
		   isl29003_show_power_state, isl29003_store_power_state);


/* lux */
static ssize_t isl29003_show_lux(struct device *dev,
				 struct device_attribute *attr, char *buf)
{}

static DEVICE_ATTR(lux, S_IRUGO, isl29003_show_lux, NULL);

static struct attribute *isl29003_attributes[] =;

static const struct attribute_group isl29003_attr_group =;

static int isl29003_init_client(struct i2c_client *client)
{}

/*
 * I2C layer
 */

static int isl29003_probe(struct i2c_client *client)
{}

static void isl29003_remove(struct i2c_client *client)
{}

#ifdef CONFIG_PM_SLEEP
static int isl29003_suspend(struct device *dev)
{}

static int isl29003_resume(struct device *dev)
{}

static SIMPLE_DEV_PM_OPS(isl29003_pm_ops, isl29003_suspend, isl29003_resume);
#define ISL29003_PM_OPS

#else
#define ISL29003_PM_OPS
#endif /* CONFIG_PM_SLEEP */

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

static struct i2c_driver isl29003_driver =;

module_i2c_driver();

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