All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Dan O'Donovan <dan@emutex.com>, linux-pwm@vger.kernel.org
Subject: Re: [PATCH] pwm: lpss: Prevent on_time_div overflow on lower frequencies
Date: Fri, 10 Jun 2016 15:40:55 +0200	[thread overview]
Message-ID: <20160610134055.GJ27142@ulmo.ba.sec> (raw)
In-Reply-To: <1465562601-44876-1-git-send-email-mika.westerberg@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 878 bytes --]

On Fri, Jun 10, 2016 at 03:43:21PM +0300, Mika Westerberg wrote:
> If duty_ns is large enough multiplying it by 255 overflows and results
> wrong duty cycle value being programmed. For example with 10ms duty when
> period is 20ms (50%) we get
> 
>   255 * 10000000 / 20000000 = -87
> 
> because 255 * 10000000 overlows int. Whereas correct value should be
> 
>   255 * 10000000 / 20000000 = 127
> 
> Fix this by using unsigned long long as type for on_time_div and changing
> integer literals to use proper type annotation.
> 
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---
> Resending with linux-pwm address corrected.
> 
> This is on top of Dan's patch:
> 
>   https://patchwork.ozlabs.org/patch/628683/
> 
>  drivers/pwm/pwm-lpss.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Applied, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

      reply	other threads:[~2016-06-10 13:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10 12:43 [PATCH] pwm: lpss: Prevent on_time_div overflow on lower frequencies Mika Westerberg
2016-06-10 13:40 ` Thierry Reding [this message]

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=20160610134055.GJ27142@ulmo.ba.sec \
    --to=thierry.reding@gmail.com \
    --cc=dan@emutex.com \
    --cc=linux-pwm@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /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.