summaryrefslogtreecommitdiff
path: root/recipes-kernel/vizzini
diff options
context:
space:
mode:
authorAndrii Pientsov <andrii.pientsov@globallogic.com>2021-01-15 11:36:07 +0200
committerAndrii Pientsov <andrii.pientsov@globallogic.com>2021-01-15 11:36:07 +0200
commit80ea39818fb8a55028d115720ead3ad6d241dc29 (patch)
tree63e7fe799caf0cf482f41dfd71b60f6fb2da2692 /recipes-kernel/vizzini
parentead8f56356152afddc2bf072f8338099d4f88d12 (diff)
downloadmeta-multitech-atmel-80ea39818fb8a55028d115720ead3ad6d241dc29.tar.gz
meta-multitech-atmel-80ea39818fb8a55028d115720ead3ad6d241dc29.tar.bz2
meta-multitech-atmel-80ea39818fb8a55028d115720ead3ad6d241dc29.zip
Add vizzini-1.1-ledrtig.patch for MTRE device.
Diffstat (limited to 'recipes-kernel/vizzini')
-rw-r--r--recipes-kernel/vizzini/vizzini-1.1/vizzini-1.1-ledrtig.patch117
-rw-r--r--recipes-kernel/vizzini/vizzini_1.1.bb2
2 files changed, 119 insertions, 0 deletions
diff --git a/recipes-kernel/vizzini/vizzini-1.1/vizzini-1.1-ledrtig.patch b/recipes-kernel/vizzini/vizzini-1.1/vizzini-1.1-ledrtig.patch
new file mode 100644
index 0000000..7d8e03a
--- /dev/null
+++ b/recipes-kernel/vizzini/vizzini-1.1/vizzini-1.1-ledrtig.patch
@@ -0,0 +1,117 @@
+diff -ur orig/vizzini.c new/vizzini.c
+--- orig/vizzini.c 2017-07-21 13:55:37.000000000 +0300
++++ new/vizzini.c 2017-07-20 15:37:52.000000000 +0300
+@@ -54,6 +54,8 @@
+ #include <linux/fcntl.h>
+ #include <asm/uaccess.h>
+
++#include <linux/leds.h>
++
+
+ #include "vizzini.h"
+ #include "vzioctl.h"
+@@ -71,6 +73,38 @@
+ static DEFINE_MUTEX(xr21v141x_table_lock);
+
+ /*
++ * LED triggers
++ */
++
++static void xr21v141x_register_led_triggers(struct xr21v141x *xr21v141x)
++{
++#ifdef CONFIG_LEDS_TRIGGERS
++ xr21v141x->led_trigger_rx_delay_on = 50;
++ xr21v141x->led_trigger_rx_delay_off = 1;
++ sprintf(xr21v141x->led_trigger_rx_name, "vizzini%d-rx", xr21v141x->minor);
++ led_trigger_register_simple(xr21v141x->led_trigger_rx_name, &xr21v141x->led_trigger_rx);
++
++ xr21v141x->led_trigger_tx_delay_on = 50;
++ xr21v141x->led_trigger_tx_delay_off = 1;
++ sprintf(xr21v141x->led_trigger_tx_name, "vizzini%d-tx", xr21v141x->minor);
++ led_trigger_register_simple(xr21v141x->led_trigger_tx_name, &xr21v141x->led_trigger_tx);
++
++ dev_info(&xr21v141x->control->dev, "%s and %s led triggers registered\n",
++ xr21v141x->led_trigger_rx_name, xr21v141x->led_trigger_tx_name);
++#endif
++}
++
++static void xr21v141x_unregister_led_triggers(struct xr21v141x *xr21v141x)
++{
++#ifdef CONFIG_LEDS_TRIGGERS
++ led_trigger_unregister_simple(xr21v141x->led_trigger_rx);
++ led_trigger_unregister_simple(xr21v141x->led_trigger_tx);
++ dev_info(&xr21v141x->control->dev, "led triggers unregistered\n");
++#endif
++}
++
++
++/*
+ * Functions for ACM control messages.
+ */
+
+@@ -330,6 +364,11 @@
+ if (!urb->actual_length)
+ return;
+
++#ifdef CONFIG_LEDS_TRIGGERS
++ led_trigger_blink_oneshot(xr21v141x->led_trigger_rx,
++ &xr21v141x->led_trigger_rx_delay_on,
++ &xr21v141x->led_trigger_rx_delay_off, 0);
++#endif
+
+ tty_insert_flip_string(&xr21v141x->port, urb->transfer_buffer, urb->actual_length);
+ tty_flip_buffer_push(&xr21v141x->port);
+@@ -653,6 +692,12 @@
+
+ spin_unlock_irqrestore(&xr21v141x->write_lock, flags);
+
++#ifdef CONFIG_LEDS_TRIGGERS
++ led_trigger_blink_oneshot(xr21v141x->led_trigger_tx,
++ &xr21v141x->led_trigger_tx_delay_on,
++ &xr21v141x->led_trigger_tx_delay_off, 0);
++#endif
++
+
+ if (stat < 0)
+ return stat;
+@@ -1723,6 +1768,9 @@
+ }
+ #endif
+
++
++ xr21v141x_register_led_triggers(xr21v141x);
++
+ return 0;
+ alloc_fail8:
+ if (xr21v141x->country_codes) {
+@@ -1817,6 +1865,8 @@
+ xr21v141x->data : xr21v141x->control);
+
+ tty_port_put(&xr21v141x->port);
++
++ xr21v141x_unregister_led_triggers(xr21v141x);
+ }
+
+ #ifdef CONFIG_PM
+diff -ur orig/vizzini.h new/vizzini.h
+--- orig/vizzini.h 2017-07-21 13:55:37.000000000 +0300
++++ new/vizzini.h 2017-07-20 15:36:57.000000000 +0300
+@@ -282,6 +282,18 @@
+ #ifdef VIZZINI_IWA
+ int iwa;
+ #endif
++
++#ifdef CONFIG_LEDS_TRIGGERS
++ char led_trigger_rx_name[32];
++ unsigned long led_trigger_rx_delay_on;
++ unsigned long led_trigger_rx_delay_off;
++ struct led_trigger *led_trigger_rx;
++ char led_trigger_tx_name[32];
++ unsigned long led_trigger_tx_delay_on;
++ unsigned long led_trigger_tx_delay_off;
++ struct led_trigger *led_trigger_tx;
++#endif
++
+ struct serial_rs485 rs485;
+ };
+
diff --git a/recipes-kernel/vizzini/vizzini_1.1.bb b/recipes-kernel/vizzini/vizzini_1.1.bb
index 8dc75f2..d7c6e0e 100644
--- a/recipes-kernel/vizzini/vizzini_1.1.bb
+++ b/recipes-kernel/vizzini/vizzini_1.1.bb
@@ -6,5 +6,7 @@ SRC_URI += "file://xr21v141x-lnx3.10-3.11.tar.gz \
file://vizzini-1.1-enable-cts.patch \
file://vizzini-1.1-rs485.patch \
"
+SRC_URI_append_mtre = "file://vizzini-1.1-ledrtig.patch \
+ "
S = "${WORKDIR}/xr21v141x-lnx3.10-3.11"