(F75387) How expose automatic fan control in sysfs?
Hi,
I am working on adding automatic fan control configuration to the f75375s driver. I have code that is almost complete and working well, but I wonder what is the best way to expose this in the sysfs.
The F75387 fan control chip configuration can be fully switched between open loop mode, where it is programmed with raw PWM values, and closed loop mode, where one specifies desired RPM fan speeds instead.
However, both modes use the same configuration input registers.
The lm-sensors standard sysfs interface defines that RPM target values should be exposed using filenames fan*_target, and PWM values via pwm*. For automatic, temperature-bounded fan control values, only pwm*_auto_point*_pwm files are defined.
Now I wonder, what is the best way to expose the configuration for the F75387 in sysfs?
Trying to match the standard sysfs interface makes me think I need to expose different files in sysfs, depending on the mode. That is, pwm* and pwm*_auto_point*_pwm for open loop mode, and for closed loop mode fan*_target and, hmm, I guess ${TYPE}*_auto_point*_fan where I'm not sure what to put into $TYPE... Any suggestions for $TYPE?
But then, if the user switches between open and closed loop mode, all these mode-specific filenames in sysfs need be switched over, since it would make no sense to keep the files for the inactive mode around, right? This makes me feel slightly unhappy. Thoughts?
Of course, one could inhibit the mode switching and just stick with the mode that was enabled by the BIOS. But I don't see why the user should not be empowered to switch modes; and I have tested this, and it works like a charm.
I would very much appreciate your thoughts on this.
Thanks,
Nikolaus
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 17 lines · Nikolaus Schulz
Hi,
I am working on adding automatic fan control configuration to the f75375s driver. I have code that is almost complete and working well, but I wonder what is the best way to expose this in the sysfs.
The F75387 fan control chip configuration can be fully switched between open loop mode, where it is programmed with raw PWM values, and closed loop mode, where one specifies desired RPM fan speeds instead.
However, both modes use the same configuration input registers.
The lm-sensors standard sysfs interface defines that RPM target values should be exposed using filenames fan*_target, and PWM values via pwm*. For automatic, temperature-bounded fan control values, only pwm*_auto_point*_pwm files are defined.
Quoted 9 lines
Now I wonder, what is the best way to expose the configuration for the F75387 in sysfs?
Trying to match the standard sysfs interface makes me think I need to expose different files in sysfs, depending on the mode. That is, pwm* and pwm*_auto_point*_pwm for open loop mode, and for closed loop mode fan*_target and, hmm, I guess ${TYPE}*_auto_point*_fan where I'm not sure what to put into $TYPE... Any suggestions for $TYPE?
Maybe Jean has an idea here. There are various drivers with slightly different (and sometimes undocumented) pwm attributes around. Maybe it is time to clean up the ABI and define a complete (or at least more complete) set of attributes.
Quoted 5 lines
But then, if the user switches between open and closed loop mode, all these mode-specific filenames in sysfs need be switched over, since it would make no sense to keep the files for the inactive mode around, right? This makes me feel slightly unhappy. Thoughts?
You should be able to keep all attributes around, even if some may not be active at a given time. Otherwise, you would not be able to program auto mode parameters until you enabled auto mode ... which would not be a good idea.
Quoted 5 lines
Of course, one could inhibit the mode switching and just stick with the mode that was enabled by the BIOS. But I don't see why the user should not be empowered to switch modes; and I have tested this, and it works like a charm.
More a matter of avoiding risk, I would guess. If you let the user program auto mode, you probably want to have some kind of validation before the mode is actually enabled, to at least try to avoid board fatalities. This is really highly driver specific, and has to be very well tested.
I have been thinking about doing the same for the w83627ehf driver. Pretty much the same problem - some attributes are missing in the ABI, and others only apply to certain modes. So I am definitely interested in a generic set of attibutes.
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 25 lines · Guenter Roeck
Quoted 15 lines · Nikolaus Schulz
I am working on adding automatic fan control configuration to the f75375s driver. I have code that is almost complete and working well, but I wonder what is the best way to expose this in the sysfs.
The F75387 fan control chip configuration can be fully switched between open loop mode, where it is programmed with raw PWM values, and closed loop mode, where one specifies desired RPM fan speeds instead.
However, both modes use the same configuration input registers.
The lm-sensors standard sysfs interface defines that RPM target values should be exposed using filenames fan*_target, and PWM values via pwm*. For automatic, temperature-bounded fan control values, only pwm*_auto_point*_pwm files are defined.
Quoted 8 lines
Now I wonder, what is the best way to expose the configuration for the F75387 in sysfs?
Trying to match the standard sysfs interface makes me think I need to expose different files in sysfs, depending on the mode. That is, pwm* and pwm*_auto_point*_pwm for open loop mode, and for closed loop mode fan*_target and, hmm, I guess ${TYPE}*_auto_point*_fan where I'm not sure what to put into $TYPE... Any suggestions for $TYPE?
Quoted 4 lines
Maybe Jean has an idea here. There are various drivers with slightly different (and sometimes undocumented) pwm attributes around. Maybe it is time to clean up the ABI and define a complete (or at least more complete) set of attributes.
Yes, it looks like the current sysfs interface standard is lacking.
Quoted 9 lines
Quoted 5 lines
But then, if the user switches between open and closed loop mode, all these mode-specific filenames in sysfs need be switched over, since it would make no sense to keep the files for the inactive mode around, right? This makes me feel slightly unhappy. Thoughts?
You should be able to keep all attributes around, even if some may not be active at a given time. Otherwise, you would not be able to program auto mode parameters until you enabled auto mode ... which would not be a good idea.
Unfortunately, the F75387 uses the very same registers for both modes. The values are only interpreted differently, depending on the open vs closed loop mode, either as RPM values, or raw PWM.
Quoted 9 lines
Quoted 5 lines
Of course, one could inhibit the mode switching and just stick with the mode that was enabled by the BIOS. But I don't see why the user should not be empowered to switch modes; and I have tested this, and it works like a charm.
More a matter of avoiding risk, I would guess. If you let the user program auto mode, you probably want to have some kind of validation before the mode is actually enabled, to at least try to avoid board fatalities.
Not possible for the F75387, for the reason above.
Quoted 2 lines
This is really highly driver specific, and has to be very well tested.
Agreed
Quoted 6 lines
I have been thinking about doing the same for the w83627ehf driver. Pretty much the same problem - some attributes are missing in the ABI, and others only apply to certain modes. So I am definitely interested in a generic set of attibutes.
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 38 lines · Nikolaus Schulz
Quoted 25 lines · Guenter Roeck
Quoted 15 lines · Nikolaus Schulz
I am working on adding automatic fan control configuration to the f75375s driver. I have code that is almost complete and working well, but I wonder what is the best way to expose this in the sysfs.
The F75387 fan control chip configuration can be fully switched between open loop mode, where it is programmed with raw PWM values, and closed loop mode, where one specifies desired RPM fan speeds instead.
However, both modes use the same configuration input registers.
The lm-sensors standard sysfs interface defines that RPM target values should be exposed using filenames fan*_target, and PWM values via pwm*. For automatic, temperature-bounded fan control values, only pwm*_auto_point*_pwm files are defined.
Quoted 8 lines
Now I wonder, what is the best way to expose the configuration for the F75387 in sysfs?
Trying to match the standard sysfs interface makes me think I need to expose different files in sysfs, depending on the mode. That is, pwm* and pwm*_auto_point*_pwm for open loop mode, and for closed loop mode fan*_target and, hmm, I guess ${TYPE}*_auto_point*_fan where I'm not sure what to put into $TYPE... Any suggestions for $TYPE?
Quoted 4 lines
Maybe Jean has an idea here. There are various drivers with slightly different (and sometimes undocumented) pwm attributes around. Maybe it is time to clean up the ABI and define a complete (or at least more complete) set of attributes.
Yes, it looks like the current sysfs interface standard is lacking.
Quoted 5 lines
Quoted 5 lines
But then, if the user switches between open and closed loop mode, all these mode-specific filenames in sysfs need be switched over, since it would make no sense to keep the files for the inactive mode around, right? This makes me feel slightly unhappy. Thoughts?
Quoted 9 lines
Quoted 4 lines
You should be able to keep all attributes around, even if some may not be active at a given time. Otherwise, you would not be able to program auto mode parameters until you enabled auto mode ... which would not be a good idea.
Unfortunately, the F75387 uses the very same registers for both modes. The values are only interpreted differently, depending on the open vs closed loop mode, either as RPM values, or raw PWM.
Other chips do the same, or something similar. For example, the NCT6775F uses the same register for the target speed in one mode, and for the target temperature in another.
In this example, we have to be able to set both. The w83627ehf driver "solves" that problem by implementing pwmX_target, which is specified in the driver documentation as target temperature. Depending on the mode, it can also be interpreted by the chip as target speed. Not the most elegant solution, but at least it works (though maybe we should document it ;). Unless Jean has a better idea, I would suggest to do the same.
Guenter
Quoted 22 lines
Quoted 9 lines
Quoted 5 lines
Of course, one could inhibit the mode switching and just stick with the mode that was enabled by the BIOS. But I don't see why the user should not be empowered to switch modes; and I have tested this, and it works like a charm.
More a matter of avoiding risk, I would guess. If you let the user program auto mode, you probably want to have some kind of validation before the mode is actually enabled, to at least try to avoid board fatalities.
Not possible for the F75387, for the reason above.
Quoted 2 lines
This is really highly driver specific, and has to be very well tested.
Agreed
Quoted 5 lines
I have been thinking about doing the same for the w83627ehf driver. Pretty much the same problem - some attributes are missing in the ABI, and others only apply to certain modes. So I am definitely interested in a generic set of attibutes.
Quoted 6 lines
Quoted 1 line
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 9 lines · Guenter Roeck
Quoted 3 lines · Nikolaus Schulz
Unfortunately, the F75387 uses the very same registers for both modes. The values are only interpreted differently, depending on the open vs closed loop mode, either as RPM values, or raw PWM.
Other chips do the same, or something similar. For example, the NCT6775F uses the same register for the target speed in one mode, and for the target temperature in another.
Quoted 6 lines
In this example, we have to be able to set both. The w83627ehf driver "solves" that problem by implementing
pwmX_target, which is specified in the driver documentation as target temperature. Depending on the mode, it can also be interpreted by the chip as target speed. Not the most elegant solution, but at least it works (though maybe we should document it ;). Unless Jean has a better idea, I would suggest to do the same.
In this specific case, what you want to do is decouple the register cache from the actual hardware registers. In your per-device private data structure, have room to store all the settings for all mode. This means that a given hardware register can have 2 or more corresponding members in the data structure, one for each meaning it can have depending on the mode.
You can see an example of this in driver it87:
struct it87_data {
(...)
/* The following 3 arrays correspond to the same registers up to
* the IT8720F. The meaning of bits 6-0 depends on the value of bit
* 7, and we want to preserve settings on mode changes, so we have
* to track all values separately.
* Starting with the IT8721F, the manual PWM duty cycles are stored
* in separate registers (8-bit values), so the separate tracking
* is no longer needed, but it is still done to keep the driver
* simple. */
u8 pwm_ctrl[3]; /* Register value */
u8 pwm_duty[3]; /* Manual PWM value set by user */
u8 pwm_temp_map[3]; /* PWM to temp. chan. mapping (bits 1-0) */
When reading the register value from the chip, you write them to the right struct member for the given mode, and leave the other untouched. When values are changed by the user through sysfs, you store them in the data structure. If they relate to the currently selected mode, you write them to the chip immediately. If not, you keep them for later.
When the user changes the mode through sysfs, you write that mode change to the chip, and then automatically program the new mode using the settings from the data structure.
So, to make it clear, it is perfectly possible (and desirable) to handle such devices without coming up with a custom and obscure sysfs interface. The shared registers can and must be abstracted by the driver and the user shouldn't notice.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 17 lines · Nikolaus Schulz
Quoted 16 lines · Guenter Roeck
Quoted 15 lines · Nikolaus Schulz
I am working on adding automatic fan control configuration to the f75375s driver. I have code that is almost complete and working well, but I wonder what is the best way to expose this in the sysfs.
The F75387 fan control chip configuration can be fully switched between open loop mode, where it is programmed with raw PWM values, and closed loop mode, where one specifies desired RPM fan speeds instead.
However, both modes use the same configuration input registers.
The lm-sensors standard sysfs interface defines that RPM target values should be exposed using filenames fan*_target, and PWM values via pwm*. For automatic, temperature-bounded fan control values, only pwm*_auto_point*_pwm files are defined.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Now I wonder, what is the best way to expose the configuration for the F75387 in sysfs?
Trying to match the standard sysfs interface makes me think I need to expose different files in sysfs, depending on the mode. That is, pwm* and pwm*_auto_point*_pwm for open loop mode, and for closed loop mode fan*_target and, hmm, I guess ${TYPE}*_auto_point*_fan where I'm not sure what to put into $TYPE... Any suggestions for $TYPE?
I'm not sure what exactly you want to put in this file, so I can't answer. The mapping between PWM output and fan input? If so that would be pwm[1-*]_auto_channels_fan (which isn't yet defined in out standard sysfs interface but could be added.)
Or, if what your chip does is multiple RPM targets based on the temperature, i.e. a mix of temperature trip points mode and fan speed target mode, then indeed our sysfs interface is lacking standard file names for this (I can't remember another chip supporting this.) Following the other attribute names, the proper name could be pwm[1-*]_auto_point[1-*]_fan_target.
I hope I replied to your question.
Quoted 6 lines
Quoted 4 lines
Maybe Jean has an idea here. There are various drivers with slightly different (and sometimes undocumented) pwm attributes around. Maybe it is time to clean up the ABI and define a complete (or at least more complete) set of attributes.
Yes, it looks like the current sysfs interface standard is lacking.
Blame it on my, I designed it, years ago. I remember a number of people argued about it, but I did not listen, in part because I am stubborn, in part because they did not propose any alternative. This is possibly the worse memory I have since I am involved in the lm-sensors project.
One (now) very obvious mistake I made back then is that I did not abstract the fan speed controller units from PWM outputs. If we design a new API then we really want to start with controllers, and then associate one or more PWM (or DC) outputs, zero or more temperature channels, and zero or more fan speed inputs to the controller. Note that depending on the mode, temperature or fan input may be irrelevant. Also note that for some (most?) chips, some of these settings will be hard-coded and not changeable by the user. Lastly, note that in some cases we will NOT know the associations, in particular for the fan inputs, the chip only needs to know in speed target mode, so if the chip doesn't support that, we just don't know.
I do not exactly have the amount of spare time it would take to work on this right now. If someone wants to work on this, go ahead and I'll be happy to review the proposal. If not, I'm putting this on my to-do list.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 46 lines · Jean Delvare
Quoted 9 lines · Guenter Roeck
Quoted 3 lines · Nikolaus Schulz
Unfortunately, the F75387 uses the very same registers for both modes. The values are only interpreted differently, depending on the open vs closed loop mode, either as RPM values, or raw PWM.
Other chips do the same, or something similar. For example, the NCT6775F uses the same register for the target speed in one mode, and for the target temperature in another.
Quoted 6 lines
In this example, we have to be able to set both. The w83627ehf driver "solves" that problem by implementing
pwmX_target, which is specified in the driver documentation as target temperature. Depending on the mode, it can also be interpreted by the chip as target speed. Not the most elegant solution, but at least it works (though maybe we should document it ;). Unless Jean has a better idea, I would suggest to do the same.In this specific case, what you want to do is decouple the register cache from the actual hardware registers. In your per-device private data structure, have room to store all the settings for all mode. This means that a given hardware register can have 2 or more corresponding members in the data structure, one for each meaning it can have depending on the mode.
You can see an example of this in driver it87:
struct
it87_data{
(...)
/* The following 3 arrays correspond to the same registers up to
* the IT8720F. The meaning of bits 6-0 depends on the value of bit
* 7, and we want to preserve settings on mode changes, so we have
* to track all values separately.
* Starting with the IT8721F, the manual PWM duty cycles are stored
* in separate registers (8-bit values), so the separate tracking
* is no longer needed, but it is still done to keep the driver
* simple. */
u8 pwm_ctrl[3]; /* Register value */
u8 pwm_duty[3]; /* Manual PWM value set by user */
u8 pwm_temp_map[3]; /* PWM to temp. chan. mapping (bits 1-0) */When reading the register value from the chip, you write them to the right struct member for the given mode, and leave the other untouched. When values are changed by the user through sysfs, you store them in the data structure. If they relate to the currently selected mode, you write them to the chip immediately. If not, you keep them for later.
Quoted 9 lines
When the user changes the mode through sysfs, you write that mode change to the chip, and then automatically program the new mode using the settings from the data structure.
So, to make it clear, it is perfectly possible (and desirable) to handle such devices without coming up with a custom and obscure sysfs interface. The shared registers can and must be abstracted by the driver and the user shouldn't notice.
Excellent idea. I think I'll do the same for the nct6775f if/when I have time.
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 9 lines · Jean Delvare
Quoted 8 lines · Guenter Roeck
Quoted 3 lines · Nikolaus Schulz
Unfortunately, the F75387 uses the very same registers for both modes. The values are only interpreted differently, depending on the open vs closed loop mode, either as RPM values, or raw PWM.
Other chips do the same, or something similar. For example, the NCT6775F uses the same register for the target speed in one mode, and for the target temperature in another.
[...]
Quoted 6 lines
In this specific case, what you want to do is decouple the register cache from the actual hardware registers. In your per-device private data structure, have room to store all the settings for all mode. This means that a given hardware register can have 2 or more corresponding members in the data structure, one for each meaning it can have depending on the mode.
[...]
Quoted 9 lines
When reading the register value from the chip, you write them to the right struct member for the given mode, and leave the other untouched. When values are changed by the user through sysfs, you store them in the data structure. If they relate to the currently selected mode, you write them to the chip immediately. If not, you keep them for later.
When the user changes the mode through sysfs, you write that mode change to the chip, and then automatically program the new mode using the settings from the data structure.
Very elegant and convincing. My thinking obviously has been too tied to the device specific details, thanks for your guidance. :)
I will apply this to the f75375 driver.
Nikolaus
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 22 lines · Jean Delvare
Quoted 21 lines · Nikolaus Schulz
Quoted 20 lines · Guenter Roeck
Quoted 19 lines · Nikolaus Schulz
The F75387 fan control chip configuration can be fully switched between open loop mode, where it is programmed with raw PWM values, and closed loop mode, where one specifies desired RPM fan speeds instead.
However, both modes use the same configuration input registers.
The lm-sensors standard sysfs interface defines that RPM target values should be exposed using filenames fan*_target, and PWM values via pwm*. For automatic, temperature-bounded fan control values, only pwm*_auto_point*_pwm files are defined.
Now I wonder, what is the best way to expose the configuration for the F75387 in sysfs?
Trying to match the standard sysfs interface makes me think I need to expose different files in sysfs, depending on the mode. That is, pwm* and pwm*_auto_point*_pwm for open loop mode, and for closed loop mode fan*_target and, hmm, I guess ${TYPE}*_auto_point*_fan where I'm not sure what to put into $TYPE... Any suggestions for $TYPE?
[...]
Quoted 4 lines
[...] if what your chip does is multiple RPM targets based on the temperature, i.e. a mix of temperature trip points mode and fan speed target mode, then indeed our sysfs interface is lacking standard file names for this
Yes, this is what the F75387 does in closed loop mode. All fan target values are then specified in RPM, not PWM, including the temperature-bounded for automatic fan control.
Quoted 1 line
(I can't remember another chip supporting this.)
Apparently the F71805F does this, and it is supported by the hwmon driver. This driver uses the sysfs filenames pwm*_auto_point*_fan.
Quoted 2 lines
Following the other attribute names, the proper name could be pwm[1-*]_auto_point[1-*]_fan_target.
That sounds better and more consistent than the name chosen for the f71805f.
I am not very happy about using the pwm* prefix, since the fan speed need not be driven using PWM at all. This issue alone probably doesn't warrant coming up with a more abstract naming scheme; unfortunately there are more. But still, until such a scheme exists, I'll stick to your proposal.
Quoted 1 line
I hope I replied to your question.
You did, at least the part about the file naming, thanks. :)
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Maybe Jean has an idea here. There are various drivers with slightly different (and sometimes undocumented) pwm attributes around. Maybe it is time to clean up the ABI and define a complete (or at least more complete) set of attributes.
Yes, it looks like the current sysfs interface standard is lacking.
[...]
Quoted 3 lines
One (now) very obvious mistake I made back then is that I did not abstract the fan speed controller units from PWM outputs.
Right, that's exactly my remaining unhappiness above was about.
Let me add two more things.
First, I doubt that it's a good idea to put the fan*_target value into the fan domain. After all, this value is about fan *control*, not about fan state, which I think suggests it might better reside in the pwm domain (that is, the domain of the fan controller). This is emphasized by having fan*_target in the fan domain, and pwm*_auto_point*_fan_target in the pwm domain, as you suggested above. One domain should win here, and I think it should be the latter.
Second, the F75387 draws a distinction between the actual (PWM or DAC) output value and the configured target value. The current definition of pwm*, on the other hand, not only encodes the steering method (PWM), but also mixes target value and actual value. Does it make sense to keep these values separate in sysfs?
Quoted 10 lines
If we design a new API then we really want to start with controllers, and then associate one or more PWM (or DC) outputs, zero or more temperature channels, and zero or more fan speed inputs to the controller. Note that depending on the mode, temperature or fan input may be irrelevant. Also note that for some (most?) chips, some of these settings will be hard-coded and not changeable by the user. Lastly, note that in some cases we will NOT know the associations, in particular for the fan inputs, the chip only needs to know in speed target mode, so if the chip doesn't support that, we just don't know.
Quoted 4 lines
I do not exactly have the amount of spare time it would take to work on this right now. If someone wants to work on this, go ahead and I'll be happy to review the proposal. If not, I'm putting this on my to-do list.
I doubt I will make it, due to lack of time, and lack of experience in the sensors area. :/
Nikolaus
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 6 lines · Nikolaus Schulz
Quoted 4 lines · Jean Delvare
[...] if what your chip does is multiple RPM targets based on the temperature, i.e. a mix of temperature trip points mode and fan speed target mode, then indeed our sysfs interface is lacking standard file names for this
Quoted 8 lines
Yes, this is what the F75387 does in closed loop mode. All fan target values are then specified in RPM, not PWM, including the temperature-bounded for automatic fan control.
Quoted 1 line
(I can't remember another chip supporting this.)
Apparently the F71805F does this, and it is supported by the hwmon driver. This driver uses the sysfs filenames pwm*_auto_point*_fan.
Wow. This is my driver, I didn't write this part of the code but I signed than patch so I must have reviewed it, and I did not remember it at all.
Quoted 5 lines
Quoted 2 lines
Following the other attribute names, the proper name could be pwm[1-*]_auto_point[1-*]_fan_target.
That sounds better and more consistent than the name chosen for the f71805f.
What is bad is that the name used in the f71805f driver isn't part of the standard. Changing it now would be worse. Using a different name in your driver would be even worse. So you may not like it, but using it would be preferred. And documenting it, this time.
Quoted 5 lines
I am not very happy about using the pwm* prefix, since the fan speed need not be driven using PWM at all. This issue alone probably doesn't warrant coming up with a more abstract naming scheme; unfortunately there are more. But still, until such a scheme exists, I'll stick to your proposal.
"pwm" in all attribute names really mean "fan control". I agree it can be confusing and was a design mistake in the first place. At least I'm not to blame this time.
Quoted 8 lines
Quoted 3 lines
(...)
One (now) very obvious mistake I made back then is that I did not abstract the fan speed controller units from PWM outputs.Right, that's exactly my remaining unhappiness above was about.
Let me add two more things.
Quoted 7 lines
First, I doubt that it's a good idea to put the fan*_target value into the fan domain. After all, this value is about fan *control*, not about fan state, which I think suggests it might better reside in the pwm domain (that is, the domain of the fan controller). This is emphasized by having fan*_target in the fan domain, and pwm*_auto_point*_fan_target in the pwm domain, as you suggested above. One domain should win here, and I think it should be the latter.
You're right. fan[1-*]_target was my idea (if I remember correctly) and shows that I did not notice that "target speed control mode" was a degenerated case of "closed-loop temperature trip point driven control mode". OTOH it isn't always clear if we want to represent degenerated cases differently to present a more simple interface to the user, or not to keep things as consistent as possible. No doubt that this is something we will have to revisit if/when designing a brand new interface.
Quoted 5 lines
Second, the F75387 draws a distinction between the actual (PWM or DAC) output value and the configured target value. The current definition of pwm*, on the other hand, not only encodes the steering method (PWM), but also mixes target value and actual value. Does it make sense to keep these values separate in sysfs?
How could the actual PWM duty cycle ever differ from the desired one? I don't get it.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 23 lines · Jean Delvare
Quoted 6 lines · Nikolaus Schulz
Quoted 4 lines · Jean Delvare
[...] if what your chip does is multiple RPM targets based on the temperature, i.e. a mix of temperature trip points mode and fan speed target mode, then indeed our sysfs interface is lacking standard file names for this
Quoted 8 lines
Yes, this is what the F75387 does in closed loop mode. All fan target values are then specified in RPM, not PWM, including the temperature-bounded for automatic fan control.
Quoted 1 line
(I can't remember another chip supporting this.)
Apparently the F71805F does this, and it is supported by the hwmon driver. This driver uses the sysfs filenames pwm*_auto_point*_fan.
Wow. This is my driver, I didn't write this part of the code but I signed than patch so I must have reviewed it, and I did not remember it at all.
Quoted 3 lines
Quoted 2 lines
Following the other attribute names, the proper name could be pwm[1-*]_auto_point[1-*]_fan_target.
Quoted 7 lines
Quoted 2 lines
That sounds better and more consistent than the name chosen for the f71805f.
What is bad is that the name used in the f71805f driver isn't part of the standard. Changing it now would be worse. Using a different name in your driver would be even worse. So you may not like it, but using it would be preferred. And documenting it, this time.
Okay.
This should then go into both the sysfs interface doc and the driver specific doc. I'm willing to try that.
[...]
Quoted 8 lines
Quoted 5 lines
Second, the F75387 draws a distinction between the actual (PWM or DAC) output value and the configured target value. The current definition of pwm*, on the other hand, not only encodes the steering method (PWM), but also mixes target value and actual value. Does it make sense to keep these values separate in sysfs?
How could the actual PWM duty cycle ever differ from the desired one? I don't get it.
At least in theory it can, since the desired PWM duty cycle is bound to the open loop mode. If the fan controller runs in closed loop mode, that setting might be ignored.
One can consider this an example of your (smart) suggestion to expose r/w sysfs configuration files for all modes, including inactive ones, so that the user can use the sysfs files to compose a complete configuration for a mode that is currently inactive, and activate the mode when he is done, thereby activating all corresponding settings in one go.
Nikolaus
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 13 lines · Nikolaus Schulz
Quoted 8 lines
Quoted 5 lines
Second, the F75387 draws a distinction between the actual (PWM or DAC) output value and the configured target value. The current definition of pwm*, on the other hand, not only encodes the steering method (PWM), but also mixes target value and actual value. Does it make sense to keep these values separate in sysfs?
How could the actual PWM duty cycle ever differ from the desired one? I don't get it.
At least in theory it can, since the desired PWM duty cycle is bound to the open loop mode. If the fan controller runs in closed loop mode, that setting might be ignored.
Quoted 6 lines
One can consider this an example of your (smart) suggestion to expose r/w sysfs configuration files for all modes, including inactive ones, so that the user can use the sysfs files to compose a complete configuration for a mode that is currently inactive, and activate the mode when he is done, thereby activating all corresponding settings in one go.
Here actually lies another problem when programming the F78387.
This chip exposes the current duty cycle in a register that is always r/o. The fan is steered using a second register, which is used in both open loop mode, where it is interpreted as a PWM value, and closed loop mode, where it is interpreted as a RPM value. (In automatic mode, this steering register is automatically set, depending on the temperature.)
This is similar to the problem with the automatic mode of the F75387 I mentioned in my initial post: the configuration register is reused, thus a switch between manual open loop mode and manual closed loop mode is a dangerous operation.
To support such a mode switch safely, there should be a way to set the values for the new mode before the switch.
For automatic mode, you proposed to always expose separate r/w sysfs files for both open and closed loop mode, and handle this in the driver.
For manual mode, switching from open to closed loop can be done by writing to fan*_target before the switch, and again handle this in the driver. However, the other direction doesn't work, since the pwm* file is overloaded, providing measurement *and* configuration. What can be done here? Introduce a new file pwm*_target?
I have to say I am not particularly excited about this. Better ideas are welcome.
Nikolaus
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors