From patchwork Wed Nov 23 10:01:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 9442849 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 84EC2600BA for ; Wed, 23 Nov 2016 10:04:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 693B5203C0 for ; Wed, 23 Nov 2016 10:04:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E09323E64; Wed, 23 Nov 2016 10:04:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0969C203C0 for ; Wed, 23 Nov 2016 10:04:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c9UOG-0008Ni-Ud; Wed, 23 Nov 2016 10:02:56 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c9UN8-0007kY-9l for linux-arm-kernel@lists.infradead.org; Wed, 23 Nov 2016 10:01:48 +0000 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1c9UMW-0000zK-10; Wed, 23 Nov 2016 11:01:08 +0100 Received: from sha by dude.hi.pengutronix.de with local (Exim 4.87) (envelope-from ) id 1c9UMV-0007Qe-BM; Wed, 23 Nov 2016 11:01:07 +0100 From: Sascha Hauer To: linux-serial@vger.kernel.org Subject: [PATCH 4/4] serial: imx: Add LED trigger support Date: Wed, 23 Nov 2016 11:01:06 +0100 Message-Id: <20161123100106.15969-5-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161123100106.15969-1-s.hauer@pengutronix.de> References: <20161123100106.15969-1-s.hauer@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161123_020146_826185_5A4B0C5E X-CRM114-Status: GOOD ( 13.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel@pengutronix.de, Greg Kroah-Hartman , Sascha Hauer , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Sascha Hauer --- 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)