linux/drivers/hwmon/ltc2947-core.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Analog Devices LTC2947 high precision power and energy monitor
 *
 * Copyright 2019 Analog Devices Inc.
 */
#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/regmap.h>

#include "ltc2947.h"

/* register's */
#define LTC2947_REG_PAGE_CTRL
#define LTC2947_REG_CTRL
#define LTC2947_REG_TBCTL
#define LTC2947_CONT_MODE_MASK
#define LTC2947_CONT_MODE(x)
#define LTC2947_PRE_MASK
#define LTC2947_PRE(x)
#define LTC2947_DIV_MASK
#define LTC2947_DIV(x)
#define LTC2947_SHUTDOWN_MASK
#define LTC2947_REG_ACCUM_POL
#define LTC2947_ACCUM_POL_1_MASK
#define LTC2947_ACCUM_POL_1(x)
#define LTC2947_ACCUM_POL_2_MASK
#define LTC2947_ACCUM_POL_2(x)
#define LTC2947_REG_ACCUM_DEADBAND
#define LTC2947_REG_GPIOSTATCTL
#define LTC2947_GPIO_EN_MASK
#define LTC2947_GPIO_EN(x)
#define LTC2947_GPIO_FAN_EN_MASK
#define LTC2947_GPIO_FAN_EN(x)
#define LTC2947_GPIO_FAN_POL_MASK
#define LTC2947_GPIO_FAN_POL(x)
#define LTC2947_REG_GPIO_ACCUM
/* 200Khz */
#define LTC2947_CLK_MIN
/* 25Mhz */
#define LTC2947_CLK_MAX
#define LTC2947_PAGE0
#define LTC2947_PAGE1
/* Voltage registers */
#define LTC2947_REG_VOLTAGE
#define LTC2947_REG_VOLTAGE_MAX
#define LTC2947_REG_VOLTAGE_MIN
#define LTC2947_REG_VOLTAGE_THRE_H
#define LTC2947_REG_VOLTAGE_THRE_L
#define LTC2947_REG_DVCC
#define LTC2947_REG_DVCC_MAX
#define LTC2947_REG_DVCC_MIN
#define LTC2947_REG_DVCC_THRE_H
#define LTC2947_REG_DVCC_THRE_L
#define LTC2947_VOLTAGE_GEN_CHAN
#define LTC2947_VOLTAGE_DVCC_CHAN
/* in mV */
#define VOLTAGE_MAX
#define VOLTAGE_MIN
#define VDVCC_MAX
#define VDVCC_MIN
/* Current registers */
#define LTC2947_REG_CURRENT
#define LTC2947_REG_CURRENT_MAX
#define LTC2947_REG_CURRENT_MIN
#define LTC2947_REG_CURRENT_THRE_H
#define LTC2947_REG_CURRENT_THRE_L
/* in mA */
#define CURRENT_MAX
#define CURRENT_MIN
/* Power registers */
#define LTC2947_REG_POWER
#define LTC2947_REG_POWER_MAX
#define LTC2947_REG_POWER_MIN
#define LTC2947_REG_POWER_THRE_H
#define LTC2947_REG_POWER_THRE_L
/* in uW */
#define POWER_MAX
#define POWER_MIN
/* Temperature registers */
#define LTC2947_REG_TEMP
#define LTC2947_REG_TEMP_MAX
#define LTC2947_REG_TEMP_MIN
#define LTC2947_REG_TEMP_THRE_H
#define LTC2947_REG_TEMP_THRE_L
#define LTC2947_REG_TEMP_FAN_THRE_H
#define LTC2947_REG_TEMP_FAN_THRE_L
#define LTC2947_TEMP_FAN_CHAN
/* in millidegress Celsius */
#define TEMP_MAX
#define TEMP_MIN
/* Energy registers */
#define LTC2947_REG_ENERGY1
#define LTC2947_REG_ENERGY2
/* Status/Alarm/Overflow registers */
#define LTC2947_REG_STATUS
#define LTC2947_REG_STATVT
#define LTC2947_REG_STATIP
#define LTC2947_REG_STATVDVCC

#define LTC2947_ALERTS_SIZE
#define LTC2947_MAX_VOLTAGE_MASK
#define LTC2947_MIN_VOLTAGE_MASK
#define LTC2947_MAX_CURRENT_MASK
#define LTC2947_MIN_CURRENT_MASK
#define LTC2947_MAX_POWER_MASK
#define LTC2947_MIN_POWER_MASK
#define LTC2947_MAX_TEMP_MASK
#define LTC2947_MIN_TEMP_MASK
#define LTC2947_MAX_TEMP_FAN_MASK
#define LTC2947_MIN_TEMP_FAN_MASK

struct ltc2947_data {};

static int __ltc2947_val_read16(const struct ltc2947_data *st, const u8 reg,
				u64 *val)
{}

static int __ltc2947_val_read24(const struct ltc2947_data *st, const u8 reg,
				u64 *val)
{}

static int __ltc2947_val_read64(const struct ltc2947_data *st, const u8 reg,
				u64 *val)
{}

static int ltc2947_val_read(struct ltc2947_data *st, const u8 reg,
			    const u8 page, const size_t size, s64 *val)
{}

static int __ltc2947_val_write64(const struct ltc2947_data *st, const u8 reg,
				 const u64 val)
{}

static int __ltc2947_val_write16(const struct ltc2947_data *st, const u8 reg,
				 const u16 val)
{}

static int ltc2947_val_write(struct ltc2947_data *st, const u8 reg,
			     const u8 page, const size_t size, const u64 val)
{}

static int ltc2947_reset_history(struct ltc2947_data *st, const u8 reg_h,
				 const u8 reg_l)
{}

static int ltc2947_alarm_read(struct ltc2947_data *st, const u8 reg,
			      const u32 mask, long *val)
{}

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

static int ltc2947_read_temp(struct device *dev, const u32 attr, long *val,
			     const int channel)
{}

static int ltc2947_read_power(struct device *dev, const u32 attr, long *val)
{}

static int ltc2947_read_curr(struct device *dev, const u32 attr, long *val)
{}

static int ltc2947_read_in(struct device *dev, const u32 attr, long *val,
			   const int channel)
{}

static int ltc2947_read(struct device *dev, enum hwmon_sensor_types type,
			u32 attr, int channel, long *val)
{}

static int ltc2947_write_temp(struct device *dev, const u32 attr,
			      long val, const int channel)
{}

static int ltc2947_write_power(struct device *dev, const u32 attr,
			       long val)
{}

static int ltc2947_write_curr(struct device *dev, const u32 attr,
			      long val)
{}

static int ltc2947_write_in(struct device *dev, const u32 attr, long val,
			    const int channel)
{}

static int ltc2947_write(struct device *dev,
			 enum hwmon_sensor_types type,
			 u32 attr, int channel, long val)
{}

static int ltc2947_read_labels(struct device *dev,
			       enum hwmon_sensor_types type,
			       u32 attr, int channel, const char **str)
{}

static int ltc2947_in_is_visible(const u32 attr)
{}

static int ltc2947_curr_is_visible(const u32 attr)
{}

static int ltc2947_power_is_visible(const u32 attr)
{}

static int ltc2947_temp_is_visible(const u32 attr)
{}

static umode_t ltc2947_is_visible(const void *data,
				  enum hwmon_sensor_types type,
				  u32 attr, int channel)
{}

static const struct hwmon_channel_info * const ltc2947_info[] =;

static const struct hwmon_ops ltc2947_hwmon_ops =;

static const struct hwmon_chip_info ltc2947_chip_info =;

/* energy attributes are 6bytes wide so we need u64 */
static SENSOR_DEVICE_ATTR(energy1_input, 0444, ltc2947_show_value, NULL,
			  LTC2947_REG_ENERGY1);
static SENSOR_DEVICE_ATTR(energy2_input, 0444, ltc2947_show_value, NULL,
			  LTC2947_REG_ENERGY2);

static struct attribute *ltc2947_attrs[] =;
ATTRIBUTE_GROUPS();

static int ltc2947_setup(struct ltc2947_data *st)
{}

int ltc2947_core_probe(struct regmap *map, const char *name)
{}
EXPORT_SYMBOL_GPL();

static int ltc2947_resume(struct device *dev)
{}

static int ltc2947_suspend(struct device *dev)
{}

EXPORT_SIMPLE_DEV_PM_OPS();

const struct of_device_id ltc2947_of_match[] =;
EXPORT_SYMBOL_GPL();
MODULE_DEVICE_TABLE(of, ltc2947_of_match);

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