From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935057AbcKWKCM (ORCPT ); Wed, 23 Nov 2016 05:02:12 -0500 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:40727 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934727AbcKWKBJ (ORCPT ); Wed, 23 Nov 2016 05:01:09 -0500 From: Sascha Hauer To: linux-serial@vger.kernel.org Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, , kernel@pengutronix.de, Sascha Hauer Subject: [PATCH 3/4] serial: cpm_uart: Add LED trigger support Date: Wed, 23 Nov 2016 11:01:05 +0100 Message-Id: <20161123100106.15969-4-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-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Sascha Hauer --- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index d3e3d42..5d5633d 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c @@ -255,6 +255,8 @@ static void cpm_uart_int_rx(struct uart_port *port) pr_debug("CPM uart[%d]:RX INT\n", port->line); + uart_led_trigger_rx(port); + /* Just loop through the closed BDs and copy the characters into * the buffer. */ @@ -721,6 +723,8 @@ static int cpm_uart_tx_pump(struct uart_port *port) /* Pick next descriptor and fill from buffer */ bdp = pinfo->tx_cur; + uart_led_trigger_tx(port); + while (!(in_be16(&bdp->cbd_sc) & BD_SC_READY) && xmit->tail != xmit->head) { count = 0; @@ -1426,13 +1430,27 @@ static int cpm_uart_probe(struct platform_device *ofdev) if (ret) return ret; - return uart_add_one_port(&cpm_reg, &pinfo->port); + ret = uart_add_one_port(&cpm_reg, &pinfo->port); + if (ret) + return ret; + + uart_add_led_triggers(&cpm_reg, &pinfo->port); + + return 0; } static int cpm_uart_remove(struct platform_device *ofdev) { struct uart_cpm_port *pinfo = platform_get_drvdata(ofdev); - return uart_remove_one_port(&cpm_reg, &pinfo->port); + int ret; + + ret = uart_remove_one_port(&cpm_reg, &pinfo->port); + if (ret) + return ret; + + uart_remove_led_triggers(&pinfo->port); + + return 0; } static const struct of_device_id cpm_uart_match[] = { -- 2.10.2