<commit_before>/*
 * A hwmon driver for the Analog Devices ADT7473
 * Copyright (C) 2007 IBM
 *
 * Author: <NAME> <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <linux/module.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/delay.h>
#include <linux/log2.h>

/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x2C, 0x2D, 0x2E, I2C_CLIENT_END };

/* Insmod parameters */
I2C_CLIENT_INSMOD_1(adt7473);

/* ADT7473 registers */
#define ADT7473_REG_BASE_ADDR			0x20

#define ADT7473_REG_VOLT_BASE_ADDR		0x21
#define ADT7473_REG_VOLT_MAX_ADDR		0x22
#define ADT7473_REG_VOLT_MIN_BASE_ADDR		0x46
#define ADT7473_REG_VOLT_MIN_MAX_ADDR		0x49

#define ADT7473_REG_TEMP_BASE_ADDR		0x25
#define ADT7473_REG_TEMP_MAX_ADDR		0x27
#define ADT7473_REG_TEMP_LIMITS_BASE_ADDR	0x4E
#define ADT7473_REG_TEMP_LIMITS_MAX_ADDR	0x53
#define ADT7473_REG_TEMP_TMIN_BASE_ADDR		0x67
#define ADT7473_REG_TEMP_TMIN_MAX_ADDR		0x69
#define ADT7473_REG_TEMP_TMAX_BASE_ADDR		0x6A
#define ADT7473_REG_TEMP_TMAX_MAX_ADDR		0x6C

#define ADT7473_REG_FAN_BASE_ADDR		0x28
#define ADT7473_REG_FAN_MAX_ADDR		0x2F
#define ADT7473_REG_FAN_MIN_BASE_ADDR		0x54
#define ADT7473_REG_FAN_MIN_MAX_ADDR		0x5B

#define ADT7473_REG_PWM_BASE_ADDR		0x30
#define ADT7473_REG_PWM_MAX_ADDR		0x32
#define	ADT7473_REG_PWM_MIN_BASE_ADDR		0x64
#define ADT7473_REG_PWM_MIN_MAX_ADDR		0x66
#define ADT7473_REG_PWM_MAX_BASE_ADDR		0x38
#define ADT7473_REG_PWM_MAX_MAX_ADDR		0x3A
#define ADT7473_REG_PWM_BHVR_BASE_ADDR		0x5C
#define ADT7473_REG_PWM_BHVR_MAX_ADDR		0x5E
#define		ADT7473_PWM_BHVR_MASK		0xE0
#define		ADT7473_PWM_BHVR_SHIFT		5

#define ADT7473_REG_CFG1			0x40
#define 	ADT7473_CFG1_START		0x01
#define		ADT7473_CFG1_READY		0x04
#define ADT7473_REG_CFG2			0x73
#define ADT7473_REG_CFG3			0x78
#define ADT7473_REG_CFG4			0x7D
#define		ADT7473_CFG4_MAX_DUTY_AT_OVT	0x08
#define ADT7473_REG_CFG5			0x7C
#define		ADT7473_CFG5_TEMP_TWOS		0x01
#define		ADT7473_CFG5_TEMP_OFFSET	0x02

#define ADT7473_REG_DEVICE			0x3D
#define 	ADT7473_VENDOR			0x41
#define ADT7473_REG_VENDOR			0x3E
#define 	ADT7473_DEVICE			0x73
#define ADT7473_REG_REVISION			0x3F
#define 	ADT7473_REV_68			0x68
#define 	ADT7473_REV_69			0x69

#define ADT7473_REG_ALARM1			0x41
#define		ADT7473_VCCP_ALARM		0x02
#define		ADT7473_VCC_ALARM		0x04
#define		ADT7473_R1T_ALARM		0x10
#define		ADT7473_LT_ALARM		0x20
#define		ADT7473_R2T_ALARM		0x40
#define		ADT7473_OOL			0x80
#define ADT7473_REG_ALARM2			0x42
#define		ADT7473_OVT_ALARM		0x02
#define		ADT7473_FAN1_ALARM		0x04
#define		ADT7473_FAN2_ALARM		0x08
#define		ADT7473_FAN3_ALARM		0x10
#define		ADT7473_FAN4_ALARM		0x20
#define		ADT7473_R1T_SHORT		0x40
#define		ADT7473_R2T_SHORT		0x80
#define ADT7473_REG_MAX_ADDR			0x80

#define ALARM2(x)	((x) << 8)

#define ADT7473_VOLT_COUNT	2
#define ADT7473_REG_VOLT(x)	(ADT7473_REG_VOLT_BASE_ADDR + (x))
#define ADT7473_REG_VOLT_MIN(x)	(ADT7473_REG_VOLT_MIN_BASE_ADDR + ((x) * 2))
#define ADT7473_REG_VOLT_MAX(x)	(ADT7473_REG_VOLT_MIN_BASE_ADDR + \
				((x) * 2) + 1)

#define ADT7473_TEMP_COUNT	3
#define ADT7473_REG_TEMP(x)	(ADT7473_REG_TEMP_BASE_ADDR + (x))
#define ADT7473_REG_TEMP_MIN(x) (ADT7473_REG_TEMP_LIMITS_BASE_ADDR + ((x) * 2))
#define ADT7473_REG_TEMP_MAX(x) (ADT7473_REG_TEMP_LIMITS_BASE_ADDR + \
				((x) * 2) + 1)
#define ADT7473_REG_TEMP_TMIN(x)	(ADT7473_REG_TEMP_TMIN_BASE_ADDR + (x))
#define ADT7473_REG_TEMP_TMAX(x)	(ADT7473_REG_TEMP_TMAX_BASE_ADDR + (x))

#define ADT7473_FAN_COUNT	4
#define ADT7473_REG_FAN(x)	(ADT7473_REG_FAN_BASE_ADDR + ((x) * 2))
#define ADT7473_REG_FAN_MIN(x)	(ADT7473_REG_FAN_MIN_BASE_ADDR + ((x) * 2))

#define ADT7473_PWM_COUNT	3
#define ADT7473_REG_PWM(x)	(ADT7473_REG_PWM_BASE_ADDR + (x))
#define ADT7473_REG_PWM_MAX(x)	(ADT7473_REG_PWM_MAX_BASE_ADDR + (x))
#define ADT7473_REG_PWM_MIN(x)	(ADT7473_REG_PWM_MIN_BASE_ADDR + (x))
#define ADT7473_REG_PWM_BHVR(x)	(ADT7473_REG_PWM_BHVR_BASE_ADDR + (x))

/* How often do we reread sensors values? (In jiffies) */
#define SENSOR_REFRESH_INTERVAL	(2 * HZ)<commit_msg>hwmon: (adt7473) Remove unused defines<commit_after>/*
 * A hwmon driver for the Analog Devices ADT7473
 * Copyright (C) 2007 IBM
 *
 * Author: <NAME> <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <linux/module.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/delay.h>
#include <linux/log2.h>

/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x2C, 0x2D, 0x2E, I2C_CLIENT_END };

/* Insmod parameters */
I2C_CLIENT_INSMOD_1(adt7473);

/* ADT7473 registers */
#define ADT7473_REG_BASE_ADDR			0x20

#define ADT7473_REG_VOLT_BASE_ADDR		0x21
#define ADT7473_REG_VOLT_MIN_BASE_ADDR		0x46

#define ADT7473_REG_TEMP_BASE_ADDR		0x25
#define ADT7473_REG_TEMP_LIMITS_BASE_ADDR	0x4E
#define ADT7473_REG_TEMP_TMIN_BASE_ADDR		0x67
#define ADT7473_REG_TEMP_TMAX_BASE_ADDR		0x6A

#define ADT7473_REG_FAN_BASE_ADDR		0x28
#define ADT7473_REG_FAN_MIN_BASE_ADDR		0x54

#define ADT7473_REG_PWM_BASE_ADDR		0x30
#define	ADT7473_REG_PWM_MIN_BASE_ADDR		0x64
#define ADT7473_REG_PWM_MAX_BASE_ADDR		0x38
#define ADT7473_REG_PWM_BHVR_BASE_ADDR		0x5C
#define		ADT7473_PWM_BHVR_MASK		0xE0
#define		ADT7473_PWM_BHVR_SHIFT		5

#define ADT7473_REG_CFG1			0x40
#define 	ADT7473_CFG1_START		0x01
#define		ADT7473_CFG1_READY		0x04
#define ADT7473_REG_CFG2			0x73
#define ADT7473_REG_CFG3			0x78
#define ADT7473_REG_CFG4			0x7D
#define		ADT7473_CFG4_MAX_DUTY_AT_OVT	0x08
#define ADT7473_REG_CFG5			0x7C
#define		ADT7473_CFG5_TEMP_TWOS		0x01
#define		ADT7473_CFG5_TEMP_OFFSET	0x02

#define ADT7473_REG_DEVICE			0x3D
#define 	ADT7473_VENDOR			0x41
#define ADT7473_REG_VENDOR			0x3E
#define 	ADT7473_DEVICE			0x73
#define ADT7473_REG_REVISION			0x3F
#define 	ADT7473_REV_68			0x68
#define 	ADT7473_REV_69			0x69

#define ADT7473_REG_ALARM1			0x41
#define		ADT7473_VCCP_ALARM		0x02
#define		ADT7473_VCC_ALARM		0x04
#define		ADT7473_R1T_ALARM		0x10
#define		ADT7473_LT_ALARM		0x20
#define		ADT7473_R2T_ALARM		0x40
#define		ADT7473_OOL			0x80
#define ADT7473_REG_ALARM2			0x42
#define		ADT7473_OVT_ALARM		0x02
#define		ADT7473_FAN1_ALARM		0x04
#define		ADT7473_FAN2_ALARM		0x08
#define		ADT7473_FAN3_ALARM		0x10
#define		ADT7473_FAN4_ALARM		0x20
#define		ADT7473_R1T_SHORT		0x40
#define		ADT7473_R2T_SHORT		0x80

#define ALARM2(x)	((x) << 8)

#define ADT7473_VOLT_COUNT	2
#define ADT7473_REG_VOLT(x)	(ADT7473_REG_VOLT_BASE_ADDR + (x))
#define ADT7473_REG_VOLT_MIN(x)	(ADT7473_REG_VOLT_MIN_BASE_ADDR + ((x) * 2))
#define ADT7473_REG_VOLT_MAX(x)	(ADT7473_REG_VOLT_MIN_BASE_ADDR + \
				((x) * 2) + 1)

#define ADT7473_TEMP_COUNT	3
#define ADT7473_REG_TEMP(x)	(ADT7473_REG_TEMP_BASE_ADDR + (x))
#define ADT7473_REG_TEMP_MIN(x) (ADT7473_REG_TEMP_LIMITS_BASE_ADDR + ((x) * 2))
#define ADT7473_REG_TEMP_MAX(x) (ADT7473_REG_TEMP_LIMITS_BASE_ADDR + \
				((x) * 2) + 1)
#define ADT7473_REG_TEMP_TMIN(x)	(ADT7473_REG_TEMP_TMIN_BASE_ADDR + (x))
#define ADT7473_REG_TEMP_TMAX(x)	(ADT7473_REG_TEMP_TMAX_BASE_ADDR + (x))

#define ADT7473_FAN_COUNT	4
#define ADT7473_REG_FAN(x)	(ADT7473_REG_FAN_BASE_ADDR + ((x) * 2))
#define ADT7473_REG_FAN_MIN(x)	(ADT7473_REG_FAN_MIN_BASE_ADDR + ((x) * 2))

#define ADT7473_PWM_COUNT	3
#define ADT7473_REG_PWM(x)	(ADT7473_REG_PWM_BASE_ADDR + (x))
#define ADT7473_REG_PWM_MAX(x)	(ADT7473_REG_PWM_MAX_BASE_ADDR + (x))
#define ADT7473_REG_PWM_MIN(x)	(ADT7473_REG_PWM_MIN_BASE_ADDR + (x))
#define ADT7473_REG_PWM_BHVR(x)	(ADT7473_REG_PWM_BHVR_BASE_ADDR + (x))

/* How often do we reread sensors values? (In jiffies) */
#define SENSOR_REFRESH_INTERVAL	(2 * HZ)
{'fraction_non_alphanumeric': 0.07432730480811646, 'fraction_numerical': 0.12637847375385972, 'mean_word_length': 5.981524249422633, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6401940', 'n_tokens_mistral': 4869, 'n_tokens_neox': 4358, 'n_words': 838}