linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>
Cc: devicetree@vger.kernel.org, linux-pwm@vger.kernel.org,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/4] pwm: mxs: add support for inverse polarity
Date: Mon, 23 Sep 2019 10:45:56 +0200	[thread overview]
Message-ID: <d2b29144-3de8-4561-3292-49db7e697aca@rasmusvillemoes.dk> (raw)
In-Reply-To: <20190923082735.tzxyhvjlnztsxhsc@pengutronix.de>

On 23/09/2019 10.27, Uwe Kleine-König wrote:
> On Mon, Sep 23, 2019 at 10:13:47AM +0200, Rasmus Villemoes wrote:
>>
>>  
>> +	pol_bits = state->polarity == PWM_POLARITY_NORMAL ?
>> +		PERIOD_POLARITY_NORMAL : PERIOD_POLARITY_INVERSE;
>> +
>>  	writel(duty_cycles << 16,
>>  	       mxs->base + PWM_ACTIVE0 + pwm->hwpwm * 0x20);
>> -	writel(PERIOD_PERIOD(period_cycles) | PERIOD_POLARITY_NORMAL | PERIOD_CDIV(div),
>> +	writel(PERIOD_PERIOD(period_cycles) | pol_bits | PERIOD_CDIV(div),
> 
> When will this affect the output? Only on the next start of a period, or
> immediatly? Can it happen that this results in a mixed output (i.e. a
> period that has already the new duty cycle from the line above but not
> the new polarity (or period)?

The data sheet says "Also, when the user reprograms the channel in this
manner, the new register values will not take effect until the beginning
of a new output period. This eliminates the potential for output
glitches that could occur if the registers were updated while the
channel was enabled and in the middle of a cycle.". So I think this
should be ok. "this manner" refers to the registers being written in the
proper order (first ACTIVEn, then PERIODn).

Rasmus

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-09-23  8:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-23  8:13 [PATCH 0/4] pwm: mxs: add support for setting polarity via DT Rasmus Villemoes
2019-09-23  8:13 ` [PATCH 1/4] pwm: mxs: implement ->apply Rasmus Villemoes
2019-09-23  8:24   ` Uwe Kleine-König
2019-09-23  9:04     ` Rasmus Villemoes
2019-09-23  9:17       ` Uwe Kleine-König
2019-09-23  8:13 ` [PATCH 2/4] pwm: mxs: remove legacy methods Rasmus Villemoes
2019-09-23  8:13 ` [PATCH 3/4] pwm: mxs: add support for inverse polarity Rasmus Villemoes
2019-09-23  8:27   ` Uwe Kleine-König
2019-09-23  8:45     ` Rasmus Villemoes [this message]
2019-09-23  8:54       ` Uwe Kleine-König
2019-09-23  8:13 ` [PATCH 4/4] dt-bindings: pwm: mxs-pwm: Increase #pwm-cells Rasmus Villemoes
2019-10-02 14:19   ` Rob Herring

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=d2b29144-3de8-4561-3292-49db7e697aca@rasmusvillemoes.dk \
    --to=linux@rasmusvillemoes.dk \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).