From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Guenter Roeck <linux@roeck-us.net>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Jean Delvare <jdelvare@suse.com>,
Thierry Reding <thierry.reding@gmail.com>,
Lee Jones <lee.jones@linaro.org>,
Markus Niebel <Markus.Niebel@ew.tq-group.com>,
linux-hwmon@vger.kernel.org, linux-pwm@vger.kernel.org
Subject: Re: (EXT) Re: (EXT) Re: [PATCH v2 1/1] hwmon: pwm-fan: dynamically switch regulator
Date: Fri, 06 May 2022 10:35:21 +0200 [thread overview]
Message-ID: <2371611.jE0xQCEvom@steina-w> (raw)
In-Reply-To: <20220506082001.hybxzaic5wza7irh@pengutronix.de>
Am Freitag, 6. Mai 2022, 10:20:01 CEST schrieb Uwe Kleine-König:
> * PGP Signed by an unknown key
>
> Hello,
>
> On Fri, May 06, 2022 at 09:15:55AM +0200, Alexander Stein wrote:
> > Am Freitag, 6. Mai 2022, 00:00:37 CEST schrieb Guenter Roeck:
> > > On Wed, May 04, 2022 at 02:45:51PM +0200, Alexander Stein wrote:
> > > > From: Markus Niebel <Markus.Niebel@ew.tq-group.com>
> > > >
> > > > A pwm value equal to zero is meant to switch off the pwm
> > > > hence also switching off the fan. Currently the optional
> > > > regulator is always on. When using this driver on boards
> > > > with an inverted pwm signal polarity this can cause running
> > > > the fan at maximum speed when setting pwm to zero.
> > >
> > > The appropriate solution in this case would be to tell the
> > > software that the pwm is inverted. Turning off the regulator
> > > in that situation is a bad idea since setting the pwm value to
> > > 1 would set it to almost full speed. That does not really make
> > > sense.
> >
> > The pwm-fan driver is already configured for inverted PWM (ommited some
> > properties for shortness):
> > fan0: pwm-fan {
> >
> > compatible = "pwm-fan";
> > fan-supply = <®_pwm_fan>;
> > pwms = <&pwm3 0 40000 PWM_POLARITY_INVERTED>;
> > cooling-levels = <0 32 64 128 196 240>;
> >
> > [...]
> > };
> >
> > The problem here is that the pwm-fan driver currently enables the
> > regulator
> > unconditionally, but the PWM only when the fan is enabled, refer to
> > __set_pwm(). This results in a fan at full speed when pwm-fan is idle, as
> > pwm state is not enabled.
>
> Which PWM driver are you using?
It's pwm-imx27 on a imx8mp based board.
> There is an implicit assumption in some PWM consumers that a disabled
> PWM emits the inactive level. However not all PWMs do this. Is this such
> a case?
Oh, I was not aware of that assumption. As far I can tell, this assumption
might actually be violated in pwm-imx27.
If state->enabled==false then the EN Bit in PWMCR is not set which most
probably renders the output polarity in POUTC as inactive.
Best regards,
Alexander
next prev parent reply other threads:[~2022-05-06 8:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-04 12:45 [PATCH v2 1/1] hwmon: pwm-fan: dynamically switch regulator Alexander Stein
2022-05-05 22:00 ` Guenter Roeck
2022-05-06 7:15 ` (EXT) " Markus Niebel
2022-05-06 7:15 ` Alexander Stein
2022-05-06 8:20 ` Uwe Kleine-König
2022-05-06 8:35 ` Alexander Stein [this message]
2022-05-06 10:23 ` (EXT) " Uwe Kleine-König
2022-05-06 12:23 ` (EXT) " Alexander Stein
2022-05-06 14:12 ` Guenter Roeck
2022-05-06 14:29 ` Uwe Kleine-König
2022-05-06 18:31 ` Guenter Roeck
2022-05-09 7:39 ` Alexander Stein
2022-05-09 10:59 ` Uwe Kleine-König
2022-05-09 12:10 ` Alexander Stein
2022-05-09 22:19 ` Guenter Roeck
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=2371611.jE0xQCEvom@steina-w \
--to=alexander.stein@ew.tq-group.com \
--cc=Markus.Niebel@ew.tq-group.com \
--cc=b.zolnierkie@samsung.com \
--cc=jdelvare@suse.com \
--cc=lee.jones@linaro.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.