linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Baolin Wang <baolin.wang@linaro.org>,
	rteysseyre@gmail.com, bjorn.andersson@linaro.org,
	broonie@kernel.org, linus.walleij@linaro.org,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v15 1/2] leds: core: Introduce LED pattern trigger
Date: Wed, 24 Oct 2018 21:17:25 +0200	[thread overview]
Message-ID: <bdadda71-f919-b6a6-4e1c-f87ed298b6b5@gmail.com> (raw)
In-Reply-To: <20181024083143.GA24165@amd>

On 10/24/2018 10:31 AM, Pavel Machek wrote:
> Hi!
> 
>>> +
>>> +		The gradual dimming format of the software pattern values should be:
>>> +		"brightness_1 duration_1 brightness_2 duration_2 brightness_3
>>> +		duration_3 ...". For example:
>>> +
>>> +		echo 0 1000 255 2000 > pattern
>>> +
>>> +		It will make the LED go gradually from zero-intensity to max (255)
>>> +		intensity in 1000 milliseconds, then back to zero intensity in 2000
>>> +		milliseconds:
>>> +
>>> +		LED brightness
>>> +		    ^
>>> +		255-|       / \            / \            /
>>> +		    |      /    \         /    \         /
>>> +		    |     /       \      /       \      /
>>> +		    |    /          \   /          \   /
>>> +		  0-|   /             \/             \/
>>> +		    +---0----1----2----3----4----5----6------------> time (s)
>>> +
> 
> Ok, so I got around to testing this.
> 
> echo "0 1000 10 2550 0 1000 0 100" > pattern
> 
> makes expected pattern [  .-xXx-.  ].
> 
> But when I do
> 
> echo "0 1000 10 2550 0 1000" > pattern
> 
> I only get expected pattern on the first iteration, then I get
> [    Xx-.   ].

This is because the tuples are processed in a loop, without
discerning between start and end of the sequence.

So this sequence ends up being squashed, because of the
comparison:

if (data->curr->brightness == data->next->brightness) {
	//step change od brightness
	...
	/* Skip the tuple with zero duration */

Here we actually only assume that this is zero duration since it
is not checked. Possibly needs fixing.

	pattern_trig_update_patterns(data);
	/* Select next tuple */
	pattern_trig_update_patterns(data);

In effect we have:

0 -> 10    // dimming
10 -> 0    // dimming
0 skipped  // step
10 -> 0    // dimming
0 skipped  // step
10 -> 0    // dimming
...

In order to get "rise - fall - rise - fall" sequence you need
only two tuples:

echo "0 1000 10 1000" > pattern

which will be processed as follows:

0 -> 10    // dimming
10 -> 0    // dimming
0 -> 10    // dimming
10 -> 0    // dimming
0 -> 10    // dimming
10 -> 0    // dimming

> I'm using led-controller:flash on nokia n900 (so everything in
> software).
> 
>> OK, let's abide by constant update interval for now.
>>
>> Thank you for your work on this patch set throughout
>> all these months. We will have -rc8, so one week of testing
>> before sending upstream should be enough.
>>
>> Patch set applied to the for-next branch of linux-leds.git.
> 
> Thanks!
> 									Pavel
> 

-- 
Best regards,
Jacek Anaszewski

  reply	other threads:[~2018-10-24 19:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-11  4:07 Baolin Wang
2018-10-11  4:07 ` [PATCH v15 2/2] leds: sc27xx: Add pattern_set/clear interfaces for LED controller Baolin Wang
2018-10-11 20:07 ` [PATCH v15 1/2] leds: core: Introduce LED pattern trigger Jacek Anaszewski
2018-10-12  1:40   ` Baolin Wang
2018-10-24  8:34     ` Pavel Machek
2018-10-24  8:31   ` Pavel Machek
2018-10-24 19:17     ` Jacek Anaszewski [this message]
2018-10-24 19:55       ` Pavel Machek
2018-10-24 20:44       ` [PATCH] Fix pattern handling optimalization Pavel Machek
2018-10-25 19:17         ` Jacek Anaszewski
2018-10-25 21:24           ` More checks for patterns? was: " Pavel Machek
2018-10-26  8:02             ` Baolin Wang
2018-10-26 19:56             ` Jacek Anaszewski

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=bdadda71-f919-b6a6-4e1c-f87ed298b6b5@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=baolin.wang@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rteysseyre@gmail.com \
    --subject='Re: [PATCH v15 1/2] leds: core: Introduce LED pattern trigger' \
    /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

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).