linux/include/linux/hwmon.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
    hwmon.h - part of lm_sensors, Linux kernel modules for hardware monitoring

    This file declares helper functions for the sysfs class "hwmon",
    for use by sensors drivers.

    Copyright (C) 2005 Mark M. Hoffman <[email protected]>

*/

#ifndef _HWMON_H_
#define _HWMON_H_

#include <linux/bitops.h>

struct device;
struct attribute_group;

enum hwmon_sensor_types {};

enum hwmon_chip_attributes {};

#define HWMON_C_TEMP_RESET_HISTORY
#define HWMON_C_IN_RESET_HISTORY
#define HWMON_C_CURR_RESET_HISTORY
#define HWMON_C_POWER_RESET_HISTORY
#define HWMON_C_REGISTER_TZ
#define HWMON_C_UPDATE_INTERVAL
#define HWMON_C_ALARMS
#define HWMON_C_SAMPLES
#define HWMON_C_CURR_SAMPLES
#define HWMON_C_IN_SAMPLES
#define HWMON_C_POWER_SAMPLES
#define HWMON_C_TEMP_SAMPLES
#define HWMON_C_BEEP_ENABLE
#define HWMON_C_PEC

enum hwmon_temp_attributes {};

#define HWMON_T_ENABLE
#define HWMON_T_INPUT
#define HWMON_T_TYPE
#define HWMON_T_LCRIT
#define HWMON_T_LCRIT_HYST
#define HWMON_T_MIN
#define HWMON_T_MIN_HYST
#define HWMON_T_MAX
#define HWMON_T_MAX_HYST
#define HWMON_T_CRIT
#define HWMON_T_CRIT_HYST
#define HWMON_T_EMERGENCY
#define HWMON_T_EMERGENCY_HYST
#define HWMON_T_ALARM
#define HWMON_T_MIN_ALARM
#define HWMON_T_MAX_ALARM
#define HWMON_T_CRIT_ALARM
#define HWMON_T_LCRIT_ALARM
#define HWMON_T_EMERGENCY_ALARM
#define HWMON_T_FAULT
#define HWMON_T_OFFSET
#define HWMON_T_LABEL
#define HWMON_T_LOWEST
#define HWMON_T_HIGHEST
#define HWMON_T_RESET_HISTORY
#define HWMON_T_RATED_MIN
#define HWMON_T_RATED_MAX
#define HWMON_T_BEEP

enum hwmon_in_attributes {};

#define HWMON_I_ENABLE
#define HWMON_I_INPUT
#define HWMON_I_MIN
#define HWMON_I_MAX
#define HWMON_I_LCRIT
#define HWMON_I_CRIT
#define HWMON_I_AVERAGE
#define HWMON_I_LOWEST
#define HWMON_I_HIGHEST
#define HWMON_I_RESET_HISTORY
#define HWMON_I_LABEL
#define HWMON_I_ALARM
#define HWMON_I_MIN_ALARM
#define HWMON_I_MAX_ALARM
#define HWMON_I_LCRIT_ALARM
#define HWMON_I_CRIT_ALARM
#define HWMON_I_RATED_MIN
#define HWMON_I_RATED_MAX
#define HWMON_I_BEEP
#define HWMON_I_FAULT

enum hwmon_curr_attributes {};

#define HWMON_C_ENABLE
#define HWMON_C_INPUT
#define HWMON_C_MIN
#define HWMON_C_MAX
#define HWMON_C_LCRIT
#define HWMON_C_CRIT
#define HWMON_C_AVERAGE
#define HWMON_C_LOWEST
#define HWMON_C_HIGHEST
#define HWMON_C_RESET_HISTORY
#define HWMON_C_LABEL
#define HWMON_C_ALARM
#define HWMON_C_MIN_ALARM
#define HWMON_C_MAX_ALARM
#define HWMON_C_LCRIT_ALARM
#define HWMON_C_CRIT_ALARM
#define HWMON_C_RATED_MIN
#define HWMON_C_RATED_MAX
#define HWMON_C_BEEP

enum hwmon_power_attributes {};

#define HWMON_P_ENABLE
#define HWMON_P_AVERAGE
#define HWMON_P_AVERAGE_INTERVAL
#define HWMON_P_AVERAGE_INTERVAL_MAX
#define HWMON_P_AVERAGE_INTERVAL_MIN
#define HWMON_P_AVERAGE_HIGHEST
#define HWMON_P_AVERAGE_LOWEST
#define HWMON_P_AVERAGE_MAX
#define HWMON_P_AVERAGE_MIN
#define HWMON_P_INPUT
#define HWMON_P_INPUT_HIGHEST
#define HWMON_P_INPUT_LOWEST
#define HWMON_P_RESET_HISTORY
#define HWMON_P_ACCURACY
#define HWMON_P_CAP
#define HWMON_P_CAP_HYST
#define HWMON_P_CAP_MAX
#define HWMON_P_CAP_MIN
#define HWMON_P_MIN
#define HWMON_P_MAX
#define HWMON_P_LCRIT
#define HWMON_P_CRIT
#define HWMON_P_LABEL
#define HWMON_P_ALARM
#define HWMON_P_CAP_ALARM
#define HWMON_P_MIN_ALARM
#define HWMON_P_MAX_ALARM
#define HWMON_P_LCRIT_ALARM
#define HWMON_P_CRIT_ALARM
#define HWMON_P_RATED_MIN
#define HWMON_P_RATED_MAX

enum hwmon_energy_attributes {};

#define HWMON_E_ENABLE
#define HWMON_E_INPUT
#define HWMON_E_LABEL

enum hwmon_humidity_attributes {};

#define HWMON_H_ENABLE
#define HWMON_H_INPUT
#define HWMON_H_LABEL
#define HWMON_H_MIN
#define HWMON_H_MIN_HYST
#define HWMON_H_MAX
#define HWMON_H_MAX_HYST
#define HWMON_H_ALARM
#define HWMON_H_FAULT
#define HWMON_H_RATED_MIN
#define HWMON_H_RATED_MAX
#define HWMON_H_MIN_ALARM
#define HWMON_H_MAX_ALARM

enum hwmon_fan_attributes {};

#define HWMON_F_ENABLE
#define HWMON_F_INPUT
#define HWMON_F_LABEL
#define HWMON_F_MIN
#define HWMON_F_MAX
#define HWMON_F_DIV
#define HWMON_F_PULSES
#define HWMON_F_TARGET
#define HWMON_F_ALARM
#define HWMON_F_MIN_ALARM
#define HWMON_F_MAX_ALARM
#define HWMON_F_FAULT
#define HWMON_F_BEEP

enum hwmon_pwm_attributes {};

#define HWMON_PWM_INPUT
#define HWMON_PWM_ENABLE
#define HWMON_PWM_MODE
#define HWMON_PWM_FREQ
#define HWMON_PWM_AUTO_CHANNELS_TEMP

enum hwmon_intrusion_attributes {};
#define HWMON_INTRUSION_ALARM
#define HWMON_INTRUSION_BEEP

/**
 * struct hwmon_ops - hwmon device operations
 * @is_visible: Callback to return attribute visibility. Mandatory.
 *		Parameters are:
 *		@const void *drvdata:
 *			Pointer to driver-private data structure passed
 *			as argument to hwmon_device_register_with_info().
 *		@type:	Sensor type
 *		@attr:	Sensor attribute
 *		@channel:
 *			Channel number
 *		The function returns the file permissions.
 *		If the return value is 0, no attribute will be created.
 * @read:	Read callback for data attributes. Mandatory if readable
 *		data attributes are present.
 *		Parameters are:
 *		@dev:	Pointer to hardware monitoring device
 *		@type:	Sensor type
 *		@attr:	Sensor attribute
 *		@channel:
 *			Channel number
 *		@val:	Pointer to returned value
 *		The function returns 0 on success or a negative error number.
 * @read_string:
 *		Read callback for string attributes. Mandatory if string
 *		attributes are present.
 *		Parameters are:
 *		@dev:	Pointer to hardware monitoring device
 *		@type:	Sensor type
 *		@attr:	Sensor attribute
 *		@channel:
 *			Channel number
 *		@str:	Pointer to returned string
 *		The function returns 0 on success or a negative error number.
 * @write:	Write callback for data attributes. Mandatory if writeable
 *		data attributes are present.
 *		Parameters are:
 *		@dev:	Pointer to hardware monitoring device
 *		@type:	Sensor type
 *		@attr:	Sensor attribute
 *		@channel:
 *			Channel number
 *		@val:	Value to write
 *		The function returns 0 on success or a negative error number.
 */
struct hwmon_ops {};

/**
 * struct hwmon_channel_info - Channel information
 * @type:	Channel type.
 * @config:	Pointer to NULL-terminated list of channel parameters.
 *		Use for per-channel attributes.
 */
struct hwmon_channel_info {};

#define HWMON_CHANNEL_INFO(stype, ...)

/**
 * struct hwmon_chip_info - Chip configuration
 * @ops:	Pointer to hwmon operations.
 * @info:	Null-terminated list of channel information.
 */
struct hwmon_chip_info {};

/* hwmon_device_register() is deprecated */
struct device *hwmon_device_register(struct device *dev);

/*
 * hwmon_device_register_with_groups() and
 * devm_hwmon_device_register_with_groups() are deprecated.
 */
struct device *
hwmon_device_register_with_groups(struct device *dev, const char *name,
				  void *drvdata,
				  const struct attribute_group **groups);
struct device *
devm_hwmon_device_register_with_groups(struct device *dev, const char *name,
				       void *drvdata,
				       const struct attribute_group **groups);
struct device *
hwmon_device_register_with_info(struct device *dev,
				const char *name, void *drvdata,
				const struct hwmon_chip_info *info,
				const struct attribute_group **extra_groups);
struct device *
hwmon_device_register_for_thermal(struct device *dev, const char *name,
				  void *drvdata);
struct device *
devm_hwmon_device_register_with_info(struct device *dev,
				const char *name, void *drvdata,
				const struct hwmon_chip_info *info,
				const struct attribute_group **extra_groups);

void hwmon_device_unregister(struct device *dev);
void devm_hwmon_device_unregister(struct device *dev);

int hwmon_notify_event(struct device *dev, enum hwmon_sensor_types type,
		       u32 attr, int channel);

char *hwmon_sanitize_name(const char *name);
char *devm_hwmon_sanitize_name(struct device *dev, const char *name);

/**
 * hwmon_is_bad_char - Is the char invalid in a hwmon name
 * @ch: the char to be considered
 *
 * hwmon_is_bad_char() can be used to determine if the given character
 * may not be used in a hwmon name.
 *
 * Returns true if the char is invalid, false otherwise.
 */
static inline bool hwmon_is_bad_char(const char ch)
{}

#endif