[PATCH RFC 0/2] next round for an uart led trigger

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

this is the next round of a led trigger for an UART. Instead of adding
callbacks to serial_core I took an approach similar to the netdev
trigger: A work thread checks the statistics of the device and if
something happened since the last round the LED is flashed.

This is an early prototype that has broken locking. Also in the long run
I want to add some "filters" to the trigger for example to trigger only
on RX or TX.

Do you (also) think this is a better approach then in the former
discussions?

I'm not yet sure how to get the locking right. After the trigger driver
got a pointer to the uart_ports structure the port must not go away
until the statistics are checked. If you have an idea here that would
be great.

By the way, I tested this driver using a gpio-led that was bound to a
gpio-simulator device[1] in qemu. Then I added a trivial driver that
just does a printk whenever an irq happens and bound this to the gpio on
the other side of the LED. So the relevant dts snippet looks as follows:

	gpiosim {
		compatible = "gpio-simulator";
		
		gpiosima: sidea {
			gpio-controller;
			#gpio-cells = <2>;
		
			interrupt-controller;
			#interrupt-cells = <2>;
		};
		
		gpiosimb: sideb {
			gpio-controller;
			#gpio-cells = <2>;
		
			interrupt-controller;
			#interrupt-cells = <2>;
		};
	};

	led {
		compatible = "gpio-leds";
	
		test {
			gpios = <&gpiosima 12 0>;
			default-state = "keep";
		};
	};
	
	verboseirq {
		compatible = "verboseirq";
		interrupt-parent = <&gpiosimb>;
		interrupts = <12 IRQ_TYPE_EDGE_BOTH>;
	};

This way I always got an output from the verboseirq driver when the uart
trigger fired.

Best regards
Uwe

[1] https://www.spinics.net/lists/linux-gpio/msg33266.html

Uwe Kleine-König (2):
  serial: provide function to access registered uart_ports
  WIP: tty-trigger

 drivers/leds/trigger/Kconfig        |   7 ++
 drivers/leds/trigger/Makefile       |   1 +
 drivers/leds/trigger/ledtrig-uart.c | 138 ++++++++++++++++++++++++++++
 drivers/tty/serial/serial_core.c    |  39 +++++++-
 include/linux/serial_core.h         |   3 +
 5 files changed, 184 insertions(+), 4 deletions(-)
 create mode 100644 drivers/leds/trigger/ledtrig-uart.c

-- 
2.19.1




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux