Skip to content

Commit 154a0c2

Browse files
committed
hwmon: (amc6821) Rename fan1_div to fan1_pulses
The chip does not have a fan divisor. What it does have is a configuration to set either 2 or 4 pulses per fan rotation. Rename the attribute to reflect its use. Update documentation accordingly. Reviewed-by: Quentin Schulz <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
1 parent 8f4fd97 commit 154a0c2

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

Documentation/hwmon/amc6821.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fan1_input ro tachometer speed
4747
fan1_min rw "
4848
fan1_max rw "
4949
fan1_fault ro "
50-
fan1_div rw Fan divisor can be either 2 or 4.
50+
fan1_pulses rw Pulses per revolution can be either 2 or 4.
5151

5252
pwm1 rw pwm1
5353
pwm1_enable rw regulator mode, 1=open loop, 2=fan controlled

drivers/hwmon/amc6821.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ struct amc6821_data {
148148
int temp[TEMP_IDX_LEN];
149149

150150
u16 fan[FAN1_IDX_LEN];
151-
u8 fan1_div;
151+
u8 fan1_pulses;
152152

153153
u8 pwm1;
154154
u8 temp1_auto_point_temp[3];
@@ -193,9 +193,9 @@ static struct amc6821_data *amc6821_update_device(struct device *dev)
193193
client,
194194
fan_reg_hi[i]) << 8;
195195
}
196-
data->fan1_div = i2c_smbus_read_byte_data(client,
196+
data->fan1_pulses = i2c_smbus_read_byte_data(client,
197197
AMC6821_REG_CONF4);
198-
data->fan1_div = data->fan1_div & AMC6821_CONF4_PSPR ? 4 : 2;
198+
data->fan1_pulses = data->fan1_pulses & AMC6821_CONF4_PSPR ? 4 : 2;
199199

200200
data->pwm1_auto_point_pwm[0] = 0;
201201
data->pwm1_auto_point_pwm[2] = 255;
@@ -646,16 +646,16 @@ static ssize_t fan_store(struct device *dev, struct device_attribute *attr,
646646
return count;
647647
}
648648

649-
static ssize_t fan1_div_show(struct device *dev,
650-
struct device_attribute *devattr, char *buf)
649+
static ssize_t fan1_pulses_show(struct device *dev,
650+
struct device_attribute *devattr, char *buf)
651651
{
652652
struct amc6821_data *data = amc6821_update_device(dev);
653-
return sprintf(buf, "%d\n", data->fan1_div);
653+
return sprintf(buf, "%d\n", data->fan1_pulses);
654654
}
655655

656-
static ssize_t fan1_div_store(struct device *dev,
657-
struct device_attribute *attr, const char *buf,
658-
size_t count)
656+
static ssize_t fan1_pulses_store(struct device *dev,
657+
struct device_attribute *attr, const char *buf,
658+
size_t count)
659659
{
660660
struct amc6821_data *data = dev_get_drvdata(dev);
661661
struct i2c_client *client = data->client;
@@ -675,11 +675,11 @@ static ssize_t fan1_div_store(struct device *dev,
675675
switch (val) {
676676
case 2:
677677
config &= ~AMC6821_CONF4_PSPR;
678-
data->fan1_div = 2;
678+
data->fan1_pulses = 2;
679679
break;
680680
case 4:
681681
config |= AMC6821_CONF4_PSPR;
682-
data->fan1_div = 4;
682+
data->fan1_pulses = 4;
683683
break;
684684
default:
685685
count = -EINVAL;
@@ -714,7 +714,7 @@ static SENSOR_DEVICE_ATTR_RO(fan1_input, fan, IDX_FAN1_INPUT);
714714
static SENSOR_DEVICE_ATTR_RW(fan1_min, fan, IDX_FAN1_MIN);
715715
static SENSOR_DEVICE_ATTR_RW(fan1_max, fan, IDX_FAN1_MAX);
716716
static SENSOR_DEVICE_ATTR_RO(fan1_fault, fan1_fault, 0);
717-
static SENSOR_DEVICE_ATTR_RW(fan1_div, fan1_div, 0);
717+
static SENSOR_DEVICE_ATTR_RW(fan1_pulses, fan1_pulses, 0);
718718

719719
static SENSOR_DEVICE_ATTR_RW(pwm1, pwm1, 0);
720720
static SENSOR_DEVICE_ATTR_RW(pwm1_enable, pwm1_enable, 0);
@@ -757,7 +757,7 @@ static struct attribute *amc6821_attrs[] = {
757757
&sensor_dev_attr_fan1_min.dev_attr.attr,
758758
&sensor_dev_attr_fan1_max.dev_attr.attr,
759759
&sensor_dev_attr_fan1_fault.dev_attr.attr,
760-
&sensor_dev_attr_fan1_div.dev_attr.attr,
760+
&sensor_dev_attr_fan1_pulses.dev_attr.attr,
761761
&sensor_dev_attr_pwm1.dev_attr.attr,
762762
&sensor_dev_attr_pwm1_enable.dev_attr.attr,
763763
&sensor_dev_attr_pwm1_auto_channels_temp.dev_attr.attr,

0 commit comments

Comments
 (0)