All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomasz Figa <tomasz.figa@gmail.com>
To: Daniel Drake <drake@endlessm.com>,
	linux-pwm@vger.kernel.org,
	linux-samsung-soc <linux-samsung-soc@vger.kernel.org>
Subject: Re: pwm-samsung: incorrect register values for 100% duty cycle
Date: Wed, 01 Oct 2014 12:55:57 +0200	[thread overview]
Message-ID: <542BDDBD.1070708@gmail.com> (raw)
In-Reply-To: <CAD8Lp46rh80KD=jXoGTLt2SzH+zfnuyd=QHrKZncx+YYCp-8dA@mail.gmail.com>

Hi Daniel,

On 18.09.2014 01:42, Daniel Drake wrote:
> Hi,
> 
> I'm using pwm-samsung on Exynos4412 for a variable-brightness LED.
> 
> When the LED is set to maximum brightness via the pwm-leds driver, we
> arrive at pwm_samsung_config with duty_ns = period_ns, i.e. 100% duty
> cycle.
> 
> This function does:
> 
>     /* -1UL will give 100% duty. */
>     --tcmp;
>     writel(tcmp, our_chip->base + REG_TCMPB(pwm->hwpwm));
> 
> I think that comment is incorrect. If tcmp is written as -1UL then the
> LED totally turns off. And there is nothing in the Exynos4412 manual
> to suggest that -1UL should be set in the TCMP register for 100% duty.

Looking at Figure 11-3 in 11.3.2 Basic Timer Operation chapter of Exynos
4412 public datasheet [1] (page 659), the calculation above seems
correct. The default state of timer output is high and if TCMP is set to
a value higher than TCNT, then it will never toggle to low.

[1]
http://www.samsung.com/global/business/semiconductor/file/product/Exynos_4_Quad_User_Manaul_Public_REV1.00-0.pdf

> 
> If I remove that --tcmp line, so that 100% duty cycle is handled as
> tcmp=0, the problem is solved: the LED turns on at max brightness when
> the leds subsystem requests so.

According to my computations, with tcmp=0 you should get exactly the
minimum supported duty cycle (1 / N, where N is the number of ticks of
period), not full brightness. Are you sure that you have the right
output polarity configured?

> 
> Any ideas? Is this -1UL thing a quirk from older chip versions not
> applicable to Exynos4?

Comparing few datasheets, the timers seem identical in this aspect.

Best regards,
Tomasz

  reply	other threads:[~2014-10-01 10:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-17 23:42 pwm-samsung: incorrect register values for 100% duty cycle Daniel Drake
2014-10-01 10:55 ` Tomasz Figa [this message]
2014-10-02 19:27   ` Daniel Drake
2014-10-02 19:49     ` Tomasz Figa
2014-10-02 20:20       ` Daniel Drake

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=542BDDBD.1070708@gmail.com \
    --to=tomasz.figa@gmail.com \
    --cc=drake@endlessm.com \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-samsung-soc@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 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.