From: Thierry Reding <thierry.reding@gmail.com>
To: Fabio Estevam <festevam@gmail.com>
Cc: linux-pwm@vger.kernel.org, Rob Herring <robh@kernel.org>,
Russell King <linux@arm.linux.org.uk>,
Fabio Estevam <fabio.estevam@nxp.com>
Subject: Re: [PATCH v3] pwm: imx: Let PWM be active during suspend
Date: Mon, 11 Dec 2017 13:13:06 +0100 [thread overview]
Message-ID: <20171211121306.GK10671@ulmo> (raw)
In-Reply-To: <CAOMZO5DiOx5m1Wew9v5xaqgbcNDR7gio93EKP48bdM3kaqfkoA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2212 bytes --]
On Mon, Dec 11, 2017 at 08:54:19AM -0200, Fabio Estevam wrote:
> Hi Thierry,
>
> On Mon, Dec 11, 2017 at 7:16 AM, Thierry Reding
> <thierry.reding@gmail.com> wrote:
>
> > How does it break? Note that you have to change the polarity of the PWM
> > signal (in the pwms property) and then remove the "active-low" property
> > from the leds device tree node to avoid double inversion.
>
> This is what I tried as per your suggestion:
>
> --- a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi
> +++ b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi
> @@ -42,6 +42,7 @@
> #include "imx6qdl-microsom-ar8035.dtsi"
> #include <dt-bindings/input/input.h>
> #include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/pwm/pwm.h>
>
> / {
> ir_recv: ir-receiver {
> @@ -57,10 +58,9 @@
> pinctrl-0 = <&pinctrl_cubox_i_pwm1>;
>
> front {
> - active-low;
> label = "imx6:red:front";
> max-brightness = <248>;
> - pwms = <&pwm1 0 50000>;
> + pwms = <&pwm1 0 50000 PWM_POLARITY_INVERTED>;
> };
> };
>
> @@ -231,6 +231,7 @@
> };
>
> &pwm1 {
> + #pwm-cells = <3>;
> status = "okay";
> };
>
> The problem I see is that it seems to be an off-by-one calculation in
> the pwm-imx driver for the inverted polarity case.
>
> For example:
>
> # cd /sys/class/leds/imx6\:red\:front/
> # echo 0 > brightness (This keeps the LED on with its maximum brightness)
> # echo 1 > brightness (This keeps the LED off)
> # echo 248 > brightness (This keeps the LED on with its maximum brightness)
>
> When I go to suspend:
>
> # echo enabled > /sys/class/tty/ttymxc0/power/wakeup
> # echo mem > /sys/power/state
>
> Then LED goes on with its maximum brightness.
>
> So the issue now is that I need to tell the pwm-imx driver that '0'
> means to turn the LED off.
Yeah, my suggestion was to make setting the STOPEN bit dependent on the
polarity inversion setting of the PWM. That way you don't have to hard-
code it, which might not be the correct setting for non-inverted PWMs.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-12-11 12:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-20 23:27 [PATCH v3] pwm: imx: Let PWM be active during suspend Fabio Estevam
2017-12-04 12:29 ` Fabio Estevam
2017-12-05 8:47 ` Thierry Reding
2017-12-05 18:56 ` Fabio Estevam
2017-12-08 17:22 ` Fabio Estevam
2017-12-11 9:16 ` Thierry Reding
2017-12-11 9:36 ` Russell King - ARM Linux
2017-12-11 12:09 ` Thierry Reding
2017-12-11 10:54 ` Fabio Estevam
2017-12-11 12:13 ` Thierry Reding [this message]
2017-12-11 12:24 ` Fabio Estevam
2017-12-11 13:20 ` Lothar Waßmann
2017-12-11 15:07 ` Fabio Estevam
2017-12-11 15:55 ` Lothar Waßmann
2017-12-11 16:06 ` Fabio Estevam
2017-12-11 16:52 ` Lothar Waßmann
2017-12-11 18:48 ` Fabio Estevam
2017-12-15 12:02 ` Lothar Waßmann
2017-12-16 18:26 ` Fabio Estevam
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=20171211121306.GK10671@ulmo \
--to=thierry.reding@gmail.com \
--cc=fabio.estevam@nxp.com \
--cc=festevam@gmail.com \
--cc=linux-pwm@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=robh@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