archive mirror
 help / color / mirror / Atom feed
From: "Marek Behún" <>
To: stuart hayes <>
Cc: Pavel Machek <>, Randy Dunlap <>,
	Bjorn Helgaas <>,, Keith Busch <>,,
	"" <>
Subject: Re: [PATCH v2] Add support for PCIe SSD status LED management
Date: Wed, 2 Jun 2021 18:33:28 +0200	[thread overview]
Message-ID: <20210602183328.1e5885dc@dellmb> (raw)
In-Reply-To: <>

On Tue, 1 Jun 2021 22:18:16 -0500
stuart hayes <> wrote:

> Both Bjorn Helgaas and Krzysztof Wilczyński had suggested the 
> scheduler-type interface, so I went with that.  In an earlier attempt
> at this driver, when Bjorn suggested this, he asked if that would
> violate the "one value per file" rule, and Greg K-H responded "That's
> a valid way of displaying options for a sysfs file that can be
> specific unique values."

But you are not displaying unique values. Your example is

# echo "ok locate" >/sys/class/leds/0000:88:00.0::drive_status/states
# cat /sys/class/leds/0000:88:00.0::drive_status/states
[ok] [locate] failed rebuild pfa hotspare ica ifa invalid disabled

so there are 2 values set (ok and locate). Unique means that only one
can be set.

Question: can this LED be configured by userspace? I mean: can you
configure whether the LED should be on/off, disregarding the SSD state?

I ask because the LED subsystem currently officially does not
support LEDs for which brightness cannot be set by userspace...

If yes, you should implement the .brightness_set() function. (Could you
please also send your patch to the linux-leds mailing list?)

Then you should implement a LED-private trigger for this LED, which,
when enabled, will make the LED follow the SSD state.

The sysfs ABI should probably look like this:

# cd /sys/class/leds/<SSD_LED>
# echo 1 >brightness		# to light the LED on
# echo 0 >brightness		# to light the LED off
# echo ssd_state >trigger	# to make the LED follow SSD states
# ls ssd_state			# list available SSD states
ok  locate  failed  rebuild ...
# cat ssd_state/ok		# check if "ok" state is enabled
# echo 1 >ssd_state/ok		# enable "ok" state so that the
				# LED will be on when SSD is in "ok"
				# state
# echo none >trigger		# put the LED back into SW mode

(The name of the trigger does not necessarily have to be "ssd_state".
 Other people should give their opinions about the name.)


  parent reply	other threads:[~2021-06-02 16:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01 20:38 [PATCH v2] Add support for PCIe SSD status LED management Stuart Hayes
2021-06-01 21:20 ` Randy Dunlap
2021-06-01 22:38   ` Pavel Machek
2021-06-02  3:18     ` stuart hayes
2021-06-02  9:05       ` Pavel Machek
2021-06-02 15:36         ` stuart hayes
2021-06-02 22:40           ` Pavel Machek
2021-06-04 20:13             ` stuart hayes
2021-06-02 16:33       ` Marek Behún [this message]
2021-06-01 23:39   ` Randy Dunlap
2021-06-01 23:48 ` kernel test robot
2021-06-02  7:05 ` Lukas Wunner

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210602183328.1e5885dc@dellmb \ \ \ \ \ \ \ \ \ \

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