kernel: fix SATA PMP LED trigger
Fixes: e3263dd951 ("kernel: supports LED trigger by SATA Port Multiplier port")
This commit is contained in:
parent
bf7bd4cc67
commit
9743247d2a
@ -1,16 +1,18 @@
|
||||
From 86884eaf288a8ca29ef5ee049de8c5b9d854ca1f Mon Sep 17 00:00:00 2001
|
||||
From 92620cff610016ed8fdc7cee395e8e66e8bd25ee Mon Sep 17 00:00:00 2001
|
||||
From: jjm2473 <1129525450@qq.com>
|
||||
Date: Mon, 30 Oct 2023 13:53:40 +0800
|
||||
Subject: [PATCH] drivers/ata: sata pmp supports led trigger
|
||||
|
||||
---
|
||||
drivers/ata/Kconfig | 18 ++++++++++++++
|
||||
drivers/ata/libata-core.c | 50 +++++++++++++++++++++++++++++++++++++++
|
||||
drivers/ata/libata-pmp.c | 42 ++++++++++++++++++++++++++++++++
|
||||
drivers/ata/Kconfig | 18 +++++++++++++++
|
||||
drivers/ata/libata-core.c | 47 +++++++++++++++++++++++++++++++++++++++
|
||||
drivers/ata/libata-pmp.c | 42 ++++++++++++++++++++++++++++++++++
|
||||
drivers/ata/libata.h | 8 +++++++
|
||||
include/linux/libata.h | 7 +++++-
|
||||
5 files changed, 124 insertions(+), 1 deletion(-)
|
||||
5 files changed, 121 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
|
||||
index e2f6ade2c..5ed7a02e4 100644
|
||||
--- a/drivers/ata/Kconfig
|
||||
+++ b/drivers/ata/Kconfig
|
||||
@@ -83,6 +83,14 @@ config ATA_LEDS
|
||||
@ -45,9 +47,11 @@ Subject: [PATCH] drivers/ata: sata pmp supports led trigger
|
||||
if HAS_DMA
|
||||
|
||||
comment "Controllers with non-SFF native interface"
|
||||
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
|
||||
index d44cbb8d3..a9995ea0b 100644
|
||||
--- a/drivers/ata/libata-core.c
|
||||
+++ b/drivers/ata/libata-core.c
|
||||
@@ -696,6 +696,41 @@ static inline void ata_led_act(struct at
|
||||
@@ -696,6 +696,38 @@ static inline void ata_led_act(struct ata_port *ap)
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -55,23 +59,20 @@ Subject: [PATCH] drivers/ata: sata pmp supports led trigger
|
||||
+#define ATA_LINK_BLINK_DELAY 40 /* ms */
|
||||
+static inline void ata_link_led_act(struct ata_link *link)
|
||||
+{
|
||||
+ unsigned long led_delay = ATA_LINK_BLINK_DELAY;
|
||||
+
|
||||
+ if (likely(!link->ledtrig || link->offline))
|
||||
+ return;
|
||||
+
|
||||
+ led_trigger_blink_oneshot(link->ledtrig, &led_delay, &led_delay, !link->offline);
|
||||
+ led_trigger_blink_oneshot(link->ledtrig, ATA_LINK_BLINK_DELAY, ATA_LINK_BLINK_DELAY, !link->offline);
|
||||
+}
|
||||
+
|
||||
+static inline void ata_link_led_link(struct ata_link *link, int offline)
|
||||
+{
|
||||
+ unsigned long led_delay = ATA_LINK_BLINK_DELAY << 1;
|
||||
+ link->offline = offline;
|
||||
+
|
||||
+ if (likely(!link->ledtrig))
|
||||
+ return;
|
||||
+
|
||||
+ led_trigger_blink_oneshot(link->ledtrig, &led_delay, &led_delay, !offline);
|
||||
+ led_trigger_blink_oneshot(link->ledtrig, ATA_LINK_BLINK_DELAY << 1, ATA_LINK_BLINK_DELAY << 1, !offline);
|
||||
+}
|
||||
+
|
||||
+int ata_link_trig_activate(struct led_classdev *led_cdev)
|
||||
@ -89,7 +90,7 @@ Subject: [PATCH] drivers/ata: sata pmp supports led trigger
|
||||
/**
|
||||
* ata_build_rw_tf - Build ATA taskfile for given read/write request
|
||||
* @qc: Metadata associated with the taskfile to build
|
||||
@@ -3184,9 +3219,15 @@ static void sata_print_link_status(struc
|
||||
@@ -3184,9 +3216,15 @@ static void sata_print_link_status(struct ata_link *link)
|
||||
tmp = (sstatus >> 4) & 0xf;
|
||||
ata_link_info(link, "SATA link up %s (SStatus %X SControl %X)\n",
|
||||
sata_spd_string(tmp), sstatus, scontrol);
|
||||
@ -105,7 +106,7 @@ Subject: [PATCH] drivers/ata: sata pmp supports led trigger
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4786,6 +4827,10 @@ void __ata_qc_complete(struct ata_queued
|
||||
@@ -4786,6 +4824,10 @@ void __ata_qc_complete(struct ata_queued_cmd *qc)
|
||||
ata_led_act(ap);
|
||||
#endif
|
||||
|
||||
@ -116,7 +117,7 @@ Subject: [PATCH] drivers/ata: sata pmp supports led trigger
|
||||
/* clear exclusive status */
|
||||
if (unlikely(qc->flags & ATA_QCFLAG_CLEAR_EXCL &&
|
||||
ap->excl_link == link))
|
||||
@@ -5418,6 +5463,11 @@ void ata_link_init(struct ata_port *ap,
|
||||
@@ -5418,6 +5460,11 @@ void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp)
|
||||
link->active_tag = ATA_TAG_POISON;
|
||||
link->hw_sata_spd_limit = UINT_MAX;
|
||||
|
||||
@ -128,9 +129,11 @@ Subject: [PATCH] drivers/ata: sata pmp supports led trigger
|
||||
/* can't use iterator, ap isn't initialized yet */
|
||||
for (i = 0; i < ATA_MAX_DEVICES; i++) {
|
||||
struct ata_device *dev = &link->device[i];
|
||||
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
|
||||
index e2e9cbd40..d97b6ab2e 100644
|
||||
--- a/drivers/ata/libata-pmp.c
|
||||
+++ b/drivers/ata/libata-pmp.c
|
||||
@@ -355,6 +355,16 @@ static int sata_pmp_init_links (struct a
|
||||
@@ -355,6 +355,16 @@ static int sata_pmp_init_links (struct ata_port *ap, int nr_ports)
|
||||
goto err_tlink;
|
||||
}
|
||||
}
|
||||
@ -147,7 +150,7 @@ Subject: [PATCH] drivers/ata: sata pmp supports led trigger
|
||||
}
|
||||
|
||||
for (i = 0; i < nr_ports; i++) {
|
||||
@@ -366,6 +376,23 @@ static int sata_pmp_init_links (struct a
|
||||
@@ -366,6 +376,23 @@ static int sata_pmp_init_links (struct ata_port *ap, int nr_ports)
|
||||
ehc->i.action |= ATA_EH_RESET;
|
||||
}
|
||||
|
||||
@ -171,7 +174,7 @@ Subject: [PATCH] drivers/ata: sata pmp supports led trigger
|
||||
return 0;
|
||||
err_tlink:
|
||||
while (--i >= 0)
|
||||
@@ -562,6 +589,10 @@ static void sata_pmp_detach(struct ata_d
|
||||
@@ -562,6 +589,10 @@ static void sata_pmp_detach(struct ata_device *dev)
|
||||
struct ata_port *ap = link->ap;
|
||||
struct ata_link *tlink;
|
||||
unsigned long flags;
|
||||
@ -182,7 +185,7 @@ Subject: [PATCH] drivers/ata: sata pmp supports led trigger
|
||||
|
||||
ata_dev_info(dev, "Port Multiplier detaching\n");
|
||||
|
||||
@@ -578,6 +609,17 @@ static void sata_pmp_detach(struct ata_d
|
||||
@@ -578,6 +609,17 @@ static void sata_pmp_detach(struct ata_device *dev)
|
||||
ap->nr_pmp_links = 0;
|
||||
link->pmp = 0;
|
||||
spin_unlock_irqrestore(ap->lock, flags);
|
||||
@ -200,6 +203,8 @@ Subject: [PATCH] drivers/ata: sata pmp supports led trigger
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
|
||||
index 05ac80da8..143f375c5 100644
|
||||
--- a/drivers/ata/libata.h
|
||||
+++ b/drivers/ata/libata.h
|
||||
@@ -12,6 +12,10 @@
|
||||
@ -213,7 +218,7 @@ Subject: [PATCH] drivers/ata: sata pmp supports led trigger
|
||||
#define DRV_NAME "libata"
|
||||
#define DRV_VERSION "3.00" /* must be exactly four chars */
|
||||
|
||||
@@ -236,4 +240,8 @@ static inline void zpodd_disable_run_wak
|
||||
@@ -236,4 +240,8 @@ static inline void zpodd_disable_run_wake(struct ata_device *dev) {}
|
||||
static inline void zpodd_post_poweron(struct ata_device *dev) {}
|
||||
#endif /* CONFIG_SATA_ZPODD */
|
||||
|
||||
@ -222,6 +227,8 @@ Subject: [PATCH] drivers/ata: sata pmp supports led trigger
|
||||
+#endif
|
||||
+
|
||||
#endif /* __LIBATA_H__ */
|
||||
diff --git a/include/linux/libata.h b/include/linux/libata.h
|
||||
index 8bde1f3bb..a494e0697 100644
|
||||
--- a/include/linux/libata.h
|
||||
+++ b/include/linux/libata.h
|
||||
@@ -23,7 +23,7 @@
|
||||
@ -245,3 +252,6 @@ Subject: [PATCH] drivers/ata: sata pmp supports led trigger
|
||||
};
|
||||
#define ATA_LINK_CLEAR_BEGIN offsetof(struct ata_link, active_tag)
|
||||
#define ATA_LINK_CLEAR_END offsetof(struct ata_link, device[0])
|
||||
--
|
||||
2.46.0
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user