Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1528271 > unrolled thread

serial: Add LED trigger support

Started bySascha Hauer <s.hauer@pengutronix.de>
First post2016-11-23 11:10 +0100
Last post2016-11-23 11:10 +0100
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  serial: Add LED trigger support Sascha Hauer <s.hauer@pengutronix.de> - 2016-11-23 11:10 +0100
    [PATCH 4/4] serial: imx: Add LED trigger support Sascha Hauer <s.hauer@pengutronix.de> - 2016-11-23 11:10 +0100

#1528271 — serial: Add LED trigger support

FromSascha Hauer <s.hauer@pengutronix.de>
Date2016-11-23 11:10 +0100
Subjectserial: Add LED trigger support
Message-ID<sGCF3-3u2-9@gated-at.bofh.it>
This series brings LED trigger support to the serial_core layer
and adopts some driver to use it.
This is an updated version of https://patchwork.kernel.org/patch/9212885/
which added LED trigger support to the i.MX serial driver only.

Sascha

----------------------------------------------------------------
Sascha Hauer (4):
      serial: core: Add LED trigger support
      serial: 8250: Add LED trigger support
      serial: cpm_uart: Add LED trigger support
      serial: imx: Add LED trigger support

 drivers/tty/serial/8250/8250_core.c         | 12 ++++-
 drivers/tty/serial/8250/8250_port.c         |  4 ++
 drivers/tty/serial/cpm_uart/cpm_uart_core.c | 22 ++++++++-
 drivers/tty/serial/imx.c                    | 24 +++++++++-
 drivers/tty/serial/serial_core.c            | 73 +++++++++++++++++++++++++++++
 include/linux/serial_core.h                 | 10 ++++
 6 files changed, 139 insertions(+), 6 deletions(-)

[toc] | [next] | [standalone]


#1528275 — [PATCH 4/4] serial: imx: Add LED trigger support

FromSascha Hauer <s.hauer@pengutronix.de>
Date2016-11-23 11:10 +0100
Subject[PATCH 4/4] serial: imx: Add LED trigger support
Message-ID<sGCF4-3u2-41@gated-at.bofh.it>
In reply to#1528271
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tty/serial/imx.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index a70356d..5eaf576 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -444,6 +444,8 @@ static inline void imx_transmit_buffer(struct imx_port *sport)
 		return;
 	}
 
+	uart_led_trigger_tx(&sport->port);
+
 	if (sport->dma_is_enabled) {
 		/*
 		 * We've just sent a X-char Ensure the TX DMA is enabled
@@ -569,6 +571,7 @@ static void imx_dma_tx(struct imx_port *sport)
 	/* fire it */
 	sport->dma_is_txing = 1;
 	dmaengine_submit(desc);
+	uart_led_trigger_tx(&sport->port);
 	dma_async_issue_pending(chan);
 	return;
 }
@@ -655,6 +658,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_trigger_rx(&sport->port);
+
 	spin_lock_irqsave(&sport->port.lock, flags);
 
 	while (readl(sport->port.membase + USR2) & USR2_RDR) {
@@ -729,6 +734,8 @@ static void imx_dma_rxint(struct imx_port *sport)
 	unsigned long temp;
 	unsigned long flags;
 
+	uart_led_trigger_rx(&sport->port);
+
 	spin_lock_irqsave(&sport->port.lock, flags);
 
 	temp = readl(sport->port.membase + USR2);
@@ -2184,14 +2191,27 @@ static int serial_imx_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, sport);
 
-	return uart_add_one_port(&imx_reg, &sport->port);
+	ret = uart_add_one_port(&imx_reg, &sport->port);
+	if (ret)
+		return ret;
+
+	uart_add_led_triggers(&imx_reg, &sport->port);
+
+	return 0;
 }
 
 static int serial_imx_remove(struct platform_device *pdev)
 {
 	struct imx_port *sport = platform_get_drvdata(pdev);
+	int ret;
 
-	return uart_remove_one_port(&imx_reg, &sport->port);
+	ret = uart_remove_one_port(&imx_reg, &sport->port);
+	if (ret)
+		return ret;
+
+	uart_remove_led_triggers(&sport->port);
+
+	return 0;
 }
 
 static void serial_imx_restore_context(struct imx_port *sport)
-- 
2.10.2

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web