linux/drivers/hwmon/ds620.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  ds620.c - Support for temperature sensor and thermostat DS620
 *
 *  Copyright (C) 2010, 2011 Roland Stigge <[email protected]>
 *
 *  based on ds1621.c by Christian W. Zuckschwerdt  <[email protected]>
 */

#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
#include <linux/platform_data/ds620.h>

/*
 * Many DS620 constants specified below
 *  15   14   13   12   11   10   09    08
 * |Done|NVB |THF |TLF |R1  |R0  |AUTOC|1SHOT|
 *
 *  07   06   05   04   03   02   01    00
 * |PO2 |PO1 |A2  |A1  |A0  |    |     |     |
 */
#define DS620_REG_CONFIG_DONE
#define DS620_REG_CONFIG_NVB
#define DS620_REG_CONFIG_THF
#define DS620_REG_CONFIG_TLF
#define DS620_REG_CONFIG_R1
#define DS620_REG_CONFIG_R0
#define DS620_REG_CONFIG_AUTOC
#define DS620_REG_CONFIG_1SHOT
#define DS620_REG_CONFIG_PO2
#define DS620_REG_CONFIG_PO1
#define DS620_REG_CONFIG_A2
#define DS620_REG_CONFIG_A1
#define DS620_REG_CONFIG_A0

/* The DS620 registers */
static const u8 DS620_REG_TEMP[3] =;

#define DS620_REG_CONF
#define DS620_COM_START
#define DS620_COM_STOP

/* Each client has this additional data */
struct ds620_data {};

static void ds620_init_client(struct i2c_client *client)
{}

static struct ds620_data *ds620_update_client(struct device *dev)
{}

static ssize_t temp_show(struct device *dev, struct device_attribute *da,
			 char *buf)
{}

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

static ssize_t alarm_show(struct device *dev, struct device_attribute *da,
			  char *buf)
{}

static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
static SENSOR_DEVICE_ATTR_RW(temp1_min, temp, 1);
static SENSOR_DEVICE_ATTR_RW(temp1_max, temp, 2);
static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, alarm, DS620_REG_CONFIG_TLF);
static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, DS620_REG_CONFIG_THF);

static struct attribute *ds620_attrs[] =;

ATTRIBUTE_GROUPS();

static int ds620_probe(struct i2c_client *client)
{}

static const struct i2c_device_id ds620_id[] =;

MODULE_DEVICE_TABLE(i2c, ds620_id);

/* This is the driver that will be inserted */
static struct i2c_driver ds620_driver =;

module_i2c_driver();

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