diff options
author | Fabio Baltieri <fabio.baltieri@gmail.com> | 2012-12-18 12:50:59 -0500 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2013-01-26 10:59:00 -0500 |
commit | 4723f2b8a12b6170e1835082d8c73fa932306846 (patch) | |
tree | 9d2f1f429e81e8593f46fda3db45e978ccd75d98 /drivers/net/can | |
parent | adccadb92f0571fd0f9b2ac8011057a7de9e3e63 (diff) |
can: at91_can: add LED trigger support
Add support for canbus activity led indicators on at91_can devices by
calling appropriate can_led functions.
These are only enabled when CONFIG_CAN_LEDS is Y, becomes no-op
otherwise.
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/at91_can.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index 81baefda037b..44f363792b59 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c | |||
@@ -37,6 +37,7 @@ | |||
37 | 37 | ||
38 | #include <linux/can/dev.h> | 38 | #include <linux/can/dev.h> |
39 | #include <linux/can/error.h> | 39 | #include <linux/can/error.h> |
40 | #include <linux/can/led.h> | ||
40 | 41 | ||
41 | #define AT91_MB_MASK(i) ((1 << (i)) - 1) | 42 | #define AT91_MB_MASK(i) ((1 << (i)) - 1) |
42 | 43 | ||
@@ -641,6 +642,8 @@ static void at91_read_msg(struct net_device *dev, unsigned int mb) | |||
641 | 642 | ||
642 | stats->rx_packets++; | 643 | stats->rx_packets++; |
643 | stats->rx_bytes += cf->can_dlc; | 644 | stats->rx_bytes += cf->can_dlc; |
645 | |||
646 | can_led_event(dev, CAN_LED_EVENT_RX); | ||
644 | } | 647 | } |
645 | 648 | ||
646 | /** | 649 | /** |
@@ -875,6 +878,7 @@ static void at91_irq_tx(struct net_device *dev, u32 reg_sr) | |||
875 | /* _NOTE_: subtract AT91_MB_TX_FIRST offset from mb! */ | 878 | /* _NOTE_: subtract AT91_MB_TX_FIRST offset from mb! */ |
876 | can_get_echo_skb(dev, mb - get_mb_tx_first(priv)); | 879 | can_get_echo_skb(dev, mb - get_mb_tx_first(priv)); |
877 | dev->stats.tx_packets++; | 880 | dev->stats.tx_packets++; |
881 | can_led_event(dev, CAN_LED_EVENT_TX); | ||
878 | } | 882 | } |
879 | } | 883 | } |
880 | 884 | ||
@@ -1128,6 +1132,8 @@ static int at91_open(struct net_device *dev) | |||
1128 | goto out_close; | 1132 | goto out_close; |
1129 | } | 1133 | } |
1130 | 1134 | ||
1135 | can_led_event(dev, CAN_LED_EVENT_OPEN); | ||
1136 | |||
1131 | /* start chip and queuing */ | 1137 | /* start chip and queuing */ |
1132 | at91_chip_start(dev); | 1138 | at91_chip_start(dev); |
1133 | napi_enable(&priv->napi); | 1139 | napi_enable(&priv->napi); |
@@ -1159,6 +1165,8 @@ static int at91_close(struct net_device *dev) | |||
1159 | 1165 | ||
1160 | close_candev(dev); | 1166 | close_candev(dev); |
1161 | 1167 | ||
1168 | can_led_event(dev, CAN_LED_EVENT_STOP); | ||
1169 | |||
1162 | return 0; | 1170 | return 0; |
1163 | } | 1171 | } |
1164 | 1172 | ||
@@ -1321,6 +1329,8 @@ static int at91_can_probe(struct platform_device *pdev) | |||
1321 | goto exit_free; | 1329 | goto exit_free; |
1322 | } | 1330 | } |
1323 | 1331 | ||
1332 | devm_can_led_init(dev); | ||
1333 | |||
1324 | dev_info(&pdev->dev, "device registered (reg_base=%p, irq=%d)\n", | 1334 | dev_info(&pdev->dev, "device registered (reg_base=%p, irq=%d)\n", |
1325 | priv->reg_base, dev->irq); | 1335 | priv->reg_base, dev->irq); |
1326 | 1336 | ||