2020-02-12 04:00:15 +00:00
|
|
|
From 4432cc83587dd30d739c6cd2ee180ecb14bd6fb7 Mon Sep 17 00:00:00 2001
|
2018-02-27 01:43:53 +00:00
|
|
|
From: Kevin Mihelich <kevin@archlinuxarm.org>
|
|
|
|
Date: Sun, 25 Feb 2018 16:32:06 -0700
|
|
|
|
Subject: [PATCH 4/9] leds: trigger: Introduce a SATA trigger
|
|
|
|
|
|
|
|
Signed-off-by: Kevin Mihelich <kevin@archlinuxarm.org>
|
|
|
|
---
|
2018-04-18 02:07:27 +00:00
|
|
|
drivers/leds/trigger/Kconfig | 6 ++++
|
2018-02-27 01:43:53 +00:00
|
|
|
drivers/leds/trigger/Makefile | 1 +
|
2018-04-18 02:07:27 +00:00
|
|
|
drivers/leds/trigger/ledtrig-sata.c | 43 +++++++++++++++++++++++++++++
|
|
|
|
include/linux/leds.h | 6 ++++
|
2018-02-27 01:43:53 +00:00
|
|
|
4 files changed, 56 insertions(+)
|
|
|
|
create mode 100644 drivers/leds/trigger/ledtrig-sata.c
|
|
|
|
|
|
|
|
diff --git a/drivers/leds/trigger/Kconfig b/drivers/leds/trigger/Kconfig
|
2019-10-07 00:55:36 +00:00
|
|
|
index ce9429ca6dde..143075d13bd1 100644
|
2018-02-27 01:43:53 +00:00
|
|
|
--- a/drivers/leds/trigger/Kconfig
|
|
|
|
+++ b/drivers/leds/trigger/Kconfig
|
2019-10-07 00:55:36 +00:00
|
|
|
@@ -39,6 +39,12 @@ config LEDS_TRIGGER_DISK
|
2018-02-27 01:43:53 +00:00
|
|
|
This allows LEDs to be controlled by disk activity.
|
|
|
|
If unsure, say Y.
|
|
|
|
|
|
|
|
+config LEDS_TRIGGER_SATA
|
|
|
|
+ bool "LED SATA Disk Trigger for Kirkwood SOC"
|
|
|
|
+ depends on LEDS_TRIGGERS
|
|
|
|
+ help
|
|
|
|
+ This allows LEDs to be controlled by IDE disk activity.
|
|
|
|
+
|
|
|
|
config LEDS_TRIGGER_MTD
|
|
|
|
bool "LED MTD (NAND/NOR) Trigger"
|
|
|
|
depends on MTD
|
|
|
|
diff --git a/drivers/leds/trigger/Makefile b/drivers/leds/trigger/Makefile
|
2019-05-23 00:11:38 +00:00
|
|
|
index 733a83e2a718..023b9221202b 100644
|
2018-02-27 01:43:53 +00:00
|
|
|
--- a/drivers/leds/trigger/Makefile
|
|
|
|
+++ b/drivers/leds/trigger/Makefile
|
|
|
|
@@ -2,6 +2,7 @@
|
|
|
|
obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o
|
|
|
|
obj-$(CONFIG_LEDS_TRIGGER_ONESHOT) += ledtrig-oneshot.o
|
|
|
|
obj-$(CONFIG_LEDS_TRIGGER_DISK) += ledtrig-disk.o
|
|
|
|
+obj-$(CONFIG_LEDS_TRIGGER_SATA) += ledtrig-sata.o
|
|
|
|
obj-$(CONFIG_LEDS_TRIGGER_MTD) += ledtrig-mtd.o
|
|
|
|
obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o
|
|
|
|
obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT) += ledtrig-backlight.o
|
|
|
|
diff --git a/drivers/leds/trigger/ledtrig-sata.c b/drivers/leds/trigger/ledtrig-sata.c
|
|
|
|
new file mode 100644
|
|
|
|
index 000000000000..f1798f43666f
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/drivers/leds/trigger/ledtrig-sata.c
|
|
|
|
@@ -0,0 +1,43 @@
|
|
|
|
+/*
|
|
|
|
+ * LED SATA-Disk Activity Trigger
|
|
|
|
+ *
|
|
|
|
+ * This program is free software; you can redistribute it and/or modify
|
|
|
|
+ * it under the terms of the GNU General Public License version 2 as
|
|
|
|
+ * published by the Free Software Foundation.
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+#include <linux/kernel.h>
|
|
|
|
+#include <linux/init.h>
|
|
|
|
+#include <linux/leds.h>
|
|
|
|
+
|
|
|
|
+#define BLINK_DELAY 30
|
|
|
|
+
|
|
|
|
+DEFINE_LED_TRIGGER(ledtrig_sata1);
|
|
|
|
+DEFINE_LED_TRIGGER(ledtrig_sata2);
|
|
|
|
+
|
|
|
|
+void ledtrig_sata_activity(int port_number)
|
|
|
|
+{
|
|
|
|
+ unsigned long sata_blink_delay = BLINK_DELAY;
|
|
|
|
+
|
|
|
|
+ switch (port_number) {
|
|
|
|
+ case 0:
|
|
|
|
+ led_trigger_blink_oneshot(ledtrig_sata1, &sata_blink_delay, &sata_blink_delay, 0);
|
|
|
|
+ break;
|
|
|
|
+ case 1:
|
|
|
|
+ led_trigger_blink_oneshot(ledtrig_sata2, &sata_blink_delay, &sata_blink_delay, 0);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL(ledtrig_sata_activity);
|
|
|
|
+
|
|
|
|
+static int __init ledtrig_sata_init(void)
|
|
|
|
+{
|
|
|
|
+ led_trigger_register_simple("sata-disk1", &ledtrig_sata1);
|
|
|
|
+ led_trigger_register_simple("sata-disk2", &ledtrig_sata2);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+device_initcall(ledtrig_sata_init);
|
|
|
|
diff --git a/include/linux/leds.h b/include/linux/leds.h
|
2020-02-12 04:00:15 +00:00
|
|
|
index 75353e5f9d13..fa9f630a80c6 100644
|
2018-02-27 01:43:53 +00:00
|
|
|
--- a/include/linux/leds.h
|
|
|
|
+++ b/include/linux/leds.h
|
2020-02-12 04:00:15 +00:00
|
|
|
@@ -456,6 +456,12 @@ void ledtrig_disk_activity(bool write);
|
2018-04-18 02:07:27 +00:00
|
|
|
static inline void ledtrig_disk_activity(bool write) {}
|
2018-02-27 01:43:53 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
+#ifdef CONFIG_LEDS_TRIGGER_SATA
|
|
|
|
+extern void ledtrig_sata_activity(int port_number);
|
|
|
|
+#else
|
|
|
|
+static inline void ledtrig_sata_activity(int port_number) {}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#ifdef CONFIG_LEDS_TRIGGER_MTD
|
2019-12-11 03:14:55 +00:00
|
|
|
void ledtrig_mtd_activity(void);
|
2018-02-27 01:43:53 +00:00
|
|
|
#else
|
|
|
|
--
|
2020-02-12 04:00:15 +00:00
|
|
|
2.25.0
|
2018-02-27 01:43:53 +00:00
|
|
|
|