LM Sensors development
 help / color / mirror / Atom feed
From: Domenico Andreoli <domenico.andreoli@linux.com>
To: lm-sensors@vger.kernel.org
Subject: Configuring PWM sysfs entries
Date: Sun, 25 Oct 2020 09:45:20 +0000	[thread overview]
Message-ID: <20201025094520.GA848@dumbo> (raw)

Hi,

I'm using fancontrol on a NanoPi M4 having a PWM controlled fan.

This is the configuration I'm using:

INTERVAL=10
FCTEMPS=/sys/class/pwm/pwmchip1/pwm0/duty_cycle=/sys/class/hwmon/hwmon1/temp1_input
MINTEMP=/sys/class/pwm/pwmchip1/pwm0/duty_cycle=45
MAXTEMP=/sys/class/pwm/pwmchip1/pwm0/duty_cycle=70
MINSTART=/sys/class/pwm/pwmchip1/pwm0/duty_cycle=1500000
MINSTOP=/sys/class/pwm/pwmchip1/pwm0/duty_cycle=1500000
MAXPWM=/sys/class/pwm/pwmchip1/pwm0/duty_cycle=10000000

This is effective only after sysfs has been configured:

PWM=0
CHIP=1
POLARITY=normal
PERIOD=10000000

echo $PWM > /sys/class/pwm/pwmchip$CHIP/export
echo $PERIOD > /sys/class/pwm/pwmchip$CHIP/pwm$PWM/period
echo $POLARITY > /sys/class/pwm/pwmchip$CHIP/pwm$PWM/polarity
echo 1 > /sys/class/pwm/pwmchip$CHIP/pwm$PWM/enable

Additional caveat, fancontrol accepts PWM values up to 255 while my
configuration works iff such value is 1500000. Therefore I have to
comment out the max PWM value check in the fancontrol script.

Is this the best way to achieve the result?

Would you accept a patch to improve fancontrol and handle this situation
in a nicer way?

Kind regards,
Domenico

-- 
rsa4096: 3B10 0CA1 8674 ACBA B4FE  FCD2 CE5B CF17 9960 DE13
ed25519: FFB4 0CC3 7F2E 091D F7DA  356E CC79 2832 ED38 CB05

                 reply	other threads:[~2020-10-25  9:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201025094520.GA848@dumbo \
    --to=domenico.andreoli@linux.com \
    --cc=lm-sensors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox