remarkable-linux/drivers
Yoshihiro YUNOMAE aef9a7bd9b serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers
Add tunable RX interrupt trigger I/F of FIFO buffers.

Serial devices are used as not only message communication devices but control
or sending communication devices. For the latter uses, normally small data
will be exchanged, so user applications want to receive data unit as soon as
possible for real-time tendency. If we have a sensor which sends a 1 byte data
each time and must control a device based on the sensor feedback, the RX
interrupt should be triggered for each data.

According to HW specification of serial UART devices, RX interrupt trigger
can be changed, but the trigger is hard-coded. For example, RX interrupt trigger
in 16550A can be set to 1, 4, 8, or 14 bytes for HW, but current driver sets
the trigger to only 8bytes.

This patch makes some devices change RX interrupt trigger from userland.

<How to use>
- Read current setting
 # cat /sys/class/tty/ttyS0/rx_trig_bytes
 8

- Write user setting
 # echo 1 > /sys/class/tty/ttyS0/rx_trig_bytes
 # cat /sys/class/tty/ttyS0/rx_trig_bytes
 1

<Support uart devices>
- 16550A and Tegra (1, 4, 8, or 14 bytes)
- 16650V2 (8, 16, 24, or 28 bytes)
- 16654 (8, 16, 56, or 60 bytes)
- 16750 (1, 16, 32, or 56 bytes)

<Change log>
Changes in V9:
 - Use attr_group instead of dev_spec_attr_group of uart_port structure

Changes in V8:
 - Divide this patch from V7's patch based on Greg's comment

Changes in V7:
 - Add Documentation
 - Change I/F name from rx_int_trig to rx_trig_bytes because the name
   rx_int_trig is hard to understand how users specify the value

Changes in V6:
 - Move FCR_RX_TRIG_* definition in 8250.h to include/uapi/linux/serial_reg.h,
   rename those to UART_FCR_R_TRIG_*, and use UART_FCR_TRIGGER_MASK to
   UART_FCR_R_TRIG_BITS()
 - Change following function names:
    convert_fcr2val() => fcr_get_rxtrig_bytes()
    convert_val2rxtrig() => bytes_to_fcr_rxtrig()
 - Fix typo in serial8250_do_set_termios()
 - Delete the verbose error message pr_info() in bytes_to_fcr_rxtrig()
 - Rename *rx_int_trig/rx_trig* to *rxtrig* for several functions or variables
   (but UI remains rx_int_trig)
 - Change the meaningless variable name 'val' to 'bytes' following functions:
    fcr_get_rxtrig_bytes(), bytes_to_fcr_rxtrig(), do_set_rxtrig(),
    do_serial8250_set_rxtrig(), and serial8250_set_attr_rxtrig()
 - Use up->fcr in order to get rxtrig_bytes instead of rx_trig_raw in
   fcr_get_rxtrig_bytes()
 - Use conf_type->rxtrig_bytes[0] instead of switch statement for support check
   in register_dev_spec_attr_grp()
 - Delete the checking whether a user changed FCR or not when minimum buffer
   is needed in serial8250_do_set_termios()

Changes in V5.1:
 - Fix FCR_RX_TRIG_MAX_STATE definition

Changes in V5:
 - Support Tegra, 16650V2, 16654, and 16750
 - Store default FCR value to up->fcr when the port is first created
 - Add rx_trig_byte[] in uart_config[] for each device and use rx_trig_byte[]
   in convert_fcr2val() and convert_val2rxtrig()

Changes in V4:
 - Introduce fifo_bug flag in uart_8250_port structure
   This is enabled only when parity is enabled and UART_BUG_PARITY is enabled
   for up->bugs. If this flag is enabled, user cannot set RX trigger.
 - Return -EOPNOTSUPP when it does not support device at convert_fcr2val() and
   at convert_val2rxtrig()
 - Set the nearest lower RX trigger when users input a meaningless value at
   convert_val2rxtrig()
 - Check whether p->fcr is existing at serial8250_clear_and_reinit_fifos()
 - Set fcr = up->fcr in the begging of serial8250_do_set_termios()

Changes in V3:
 - Change I/F from ioctl(2) to sysfs(rx_int_trig)

Changed in V2:
 - Use _IOW for TIOCSFIFORTRIG definition
 - Pass the interrupt trigger value itself

Signed-off-by: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17 18:23:35 -07:00
..
accessibility
acpi Merge branch 'acpi-video' 2014-07-10 21:04:25 +02:00
amba
ata ahci_xgene: fix the dma state machine lockup for the IDENTIFY DEVICE PIO mode command. 2014-07-08 11:46:05 -04:00
atm
auxdisplay
base DMA, CMA: fix possible memory leak 2014-06-23 16:47:44 -07:00
bcma
block zram: revalidate disk after capacity change 2014-07-03 09:21:53 -07:00
bluetooth Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-06-12 14:27:40 -07:00
bus bus/arm-cci: add dependency on OF && CPU_V7 2014-06-17 17:09:35 +02:00
cdrom Merge branch 'for-linus' of git://git.kernel.dk/linux-block 2014-06-11 08:41:17 -07:00
char Merge 3.16-rc5 into tty-next. 2014-07-13 15:52:12 -07:00
clk This batch of fixes is for a handful of clock drivers from Allwinner, 2014-07-13 12:21:04 -07:00
clocksource clocksource: exynos_mct: Register the timer for stable udelay 2014-07-05 06:40:23 +09:00
connector
cpufreq cpufreq: Makefile: fix compilation for davinci platform 2014-07-09 02:54:15 +02:00
cpuidle cpuidle: mvebu: Fix the name of the states 2014-06-18 21:54:46 +02:00
crypto crypto: caam - fix memleak in caam_jr module 2014-07-10 16:59:13 +08:00
dca
devfreq
dio
dma Update imx-sdma cyclic handling to report residue 2014-07-01 12:23:42 +05:30
edac
eisa
extcon
firewire
firmware efi-pstore: Fix an overflow on 32-bit builds 2014-06-27 07:30:32 +01:00
fmc
gpio gpio: of: Fix handling for deferred probe for -gpio suffix 2014-06-12 09:57:00 +02:00
gpu Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux 2014-07-10 20:37:33 -07:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 2014-07-07 13:13:03 -07:00
hsi
hv Drivers: hv: util: Fix a bug in the KVP code 2014-07-09 14:34:35 -07:00
hwmon hwmon: (adc128d818) Drop write support on inX_input attributes 2014-07-07 09:48:23 -07:00
hwspinlock
i2c i2c: sun6i-p2wi: Remove duplicate inclusion of module.h 2014-06-27 14:39:36 +02:00
ide
idle
iio iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends 2014-07-08 21:21:22 +01:00
infiniband Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2014-06-12 22:38:32 -07:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2014-06-09 18:46:02 -07:00
iommu iommu/amd: Fix small race between invalidate_range_end/start 2014-06-20 16:14:22 +02:00
ipack
irqchip irqchip: spear_shirq: Fix interrupt offset 2014-06-21 23:26:39 +00:00
isdn isdn: hisax: Drop duplicate Kconfig entry 2014-06-16 21:31:37 -07:00
leds Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds 2014-06-12 13:08:09 -07:00
lguest
macintosh powerpc/macintosh/smu.c: Fix closing brace followed by if 2014-06-24 12:43:15 +10:00
mailbox
mcb
md . Fix DM multipath IO hang regression from 3.15 due to logic bug in 2014-07-11 09:33:36 -07:00
media Merge branch 'topic/omap3isp' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 2014-06-12 23:04:28 -07:00
memory
memstick drivers/memstick/host/rtsx_pci_ms.c: add cancel_work when remove driver 2014-06-23 16:47:44 -07:00
message
mfd mfd: ab8500: Fix dt irq mapping 2014-06-26 13:34:15 +01:00
misc ARM: SoC fixes for 3.16 2014-06-25 12:19:01 -07:00
mmc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-06-12 14:27:40 -07:00
mtd Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2014-06-12 10:30:18 -07:00
net net: allwinner: emac: Add missing free_irq 2014-06-25 16:31:17 -07:00
nfc
ntb
nubus
of Devicetree bugfixe for v3.16 2014-07-06 12:11:57 -07:00
oprofile
parisc
parport
pci PCI: Fix unaligned access in AF transaction pending test 2014-06-17 15:40:13 -06:00
pcmcia
phy USB fixes for 3.16-rc5 2014-07-12 14:13:10 -07:00
pinctrl pinctrl: berlin: fix an error code in berlin_pinctrl_probe() 2014-07-05 01:15:35 +02:00
platform Merge branch 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86 2014-06-10 16:58:32 -07:00
pnp
power
powercap
pps
ps3
ptp ptp: ptp_pch depends on x86_32 2014-06-17 15:43:48 -07:00
pwm pwm: Changes for v3.16-rc1 2014-06-11 14:06:55 -07:00
rapidio
regulator Merge remote-tracking branches 'regulator/fix/bcm590xx', 'regulator/fix/palmas' and 'regulator/fix/tps65218' into regulator-linus 2014-06-28 14:01:04 +01:00
remoteproc remoteproc: da8xx: don't select CMA on no-MMU 2014-06-17 17:09:36 +02:00
reset
rpmsg
rtc drivers/rtc/rtc-puv3.c: remove "&dev->" for typo issue MIME-Version: 1.0 2014-06-20 08:22:39 +08:00
s390 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2014-06-21 06:47:01 -10:00
sbus
scsi SCSI for-linus on 20140705 2014-07-06 12:08:30 -07:00
sfi
sh
sn
soc
spi Merge remote-tracking branches 'spi/fix/pxa2xx', 'spi/fix/qup' and 'spi/fix/sh-sci' into spi-linus 2014-06-28 14:01:23 +01:00
spmi
ssb
staging tty: Remove tty_hung_up_p() tests from tty drivers' open() 2014-07-10 16:06:49 -07:00
target iscsi-target: fix iscsit_del_np deadlock on unload 2014-06-27 23:23:35 -07:00
tc TC: Handle device_register() errors. 2014-06-26 10:48:23 +01:00
thermal thermal: ti-soc-thermal: ti-bandgap.c: Cleaning up wrong address is checked 2014-07-01 09:52:35 +08:00
tty serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers 2014-07-17 18:23:35 -07:00
uio Revert "uio: fix vma io range check in mmap" 2014-06-17 16:07:08 -07:00
usb USB: serial: ftdi_sio: Add Infineon Triboard 2014-07-11 18:22:38 -07:00
uwb
vfio A handful of VFIO bug fixes for v3.16 2014-06-07 20:12:15 -07:00
vhost vhost-scsi: don't open-code kvfree 2014-06-23 09:22:48 +03:00
video fb: adv7393: add missing semicolon 2014-07-01 13:18:38 +03:00
virt
virtio
vlynq
vme
w1 w1: mxc_w1: Fix incorrect "presence" status 2014-06-19 17:51:46 -07:00
watchdog Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2014-06-21 06:47:01 -10:00
xen xen: regression and PVH fixes for 3.16-rc1 2014-06-19 07:53:27 -10:00
zorro
Kconfig
Makefile