linux/drivers/misc/tsl2550.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  tsl2550.c - Linux kernel modules for ambient light sensor
 *
 *  Copyright (C) 2007 Rodolfo Giometti <[email protected]>
 *  Copyright (C) 2007 Eurotech S.p.A. <[email protected]>
 */

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

#define TSL2550_DRV_NAME
#define DRIVER_VERSION

/*
 * Defines
 */

#define TSL2550_POWER_DOWN
#define TSL2550_POWER_UP
#define TSL2550_STANDARD_RANGE
#define TSL2550_EXTENDED_RANGE
#define TSL2550_READ_ADC0
#define TSL2550_READ_ADC1

/*
 * Structs
 */

struct tsl2550_data {};

/*
 * Global data
 */

static const u8 TSL2550_MODE_RANGE[2] =;

/*
 * Management functions
 */

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

static int tsl2550_set_power_state(struct i2c_client *client, int state)
{}

static int tsl2550_get_adc_value(struct i2c_client *client, u8 cmd)
{}

/*
 * LUX calculation
 */

#define TSL2550_MAX_LUX

static const u8 ratio_lut[] =;

static const u16 count_lut[] =;

/*
 * This function is described into Taos TSL2550 Designer's Notebook
 * pages 2, 3.
 */
static int tsl2550_calculate_lux(u8 ch0, u8 ch1)
{}

/*
 * SysFS support
 */

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

static ssize_t tsl2550_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,
		   tsl2550_show_power_state, tsl2550_store_power_state);

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

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

static DEVICE_ATTR(operating_mode, S_IWUSR | S_IRUGO,
		   tsl2550_show_operating_mode, tsl2550_store_operating_mode);

static ssize_t __tsl2550_show_lux(struct i2c_client *client, char *buf)
{}

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

static DEVICE_ATTR(lux1_input, S_IRUGO,
		   tsl2550_show_lux1_input, NULL);

static struct attribute *tsl2550_attributes[] =;

static const struct attribute_group tsl2550_attr_group =;

/*
 * Initialization function
 */

static int tsl2550_init_client(struct i2c_client *client)
{}

/*
 * I2C init/probing/exit functions
 */

static struct i2c_driver tsl2550_driver;
static int tsl2550_probe(struct i2c_client *client)
{}

static void tsl2550_remove(struct i2c_client *client)
{}

#ifdef CONFIG_PM_SLEEP

static int tsl2550_suspend(struct device *dev)
{}

static int tsl2550_resume(struct device *dev)
{}

static SIMPLE_DEV_PM_OPS(tsl2550_pm_ops, tsl2550_suspend, tsl2550_resume);
#define TSL2550_PM_OPS

#else

#define TSL2550_PM_OPS

#endif /* CONFIG_PM_SLEEP */

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

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

static struct i2c_driver tsl2550_driver =;

module_i2c_driver();

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