linux/drivers/hwmon/tps23861.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2020 Sartura Ltd.
 *
 * Driver for the TI TPS23861 PoE PSE.
 *
 * Author: Robert Marko <[email protected]>
 */

#include <linux/bitfield.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/hwmon-sysfs.h>
#include <linux/hwmon.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/regmap.h>

#define TEMPERATURE
#define INPUT_VOLTAGE_LSB
#define INPUT_VOLTAGE_MSB
#define PORT_1_CURRENT_LSB
#define PORT_1_CURRENT_MSB
#define PORT_1_VOLTAGE_LSB
#define PORT_1_VOLTAGE_MSB
#define PORT_2_CURRENT_LSB
#define PORT_2_CURRENT_MSB
#define PORT_2_VOLTAGE_LSB
#define PORT_2_VOLTAGE_MSB
#define PORT_3_CURRENT_LSB
#define PORT_3_CURRENT_MSB
#define PORT_3_VOLTAGE_LSB
#define PORT_3_VOLTAGE_MSB
#define PORT_4_CURRENT_LSB
#define PORT_4_CURRENT_MSB
#define PORT_4_VOLTAGE_LSB
#define PORT_4_VOLTAGE_MSB
#define PORT_N_CURRENT_LSB_OFFSET
#define PORT_N_VOLTAGE_LSB_OFFSET
#define VOLTAGE_CURRENT_MASK
#define PORT_1_RESISTANCE_LSB
#define PORT_1_RESISTANCE_MSB
#define PORT_2_RESISTANCE_LSB
#define PORT_2_RESISTANCE_MSB
#define PORT_3_RESISTANCE_LSB
#define PORT_3_RESISTANCE_MSB
#define PORT_4_RESISTANCE_LSB
#define PORT_4_RESISTANCE_MSB
#define PORT_N_RESISTANCE_LSB_OFFSET
#define PORT_RESISTANCE_MASK
#define PORT_RESISTANCE_RSN_MASK
#define PORT_RESISTANCE_RSN_OTHER
#define PORT_RESISTANCE_RSN_LOW
#define PORT_RESISTANCE_RSN_OPEN
#define PORT_RESISTANCE_RSN_SHORT
#define PORT_1_STATUS
#define PORT_2_STATUS
#define PORT_3_STATUS
#define PORT_4_STATUS
#define PORT_STATUS_CLASS_MASK
#define PORT_STATUS_DETECT_MASK
#define PORT_CLASS_UNKNOWN
#define PORT_CLASS_1
#define PORT_CLASS_2
#define PORT_CLASS_3
#define PORT_CLASS_4
#define PORT_CLASS_RESERVED
#define PORT_CLASS_0
#define PORT_CLASS_OVERCURRENT
#define PORT_CLASS_MISMATCH
#define PORT_DETECT_UNKNOWN
#define PORT_DETECT_SHORT
#define PORT_DETECT_RESERVED
#define PORT_DETECT_RESISTANCE_LOW
#define PORT_DETECT_RESISTANCE_OK
#define PORT_DETECT_RESISTANCE_HIGH
#define PORT_DETECT_OPEN_CIRCUIT
#define PORT_DETECT_RESERVED_2
#define PORT_DETECT_MOSFET_FAULT
#define PORT_DETECT_LEGACY
/* Measurment beyond clamp voltage */
#define PORT_DETECT_CAPACITANCE_INVALID_BEYOND
/* Insufficient voltage delta */
#define PORT_DETECT_CAPACITANCE_INVALID_DELTA
#define PORT_DETECT_CAPACITANCE_OUT_OF_RANGE
#define POE_PLUS
#define OPERATING_MODE
#define OPERATING_MODE_OFF
#define OPERATING_MODE_MANUAL
#define OPERATING_MODE_SEMI
#define OPERATING_MODE_AUTO
#define OPERATING_MODE_PORT_1_MASK
#define OPERATING_MODE_PORT_2_MASK
#define OPERATING_MODE_PORT_3_MASK
#define OPERATING_MODE_PORT_4_MASK

#define DETECT_CLASS_RESTART
#define POWER_ENABLE
#define TPS23861_NUM_PORTS

#define TPS23861_GENERAL_MASK_1
#define TPS23861_CURRENT_SHUNT_MASK

#define TEMPERATURE_LSB
#define VOLTAGE_LSB
#define SHUNT_RESISTOR_DEFAULT
#define CURRENT_LSB_250
#define CURRENT_LSB_255
#define RESISTANCE_LSB
#define RESISTANCE_LSB_LOW

struct tps23861_data {};

static const struct regmap_config tps23861_regmap_config =;

static int tps23861_read_temp(struct tps23861_data *data, long *val)
{}

static int tps23861_read_voltage(struct tps23861_data *data, int channel,
				 long *val)
{}

static int tps23861_read_current(struct tps23861_data *data, int channel,
				 long *val)
{}

static int tps23861_port_disable(struct tps23861_data *data, int channel)
{}

static int tps23861_port_enable(struct tps23861_data *data, int channel)
{}

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

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

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

static const char * const tps23861_port_label[] =;

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

static const struct hwmon_channel_info * const tps23861_info[] =;

static const struct hwmon_ops tps23861_hwmon_ops =;

static const struct hwmon_chip_info tps23861_chip_info =;

static char *port_operating_mode_string(uint8_t mode_reg, unsigned int port)
{}

static char *port_detect_status_string(uint8_t status_reg)
{}

static char *port_class_status_string(uint8_t status_reg)
{}

static char *port_poe_plus_status_string(uint8_t poe_plus, unsigned int port)
{}

static int tps23861_port_resistance(struct tps23861_data *data, int port)
{}

static int tps23861_port_status_show(struct seq_file *s, void *data)
{}

DEFINE_SHOW_ATTRIBUTE();

static void tps23861_init_debugfs(struct tps23861_data *data,
				  struct device *hwmon_dev)
{}

static int tps23861_probe(struct i2c_client *client)
{}

static void tps23861_remove(struct i2c_client *client)
{}

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

static struct i2c_driver tps23861_driver =;
module_i2c_driver();

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