2018-04-18 02:07:27 +00:00
|
|
|
From 5b639d2ce20328d4797d5479cfbecb09a59868ca 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
|
|
|
|
index a2559b4fdfff..592f942e0300 100644
|
|
|
|
--- a/drivers/leds/trigger/Kconfig
|
|
|
|
+++ b/drivers/leds/trigger/Kconfig
|
|
|
|
@@ -41,6 +41,12 @@ config LEDS_TRIGGER_DISK
|
|
|
|
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
|
|
|
|
index f3cfe1950538..f294704a3ebe 100644
|
|
|
|
--- 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
|
2018-04-18 02:07:27 +00:00
|
|
|
index b7e82550e655..065d1b955aca 100644
|
2018-02-27 01:43:53 +00:00
|
|
|
--- a/include/linux/leds.h
|
|
|
|
+++ b/include/linux/leds.h
|
2018-04-18 02:07:27 +00:00
|
|
|
@@ -351,6 +351,12 @@ extern void ledtrig_disk_activity(bool write);
|
|
|
|
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
|
|
|
|
extern void ledtrig_mtd_activity(void);
|
|
|
|
#else
|
|
|
|
--
|
2018-04-18 02:07:27 +00:00
|
|
|
2.17.0
|
2018-02-27 01:43:53 +00:00
|
|
|
|