[PATCH v2 2/2] serial: imx: add support for LED triggers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Take advantage of the newly introduced LED trigger support for
serial ports by registering ports and calling uart_led_event()
in receive and transmit routines.

Signed-off-by: Tobias Doerffel <tobias.doerffel@xxxxxxxxxxxxxx>
---
 drivers/tty/serial/imx.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 016e4be..c9559e4 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -30,6 +30,7 @@
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
 #include <linux/serial_core.h>
+#include <linux/serial_leds.h>
 #include <linux/serial.h>
 #include <linux/clk.h>
 #include <linux/delay.h>
@@ -441,6 +442,8 @@ static inline void imx_transmit_buffer(struct imx_port *sport)
 		return;
 	}
 
+	uart_led_event(&sport->port, UART_LED_EVENT_TX);
+
 	if (sport->dma_is_enabled) {
 		/*
 		 * We've just sent a X-char Ensure the TX DMA is enabled
@@ -650,6 +653,8 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
 	struct tty_port *port = &sport->port.state->port;
 	unsigned long flags, temp;
 
+	uart_led_event(&sport->port, UART_LED_EVENT_RX);
+
 	spin_lock_irqsave(&sport->port.lock, flags);
 
 	while (readl(sport->port.membase + USR2) & USR2_RDR) {
@@ -723,6 +728,8 @@ static void imx_dma_rxint(struct imx_port *sport)
 	unsigned long temp;
 	unsigned long flags;
 
+	uart_led_event(&sport->port, UART_LED_EVENT_RX);
+
 	spin_lock_irqsave(&sport->port.lock, flags);
 
 	temp = readl(sport->port.membase + USR2);
@@ -2002,6 +2009,9 @@ static int serial_imx_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, sport);
 
+	/* Register LED triggers for port */
+	uart_led_register(&imx_reg, &sport->port);
+
 	return uart_add_one_port(&imx_reg, &sport->port);
 }
 
@@ -2009,6 +2019,9 @@ static int serial_imx_remove(struct platform_device *pdev)
 {
 	struct imx_port *sport = platform_get_drvdata(pdev);
 
+	/* Unregister LED triggers for port */
+	uart_led_unregister(&sport->port);
+
 	return uart_remove_one_port(&imx_reg, &sport->port);
 }
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux