linux/drivers/hwmon/ltc4151.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Driver for Linear Technology LTC4151 High Voltage I2C Current
 * and Voltage Monitor
 *
 * Copyright (C) 2011 AppearTV AS
 *
 * Derived from:
 *
 *  Driver for Linear Technology LTC4261 I2C Negative Voltage Hot
 *  Swap Controller
 *  Copyright (C) 2010 Ericsson AB.
 *
 * Datasheet: http://www.linear.com/docs/Datasheet/4151fc.pdf
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/jiffies.h>

/* chip registers */
#define LTC4151_SENSE_H
#define LTC4151_SENSE_L
#define LTC4151_VIN_H
#define LTC4151_VIN_L
#define LTC4151_ADIN_H
#define LTC4151_ADIN_L

struct ltc4151_data {};

static struct ltc4151_data *ltc4151_update_device(struct device *dev)
{}

/* Return the voltage from the given register in mV */
static int ltc4151_get_value(struct ltc4151_data *data, u8 reg)
{}

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

/*
 * Input voltages.
 */
static SENSOR_DEVICE_ATTR_RO(in1_input, ltc4151_value, LTC4151_VIN_H);
static SENSOR_DEVICE_ATTR_RO(in2_input, ltc4151_value, LTC4151_ADIN_H);

/* Currents (via sense resistor) */
static SENSOR_DEVICE_ATTR_RO(curr1_input, ltc4151_value, LTC4151_SENSE_H);

/*
 * Finally, construct an array of pointers to members of the above objects,
 * as required for sysfs_create_group()
 */
static struct attribute *ltc4151_attrs[] =;
ATTRIBUTE_GROUPS();

static int ltc4151_probe(struct i2c_client *client)
{}

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

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

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

module_i2c_driver();

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