LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
	jacek.anaszewski@gmail.com
Cc: linus.walleij@linaro.org, linz@li-pro.net, rpurdie@rpsys.net
Subject: Disk activity trigger: keeps blinking under full load
Date: Thu, 23 May 2019 23:43:01 +0200	[thread overview]
Message-ID: <20190523214301.GA14788@amd> (raw)

[-- Attachment #1: Type: text/plain, Size: 2118 bytes --]

Hi!

I'm trying to use disk activity trigger on a scrollock LED... but it
significantly differs from "usual" disk LED: even under "full" disk
activity (linear read) where it should be solidly "on", it keeps
blinking.

I guess that's what led_trigger_blink_oneshot() does. I tried to
change the parameters... off_delay == 0 breaks it completely, and even
with delay of 1 it behaves very weirdly.

Is there better helper I should use?

								Pavel

diff --git a/drivers/leds/trigger/ledtrig-disk.c b/drivers/leds/trigger/ledtrig-disk.c
index 9816b0d..cf40ef2 100644
--- a/drivers/leds/trigger/ledtrig-disk.c
+++ b/drivers/leds/trigger/ledtrig-disk.c
@@ -15,7 +15,7 @@
 #include <linux/init.h>
 #include <linux/leds.h>
 
-#define BLINK_DELAY 30
+#define BLINK_DELAY 10
 
 DEFINE_LED_TRIGGER(ledtrig_disk);
 DEFINE_LED_TRIGGER(ledtrig_disk_read);
@@ -25,17 +25,18 @@ DEFINE_LED_TRIGGER(ledtrig_ide);
 void ledtrig_disk_activity(bool write)
 {
 	unsigned long blink_delay = BLINK_DELAY;
+	unsigned long off_delay = 1;
 
 	led_trigger_blink_oneshot(ledtrig_disk,
-				  &blink_delay, &blink_delay, 0);
+				  &blink_delay, &off_delay, 0);
 	led_trigger_blink_oneshot(ledtrig_ide,
-				  &blink_delay, &blink_delay, 0);
+				  &blink_delay, &off_delay, 0);
 	if (write)
 		led_trigger_blink_oneshot(ledtrig_disk_write,
-					  &blink_delay, &blink_delay, 0);
+					  &blink_delay, &off_delay, 0);
 	else
 		led_trigger_blink_oneshot(ledtrig_disk_read,
-					  &blink_delay, &blink_delay, 0);
+					  &blink_delay, &off_delay, 0);
 }
 EXPORT_SYMBOL(ledtrig_disk_activity);
 
@@ -44,6 +45,7 @@ static int __init ledtrig_disk_init(void)
 	led_trigger_register_simple("disk-activity", &ledtrig_disk);
 	led_trigger_register_simple("disk-read", &ledtrig_disk_read);
 	led_trigger_register_simple("disk-write", &ledtrig_disk_write);
+	/* deprecate? */
 	led_trigger_register_simple("ide-disk", &ledtrig_ide);
 
 	return 0;




-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

             reply	other threads:[~2019-05-23 21:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-23 21:43 Pavel Machek [this message]
2019-05-25 17:02 ` Jacek Anaszewski
2019-05-26  8:18   ` Pavel Machek

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=20190523214301.GA14788@amd \
    --to=pavel@ucw.cz \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linz@li-pro.net \
    --cc=rpurdie@rpsys.net \
    --subject='Re: Disk activity trigger: keeps blinking under full load' \
    /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).