public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anton Vorontsov <cbou@mail.ru>
To: Richard Purdie <rpurdie@rpsys.net>
Cc: kogiidena@eggplant.ddo.jp, linux-kernel@vger.kernel.org,
	lethal@linux-sh.org
Subject: Re: [PATCH 1/2] leds:arch/sh/boards/landisk LEDs supports
Date: Tue, 15 May 2007 01:13:36 +0400	[thread overview]
Message-ID: <20070514211336.GA27394@zarina> (raw)
In-Reply-To: <1179174816.5877.60.camel@localhost.localdomain>

On Mon, May 14, 2007 at 09:33:36PM +0100, Richard Purdie wrote:
> On Tue, 2007-05-15 at 00:12 +0400, Anton Vorontsov wrote:
> > This change needed for two purposes:
> > 
> > 1. When somebody sets trigger, and that trigger would setup
> >    brightness in its activate() function, and led driver would check
> >    if that trigger supported (used by hwtimer trigger and drivers
> >    supporting hw blinking LEDs, not in mainline yet).
> 
> Why does led_cdev->trigger need to be set to do this? Any well written
> LED drivers shouldn't need to look at it as the LED drivers shouldn't
> have or need any knowledge about specific triggers. If they need this,
> you hw blinking abstraction isn't generic.

Well, yes. Hw blinking abstraction not generic, in sense that driver
*must* know that it may be asked for "blinking trigger", i.e. hwtimer or
its derivate. There just isn't other way to do it, because
brightness_set function accepts only "enum led_brightness" argument,
because your initial intention: avoid other properties but brightness.
It's okay, but..

Because of all above, the only way I see hwtimer could be done (and
it done that way) on driver side is:

static void samcop_leds_set(struct led_classdev *led_cdev,
                            enum led_brightness b)
{
[...]
        if (b == LED_OFF)
                samcop_set_led(samcop_dev, PWM_RATE, led->hw_num, 0, 16);
        else {
                #ifdef CONFIG_LEDS_TRIGGER_HWTIMER
                if (led_cdev->trigger && led_cdev->trigger->is_led_supported &&
                               (led_cdev->trigger->is_led_supported(led_cdev) &
                                LED_SUPPORTS_HWTIMER)) {

/* ^^^ we're checking if trigger require us hwblinking, so it's hwtimer
 * or "derivate", i.e. any trigger passing hwtimer_data. LEDs API don't
 * have any other way to pass "blinking parameters" to the driver, i.e.
 * on/off delays. */

                        struct hwtimer_data *td = led_cdev->trigger_data;

                        if (!td) return;

                        samcop_set_led(samcop_dev, PWM_RATE, led->hw_num,
                          (PWM_RATE * td->delay_on)/1000,
                          (PWM_RATE * (td->delay_on + td->delay_off))/1000);
                }
                else
                #endif
                samcop_set_led(samcop_dev, PWM_RATE, led->hw_num, 16, 16);
        }

        return;
}

> I'm going to hold this patch until we're about the merge
> something that needs it, if it really needs it.

Fair enough.

Side note: I'm still dreaming about hwtimer -> timer merge, and make
it smart enough to use software blinking if hwtimer on/off delays limits
exceeded. Though, I'm still unsure when I'll start that work.

> > 2. If trigger would access itself through led_cdev in its activate()
> >    function.
> 
> I can't see why you'd need to do this...

Yes, there is no any user of that feature. Even not in handhelds.org tree
anymore. Though, hwtimer still using "1." reason.

> > 1. No mainline kernel user, but offshores.
> 
> 2. Encourages bad code ;-). 

:-) I'll agree here, but only after I or anyone else will make hwtimer other
way, generic one.

> -- 
> Richard

Thanks,

-- 
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.org/bd2

  reply	other threads:[~2007-05-14 21:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-08 12:26 [PATCH 1/2] leds:arch/sh/boards/landisk LEDs supports kogiidena
2007-05-08 12:54 ` Richard Purdie
2007-05-09 14:26   ` kogiidena
2007-05-09 15:13     ` Richard Purdie
2007-05-09 16:03       ` Anton Vorontsov
2007-05-10 11:52         ` kogiidena
2007-05-10 14:04           ` Paul Mundt
2007-05-11 15:03             ` kogiidena
2007-05-12  4:01               ` kogiidena
2007-05-13 23:16         ` Richard Purdie
2007-05-14 19:56           ` Anton Vorontsov
2007-05-14 20:12           ` Anton Vorontsov
2007-05-14 20:33             ` Richard Purdie
2007-05-14 21:13               ` Anton Vorontsov [this message]
2007-05-09 21:48       ` kogiidena

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=20070514211336.GA27394@zarina \
    --to=cbou@mail.ru \
    --cc=kogiidena@eggplant.ddo.jp \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    /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