From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Dan Murphy <dmurphy@ti.com>
Cc: Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Jacek Anaszewski <jacek.anaszewski@gmail.com>,
Pavel Machek <pavel@ucw.cz>,
devicetree <devicetree@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux LED Subsystem <linux-leds@vger.kernel.org>
Subject: Re: [PATCH v6 2/2] leds: lm3601x: Introduce the lm3601x LED driver
Date: Thu, 17 May 2018 01:19:47 +0300 [thread overview]
Message-ID: <CAHp75VeP6Ui-Sw65T-cwGh9ADMEcEGOzf8C3aYCTK_seZjgqeg@mail.gmail.com> (raw)
In-Reply-To: <CAHp75Vd-cyR7zVofP7g+4Z1ouqawV+Rqp5s5BcDhpGiHheUgpg@mail.gmail.com>
On Thu, May 17, 2018 at 1:11 AM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Wed, May 16, 2018 at 11:43 PM, Dan Murphy <dmurphy@ti.com> wrote:
>> On 05/15/2018 05:24 PM, Andy Shevchenko wrote:
>>> On Wed, May 16, 2018 at 1:08 AM, Dan Murphy <dmurphy@ti.com> wrote:
>>>> On 05/15/2018 04:56 PM, Andy Shevchenko wrote:
>>>>>> +static const struct lm3601x_max_timeouts strobe_timeouts[] = {
>>>>>> + { 40000, 0x00 },
>>>>>> + { 80000, 0x01 },
>>>>>> + { 120000, 0x02 },
>>>>>> + { 160000, 0x03 },
>>>>>> + { 200000, 0x04 },
>>>>>> + { 240000, 0x05 },
>>>>>> + { 280000, 0x06 },
>>>>>> + { 320000, 0x07 },
>>>>>> + { 360000, 0x08 },
>>>>>> + { 400000, 0x09 },
>>>>>> + { 600000, 0x0a },
>>>>>> + { 800000, 0x0b },
>>>>>> + { 1000000, 0x0c },
>>>>>> + { 1200000, 0x0d },
>>>>>> + { 1400000, 0x0e },
>>>>>> + { 1600000, 0x0f },
>>> if (x < 9)
>>> strobe_timeout = (x + 1) * 40 * MSECS_IN_SEC;
>>> else
>>> strobe_timeout = (x - 7) * 200 * MSECS_IN_SEC;
>>
>> Not sure if this will produce the register value I am looking for. I have to run through the
>> algorithim. The idea is to take in the timeout and get the reg value to program.
>>
>> If it yields the expected output, or with a modified equation, then I can pull it in.
>
> So, you need a reversed calculus in this case.
>
> u8 regval;
>
> /* To make it in range... */
> timeout = clamp_val(timeout, 40000, 1600000);
> /* ...other possibility to issue an error */
>
> if (timeout >= 400000)
> regval = timeout / 200000 + 0x07;
> else
> regval = timeout / 40000 - 0x01;
Forgot to mention that there are also three approaches (considering
division here):
- round up
- round down
- round to closest
>
> In any case, please double check it gives a correct values.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2018-05-16 22:19 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-15 15:43 [PATCH v6 1/2] dt: bindings: lm3601x: Introduce the lm3601x driver Dan Murphy
2018-05-15 15:43 ` [PATCH v6 2/2] leds: lm3601x: Introduce the lm3601x LED driver Dan Murphy
2018-05-15 21:24 ` Jacek Anaszewski
2018-05-15 21:50 ` Dan Murphy
2018-05-16 20:43 ` Jacek Anaszewski
2018-05-15 21:56 ` Andy Shevchenko
2018-05-15 22:08 ` Dan Murphy
2018-05-15 22:24 ` Andy Shevchenko
2018-05-15 22:27 ` Andy Shevchenko
2018-05-16 20:43 ` Dan Murphy
2018-05-16 22:11 ` Andy Shevchenko
2018-05-16 22:19 ` Andy Shevchenko [this message]
2018-05-16 21:02 ` Jacek Anaszewski
2018-05-16 21:13 ` Dan Murphy
2018-05-16 21:17 ` Dan Murphy
2018-05-16 21:27 ` Jacek Anaszewski
2018-05-17 14:34 ` Dan Murphy
2018-05-17 21:26 ` Jacek Anaszewski
2018-05-15 21:13 ` [PATCH v6 1/2] dt: bindings: lm3601x: Introduce the lm3601x driver Jacek Anaszewski
2018-05-15 21:29 ` Dan Murphy
2018-05-16 20:10 ` Jacek Anaszewski
2018-05-16 20:14 ` Dan Murphy
2018-05-18 15:11 ` 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=CAHp75VeP6Ui-Sw65T-cwGh9ADMEcEGOzf8C3aYCTK_seZjgqeg@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dmurphy@ti.com \
--cc=jacek.anaszewski@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pavel@ucw.cz \
--cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).