From: Tomasz Figa <tomasz.figa@gmail.com>
To: Daniel Drake <drake@endlessm.com>
Cc: 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: Thu, 02 Oct 2014 21:49:51 +0200 [thread overview]
Message-ID: <542DAC5F.90309@gmail.com> (raw)
In-Reply-To: <CAD8Lp46mjChkpNmGvUy+P9ZzKU5yoVBd7A-FLfobFx110-5DQg@mail.gmail.com>
On 02.10.2014 21:27, Daniel Drake wrote:
> Hi,
>
> Thanks for looking into this.
>
> On Wed, Oct 1, 2014 at 4:55 AM, Tomasz Figa <tomasz.figa@gmail.com> wrote:
>>> 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
>
> I read that diagram a bit differently.
> The default state of the output is high, but that is while PWM is
> "inactive". It goes low at the point when the timer starts, and it
> also goes low when the timer later restarts every time. So once we
> enable PWM the output should be low.
That's right. I believe this should match what I wrote in my mail.
> It will go high once TCMP == TCNT, but because TCMP is placed at the
> maximum value which is never hit, that will never happen, so the LED
> stays off.
Right. Although all the levels above don't take into account state of
the inverter. What's shown on the diagram in the datasheet is with
inverter disabled, which corresponds to Linux's PWM_POLARITY_INVERSED.
>
> But I am confused on a few counts here...
>
> I may have identified above why a maximum TCMP value would not result
> in the output going high, but then why does the rest of the brightness
> scale work? If I set brightness 200 (tcmp=6470, tcnt=29999) then the
> LED is on dimly. If I set brightness 254 (tcmp=117, tcnt=29999) then
> the LED comes on much brighter. But according to my above explanation
> and looking at the diagram you referenced, such a decrease in the tcmp
> value would result in a shorter time for which the output is high,
> i.e. lower brightness, but actually the brightness increases.
This is strange. I remember verifying various edge cases with a scope on
an Exynos4210-based Origen board and I don't recall any issues.
Unfortunately I don't have appropriate hardware to recheck this specific
case anymore.
Could you specify on what board you are testing this or how the LED is
wired?
>
> If the output is high by default, why don't I see the LED turning on
> in uboot before Linux has even loaded?
Most likely because u-boot doesn't switch the pinmux from default input
to respective special function.
>
> Does the above diagram really apply to Linux? Because Linux sets the
> invert bit for all the channels in pwm_samsung_probe. So maybe that
> diagram is irrelevant until we invert the TOUT signal shown there?
The diagram illustrates how the hardware works. It shows TOUT levels
without inverter enabled. Still, the inverter simply negates the signal,
so the diagram is applicable, just with the exception that you need to
consider the output inverted.
Best regards,
Tomasz
next prev parent reply other threads:[~2014-10-02 19:49 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
2014-10-02 19:27 ` Daniel Drake
2014-10-02 19:49 ` Tomasz Figa [this message]
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=542DAC5F.90309@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.