mirror of
https://github.com/Fred78290/nct6687d
synced 2024-12-27 09:58:42 +01:00
FEAT: Add manual configuration support
This commit is contained in:
parent
dad02375e9
commit
4cbfe8084d
3 changed files with 108 additions and 8 deletions
49
README.md
49
README.md
|
@ -122,8 +122,57 @@ This module was tested on Ubuntu 20.04 with all kernel availble on motherboard [
|
||||||
## CHANGELOG
|
## CHANGELOG
|
||||||
|
|
||||||
- Add support for MSI B460M Bazooka having NCT6687 with another device ID
|
- Add support for MSI B460M Bazooka having NCT6687 with another device ID
|
||||||
|
- Add support to use generic voltage input without multiplier, allows sensors custom conf
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
## VOLTAGE MANUAL CONFIGURATION
|
||||||
|
|
||||||
|
Some people report that voltage are wrong. The reason is with some motherboard, voltage sensors are not connected on the same nct6687 register.
|
||||||
|
|
||||||
|
As example the **VCore** sensor is connected on the **5th** register for AMD but is connected on the **3rd** register for INTEL.
|
||||||
|
<br>
|
||||||
|
Also the **DIMM** sensor is connected on the **4th** register for AMD but connected to **5th** register for INTEL.
|
||||||
|
|
||||||
|
To allow customize voltage configuration you must add **manual=1** parameter passed to the module at load
|
||||||
|
|
||||||
|
`sudo sh -c 'echo "nct6687 manual=1" >> /etc/modules'`
|
||||||
|
|
||||||
|
And use a sensors conf like this **/etc/sensors.d/B460M-7C83.conf**
|
||||||
|
|
||||||
|
```
|
||||||
|
# Micro-Star International Co., Ltd.
|
||||||
|
# MAG B460M BAZOOKA (MS-7C83)
|
||||||
|
|
||||||
|
chip "nct6687-*"
|
||||||
|
label in0 "+12V"
|
||||||
|
label in1 "+5V"
|
||||||
|
label in2 "VCore"
|
||||||
|
label in3 "Voltage #1"
|
||||||
|
label in4 "DIMM"
|
||||||
|
label in5 "CPU I/O"
|
||||||
|
label in6 "CPU SA"
|
||||||
|
label in7 "Voltage #2"
|
||||||
|
label in8 "+3.3V"
|
||||||
|
label in9 "VTT"
|
||||||
|
label in10 "VRef"
|
||||||
|
label in11 "VSB"
|
||||||
|
label in12 "AVSB"
|
||||||
|
label in13 "VBat"
|
||||||
|
|
||||||
|
ignore in3
|
||||||
|
ignore in7
|
||||||
|
ignore in9
|
||||||
|
ignore in10
|
||||||
|
ignore in13
|
||||||
|
|
||||||
|
ignore temp6
|
||||||
|
ignore temp7
|
||||||
|
|
||||||
|
compute in0 (@ * 12), (@ / 12)
|
||||||
|
compute in1 (@ * 5), (@ / 5)
|
||||||
|
compute in4 (@ * 2), (@ / 2)
|
||||||
|
```
|
||||||
|
|
||||||
## VERIFIED
|
## VERIFIED
|
||||||
**1. Fan speed control**
|
**1. Fan speed control**
|
||||||
|
|
||||||
|
|
34
nct6687.c
34
nct6687.c
|
@ -46,9 +46,14 @@ enum kinds
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool force;
|
static bool force;
|
||||||
|
static bool manual;
|
||||||
|
|
||||||
module_param(force, bool, 0);
|
module_param(force, bool, 0);
|
||||||
MODULE_PARM_DESC(force, "Set to one to enable support for unknown vendors");
|
MODULE_PARM_DESC(force, "Set to one to enable support for unknown vendors");
|
||||||
|
|
||||||
|
module_param(manual, bool, 0);
|
||||||
|
MODULE_PARM_DESC(manual, "Set voltage input and voltage label configured with external sensors file");
|
||||||
|
|
||||||
static const char *const nct6687_device_names[] = {
|
static const char *const nct6687_device_names[] = {
|
||||||
"nct6683",
|
"nct6683",
|
||||||
"nct6687",
|
"nct6687",
|
||||||
|
@ -400,6 +405,16 @@ struct sensor_template_group
|
||||||
|
|
||||||
static void nct6687_save_fan_control(struct nct6687_data *data, int index);
|
static void nct6687_save_fan_control(struct nct6687_data *data, int index);
|
||||||
|
|
||||||
|
static const char* nct6687_voltage_label(char* buf, int index)
|
||||||
|
{
|
||||||
|
if (manual)
|
||||||
|
sprintf(buf, "in%d", index);
|
||||||
|
else
|
||||||
|
strcpy(buf, nct6687_voltage_definition[index].label);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
static struct attribute_group *nct6687_create_attr_group(struct device *dev, const struct sensor_template_group *tg, int repeat)
|
static struct attribute_group *nct6687_create_attr_group(struct device *dev, const struct sensor_template_group *tg, int repeat)
|
||||||
{
|
{
|
||||||
struct sensor_device_attribute_2 *a2;
|
struct sensor_device_attribute_2 *a2;
|
||||||
|
@ -527,21 +542,22 @@ static void nct6687_update_temperatures(struct nct6687_data *data)
|
||||||
static void nct6687_update_voltage(struct nct6687_data *data)
|
static void nct6687_update_voltage(struct nct6687_data *data)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
char buf[128];
|
||||||
|
|
||||||
/* Measured voltages and limits */
|
/* Measured voltages and limits */
|
||||||
for (index = 0; index < NCT6687_NUM_REG_VOLTAGE; index++)
|
for (index = 0; index < NCT6687_NUM_REG_VOLTAGE; index++)
|
||||||
{
|
{
|
||||||
s16 reg = nct6687_voltage_definition[index].reg;
|
s16 reg = manual ? index : nct6687_voltage_definition[index].reg;
|
||||||
s16 high = nct6687_read(data, NCT6687_REG_VOLTAGE(reg)) * 16;
|
s16 high = nct6687_read(data, NCT6687_REG_VOLTAGE(reg)) * 16;
|
||||||
s16 low = ((u16)nct6687_read(data, NCT6687_REG_VOLTAGE(reg) + 1)) >> 4;
|
s16 low = ((u16)nct6687_read(data, NCT6687_REG_VOLTAGE(reg) + 1)) >> 4;
|
||||||
s16 value = low + high;
|
s16 value = low + high;
|
||||||
s16 voltage = value * nct6687_voltage_definition[index].multiplier;
|
s16 voltage = manual ? value : value * nct6687_voltage_definition[index].multiplier;
|
||||||
|
|
||||||
data->voltage[0][index] = voltage;
|
data->voltage[0][index] = voltage;
|
||||||
data->voltage[1][index] = MIN(voltage, data->voltage[1][index]);
|
data->voltage[1][index] = MIN(voltage, data->voltage[1][index]);
|
||||||
data->voltage[2][index] = MAX(voltage, data->voltage[2][index]);
|
data->voltage[2][index] = MAX(voltage, data->voltage[2][index]);
|
||||||
|
|
||||||
pr_debug("nct6687_update_voltage[%d], %s, addr=0x%04x, value=%d, voltage=%d\n", index, nct6687_voltage_definition[index].label, NCT6687_REG_VOLTAGE(index), value, voltage);
|
pr_debug("nct6687_update_voltage[%d], %s, reg=%d, addr=0x%04x, value=%d, voltage=%d\n", index, nct6687_voltage_label(buf, index), reg, NCT6687_REG_VOLTAGE(index), value, voltage);
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_debug("nct6687_update_voltage\n");
|
pr_debug("nct6687_update_voltage\n");
|
||||||
|
@ -603,7 +619,10 @@ static ssize_t show_voltage_label(struct device *dev, struct device_attribute *a
|
||||||
{
|
{
|
||||||
struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
|
struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
|
||||||
|
|
||||||
return sprintf(buf, "%s\n", nct6687_voltage_definition[sattr->index].label);
|
if (manual)
|
||||||
|
return sprintf(buf, "in%d\n", sattr->index);
|
||||||
|
else
|
||||||
|
return sprintf(buf, "%s\n", nct6687_voltage_definition[sattr->index].label);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_voltage_value(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_voltage_value(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
|
@ -871,21 +890,22 @@ static void nct6687_setup_fans(struct nct6687_data *data)
|
||||||
static void nct6687_setup_voltages(struct nct6687_data *data)
|
static void nct6687_setup_voltages(struct nct6687_data *data)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
char buf[64];
|
||||||
|
|
||||||
/* Measured voltages and limits */
|
/* Measured voltages and limits */
|
||||||
for (index = 0; index < NCT6687_NUM_REG_VOLTAGE; index++)
|
for (index = 0; index < NCT6687_NUM_REG_VOLTAGE; index++)
|
||||||
{
|
{
|
||||||
s16 reg = nct6687_voltage_definition[index].reg;
|
s16 reg = manual ? index : nct6687_voltage_definition[index].reg;
|
||||||
s16 high = nct6687_read(data, NCT6687_REG_VOLTAGE(reg)) * 16;
|
s16 high = nct6687_read(data, NCT6687_REG_VOLTAGE(reg)) * 16;
|
||||||
s16 low = ((u16)nct6687_read(data, NCT6687_REG_VOLTAGE(reg) + 1)) >> 4;
|
s16 low = ((u16)nct6687_read(data, NCT6687_REG_VOLTAGE(reg) + 1)) >> 4;
|
||||||
s16 value = low + high;
|
s16 value = low + high;
|
||||||
s16 voltage = value * nct6687_voltage_definition[index].multiplier;
|
s16 voltage = manual ? value : value * nct6687_voltage_definition[index].multiplier;
|
||||||
|
|
||||||
data->voltage[0][index] = voltage;
|
data->voltage[0][index] = voltage;
|
||||||
data->voltage[1][index] = voltage;
|
data->voltage[1][index] = voltage;
|
||||||
data->voltage[2][index] = voltage;
|
data->voltage[2][index] = voltage;
|
||||||
|
|
||||||
pr_debug("nct6687_setup_voltages[%d], %s, addr=0x%04x, value=%d, voltage=%d\n", index, nct6687_voltage_definition[index].label, NCT6687_REG_VOLTAGE(index), value, voltage);
|
pr_debug("nct6687_setup_voltages[%d], %s, addr=0x%04x, value=%d, voltage=%d\n", index, nct6687_voltage_label(buf, index), NCT6687_REG_VOLTAGE(index), value, voltage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
31
sensors.d/B460M-7C83.conf
Normal file
31
sensors.d/B460M-7C83.conf
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
# Micro-Star International Co., Ltd.
|
||||||
|
# MAG B460M BAZOOKA (MS-7C83)
|
||||||
|
|
||||||
|
chip "nct6687-*"
|
||||||
|
label in0 "+12V"
|
||||||
|
label in1 "+5V"
|
||||||
|
label in2 "VCore"
|
||||||
|
label in3 "Voltage #1"
|
||||||
|
label in4 "DIMM"
|
||||||
|
label in5 "CPU I/O"
|
||||||
|
label in6 "CPU SA"
|
||||||
|
label in7 "Voltage #2"
|
||||||
|
label in8 "+3.3V"
|
||||||
|
label in9 "VTT"
|
||||||
|
label in10 "VRef"
|
||||||
|
label in11 "VSB"
|
||||||
|
label in12 "AVSB"
|
||||||
|
label in13 "VBat"
|
||||||
|
|
||||||
|
ignore in3
|
||||||
|
ignore in7
|
||||||
|
ignore in9
|
||||||
|
ignore in10
|
||||||
|
ignore in13
|
||||||
|
|
||||||
|
ignore temp6
|
||||||
|
ignore temp7
|
||||||
|
|
||||||
|
compute in0 (@ * 12), (@ / 12)
|
||||||
|
compute in1 (@ * 5), (@ / 5)
|
||||||
|
compute in4 (@ * 2), (@ / 2)
|
Loading…
Reference in a new issue