PKGBUILDs/core/linux-kirkwood-dt/0001-leds-trigger-Introduce-a-SATA-trigger.patch

113 lines
3.5 KiB
Diff
Raw Normal View History

2020-08-09 02:27:50 +00:00
From 365ae852397f382bd5833092be57208610ae84b8 Mon Sep 17 00:00:00 2001
2018-03-01 01:15:12 +00:00
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Sun, 25 Feb 2018 16:32:06 -0700
Subject: [PATCH 1/6] leds: trigger: Introduce a SATA trigger
Signed-off-by: Kevin Mihelich <kevin@archlinuxarm.org>
---
2018-06-07 01:28:29 +00:00
drivers/leds/trigger/Kconfig | 6 ++++
2018-03-01 01:15:12 +00:00
drivers/leds/trigger/Makefile | 1 +
2018-06-07 01:28:29 +00:00
drivers/leds/trigger/ledtrig-sata.c | 43 +++++++++++++++++++++++++++++
include/linux/leds.h | 6 ++++
2018-03-01 01:15:12 +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
2020-08-09 02:27:50 +00:00
index ce9429ca6dde..143075d13bd1 100644
2018-03-01 01:15:12 +00:00
--- a/drivers/leds/trigger/Kconfig
+++ b/drivers/leds/trigger/Kconfig
2019-07-10 01:56:00 +00:00
@@ -39,6 +39,12 @@ config LEDS_TRIGGER_DISK
2018-03-01 01:15:12 +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-07-10 01:56:00 +00:00
index 733a83e2a718..023b9221202b 100644
2018-03-01 01:15:12 +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-08-09 02:27:50 +00:00
index 2451962d1ec5..225b2a3aa797 100644
2018-03-01 01:15:12 +00:00
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
2020-08-09 02:27:50 +00:00
@@ -457,6 +457,12 @@ void ledtrig_disk_activity(bool write);
2018-06-07 01:28:29 +00:00
static inline void ledtrig_disk_activity(bool write) {}
2018-03-01 01:15:12 +00:00
#endif
+#ifdef CONFIG_LEDS_TRIGGER_SATA
2020-02-04 18:42:35 +00:00
+void ledtrig_sata_activity(int port_number);
2018-03-01 01:15:12 +00:00
+#else
+static inline void ledtrig_sata_activity(int port_number) {}
+#endif
+
#ifdef CONFIG_LEDS_TRIGGER_MTD
2020-02-04 18:42:35 +00:00
void ledtrig_mtd_activity(void);
2018-03-01 01:15:12 +00:00
#else
--
2020-08-09 02:27:50 +00:00
2.27.0
2018-03-01 01:15:12 +00:00