Commit Graph

637214 Commits

Author SHA1 Message Date
Frank Chen
fca348e23a android logger: backport ANDROID_LOGGER driver
PD#131267: backport ANDROID_LOGGER driver
Android logger driver is legacy driver need by GC4A and low version
Android.

Change-Id: I16d305cd1b2c617a3515daafd5998210f2e21989
Signed-off-by: Frank Chen <frank.chen@amlogic.com>
2017-03-20 20:10:54 -08:00
Frank Chen
1545dd4933 dts: add p400 dts
PD#131267: add p400 dts
p400 is A112 development board

Change-Id: I7bc87433e4618af5370d1b258e86d0aa80e06699
Signed-off-by: Frank Chen <frank.chen@amlogic.com>
2017-03-20 12:22:43 +08:00
Jianxin Pan
1cd9291251 emmc: restore sdio_reset_comm
PD#138714: emmc: sdio_reset_comm is removed to fix upstream merge conflict.
Now restore again.

Change-Id: I0b2fc161d0fe7c4938a33e0715ee5cc3c5b4a12b
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
2017-03-17 15:25:17 +08:00
Jianxin Pan
b4ca9d56dc defconfig: enable interactive cpufreq governor
PD#138714: cpufreq: enable interactive

Change-Id: I8059b4e36879c13e6eceb3b4a3b1acddeae38000
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
2017-03-17 14:16:08 +08:00
Tao Zeng
b56a98ab9a thermal: initial add thermal driver
PD#138714: initial add thermal driver

1. Add amlogic thermal sensor driver
2. add cpu/gpu core cooling methord and gpu freq cooling devices;
3. device tree support of thermal for p212/q200
4. related dtsi/Makefiles/Kconfig/Headfiles update

Change-Id: I555fbb1e36a3cdc3187d92bdf5da6a720f2377d0
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
2017-03-17 13:14:32 +08:00
Nan Li
42dcc2cf34 unifykey: add key manage driver support
PD#138714: initial add unifykey driver

Change-Id: Iab32caa7b2b8921f8c9dfb66de339cf4cc04477c
Signed-off-by: Nan Li <nan.li@amlogic.com>
2017-03-17 11:09:51 +08:00
Yan Wang
c32c62408c securitykey: add securitykey.
PD#138714: securitykey: add securitykey driver.

Change-Id: Id897a9f5da3738d22613f2424aa06c8a5dc40801
Signed-off-by: Yan Wang <yan.wang@amlogic.com>
2017-03-16 02:57:35 -08:00
Victor Wan
df1edbb5ac Merge branch 'linux-linaro-lsk-v4.9-android' into amlogic-4.9-dev 2017-03-16 17:06:57 +08:00
Tao Zeng
d49f593d94 cec: porting cec drivers
PD#131267: cec: porting cec driver

1. add driver files and related Makefiles for cec driver;
2. add head files of cec files;
3. add hdmitx notifications for hpd hot-plug and physical
   address valid.
4. update cec dts configuration.

Change-Id: I2ff81d84146b2e5c4ca920efba00c82a9ef8e30f
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
2017-03-16 11:06:16 +08:00
Nan Li
9d430a5a13 emmc: Solve the problem of conflict of emmc error
PD#138714: Solve the problem of conflict of emmc error

gxl p212 v3 emmc will data crc err. kernel 4.9 has mmc_retune()
in the __mmc_start_request().

when emmc err to retry, mmc_retune() will switch emmc between
hs400 and hs200, then tuning, it will work on amlogic driver retry.
then emmc init fail.
so wo comment out a piece of code.

test on gxl p212 v3

Change-Id: I041a20fe3e7aa29a619cc3cc6652d8f3b37b1f1b
Signed-off-by: Nan Li <nan.li@amlogic.com>
2017-03-15 20:50:49 +08:00
Ke Gong
763e1f059d smartcard: add the smartcard driver
PD#138714: add the smartcard driver

1.add smartcard driver
2.add Documentation/devicetree/bindings/amlogic/amlogic-smartcard.txt
3.add CONFIG_AMLOGIC_SMARTCARD to meson64_defconfig

Change-Id: I1855c4df061b6d937f1bda7d603d3f02d6e90ef5
Signed-off-by: Ke Gong <ke.gong@amlogic.com>
2017-03-15 20:29:20 +08:00
Jiyu Yang
350e8c6ff5 dts: add gpu clk dts node
PD#138714: dts: add gpu clk dts node

Change-Id: Ie0084c1c51a705e7cd4cd23354979c37e953b6af
Signed-off-by: Jiyu Yang <jiyu.yang@amlogic.com>
(cherry picked from commit 296a25d4c6460d84c67aca5d2331ff3a46fbaaf0)
2017-03-15 03:31:10 -08:00
Jiyu Yang
e2a0a1c56d clk: init gpu clk
PD#138714: clk: init gpu clk

Change-Id: I2f618b0dbbb9e5788e496fc337b7dafd5c34c863
Signed-off-by: Jiyu Yang <jiyu.yang@amlogic.com>
2017-03-15 03:19:00 -08:00
Dezhi Kong
ea47f1eb1e vdin: add vdin,viu
PD#138714: initial add vdin,viu drivers

Change-Id: Idf6a8213133343b433d18a183a72e0bcf2270331
Signed-off-by: Dezhi Kong <dezhi.kong@amlogic.com>
2017-03-15 12:23:08 +08:00
KeLe Bai
10b6bcbcb9 deinterlace: add deinterlace,dnr,field-detection,vof
PD#138714: initial add deinterlace,dnr,field-detection,vof drivers
1. merge deinterlace driver from 3.14
2. current commit is PD#136044
3. remove old pulldown algorithm

Change-Id: Ie36991cdcdfeda2b644619d72f8403d2dc44e17a
Signed-off-by: KeLe Bai <kele.bai@amlogic.com>
2017-03-14 20:50:34 +08:00
Nanxin Qin
c95bdc054a media: update multimedia drivers
PD#138714: media: update the code from commit-id efafd96 on the branch
of amlogic-3.14-dev

Change-Id: I7ed198e2a31f0ca9f2e3ea88fefb1c30dfcdc95b
Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
2017-03-14 04:24:38 -08:00
Yuxi Sun
c7e20b61b7 dts: add h264 and h265 device
PD#138714: Add h264 and h265 device in dts

Change-Id: I857584d4b207db8498e36ab0f097f2153dbd0bf8
Signed-off-by: Yuxi Sun <yuxi.sun@amlogic.com>
2017-03-14 04:22:09 -08:00
Yun Cai
6ed1001786 vrtc: add vrtc driver
PD#138714: add amlogic vrtc driver

Change-Id: I8aee09041d2d20f06113c1ac0ce310f0c8c68384
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
2017-03-14 03:35:52 -08:00
Jianxin Pan
320599c660 compiler: fix gcc6 compilation error
PD#138714: gcc-6 warns about obviously wrong indentation

Change-Id: I41ecc671536c8083d13c4da00e09ddbe5f7c59c1
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
2017-03-14 18:44:55 +08:00
Jianxin Pan
7ff1183340 defconfig: enable usb audio
PD#138714: enable usb audio
 CONFIG_SND_USB_AUDIO=y
 CONFIG_SOUND=y
 CONFIG_SND=y

Change-Id: Id95c2f101ade4ead91f6292b876cdfeab20962e6
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
2017-03-10 16:58:15 +08:00
Jianxin Pan
bfc0d5ba93 arm64: change TEXT_OFFSET to 1080000
PD#138714: change TEXT_OFFSET to 1080000 to compatible with uboot
1. change TEXT_OFFSET to 1080000
2. mkdir .git/hooks to avoid compiling error when build without git

Change-Id: I499f1369d0f818b95ee2afc8a2bb98ca5b828b22
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
2017-03-09 19:48:51 +08:00
Nan Li
a0de710366 emmc: add sd emmc driver
PD#138714: add sd/emmc driver support
1 add emmc hs200/hs400 mode
2 add sd highspeed mode
3 add sd hotplug detect
4 add emmc clock tree supported
5 add sdio get_wifi_inf & sdio_reinit
6 add partitions on dts
7 add sd/emmc pinmux set

Change-Id: I449e61517844cb4cb9ad3aaa2f79c911e8658356
Signed-off-by: Nan Li <nan.li@amlogic.com>
2017-03-08 19:02:59 -08:00
Yun Cai
260c6d8c9b clocktree: update misc clk
PD#138714: update misc clock for gxl

Change-Id: I9cf067ba8c39fbcfa5fe17671f3bd6a9ec890263
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
2017-03-08 18:06:33 -08:00
Xingyu Chen
1c522dcb6f remote: add remote driver
PD#138714: initial add remote driver

temporarily disable the feature which reporting event after system resume,
and it will be enabled after the 'amlogic/pm' driver is available.

Change-Id: I57312621557f050401b5028b7607144cb9a9351f
Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
2017-03-08 20:18:42 +08:00
Jianxin Pan
4d207f9ec2 pinctrl: fix gpio irq and pinmux bugs
PD#138714: fix gpio irq and pinmux bugs
1. fix gpio irq issue
2. fix clear pinmux error when get gpio
3. fix emmc_ds mux

Change-Id: I983989a4f96b61c29c9043c30ffc4ce62c31a7ab
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
2017-03-07 23:06:47 -08:00
Zongdong Jiao
abf5acf549 hdmitx: add hdmitx driver
PD#138714: add hdmitx driver

Change-Id: Iffe4a2a88633d3e3d67ba1aec4c6ea5c2a912aec
Signed-off-by: Zongdong Jiao <zongdong.jiao@amlogic.com>
2017-03-08 14:49:51 +08:00
Pengcheng Chen
4dafe9905e media: add osd & ge2d driver
PD#138714: add osd & ge2d driver

Change-Id: I70c0e1e2b5e29a158b8a41e27bbc4db2fd49bb9a
Signed-off-by: Pengcheng Chen <pengcheng.chen@amlogic.com>
2017-03-07 03:47:53 -08:00
Evoke Zhang
384fc38e44 vout: add vout serve driver
138714: initial add vout serve driver

Change-Id: Ib6620d3fc89bd43f7d362b6ac911a011b5052ed3
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
2017-03-06 19:55:47 +08:00
Evoke Zhang
7dd2bd23a8 vpu: add vpu driver
PD#138714: initial add vpu driver

Change-Id: I84a8c00082b393f417ffdd1a155346cc6272743b
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
2017-03-06 19:54:21 +08:00
Nanxin Qin
c1b39e0614 media: add the common of the multimedia.
PD#138714: initial add common part of mm

Change-Id: I58265ba464b3ec6dd819275cfaa385acb706c6db
Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
2017-03-02 15:20:14 +08:00
Jian Hu
76b338ae5f pwm: add pwm driver
PD#138714: initial add pwm driver

Change-Id: Ief5a3432642b8f2de8fecffaf51b5c055c696078
Signed-off-by: Jian Hu <jian.hu@amlogic.com>
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
2017-02-28 12:32:26 +08:00
Jianxin Pan
8a3ce8ddbc hotplug: add cpu hotplug support
PD#138714: add cpu hotplug
Split cpu hotplug from cpufreq_hotplug. Cpu hotplug is not depend on
cpufreq_hotplug.

Change-Id: I4888f6d046e26561166b55aab48ca0a4b0ac9dd3
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
2017-02-28 12:24:39 +08:00
Yizhou Jiang
467f3a6a87 ethernet: initial add the MAC and PHY driver
PD#131267: eth: initial add the MAC and PHY driver

1.internal eth phy supported
2.external eth phy supported
3.internal external phy can be switched by modify dts file

Change-Id: Id5e17b7fe0bef31ccf1c56d86764ef4bcb610a46
Signed-off-by: Yizhou Jiang <yizhou.jiang@amlogic.com>
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
2017-02-28 12:20:33 +08:00
Xuhua Zhang
f4f9e5f344 i2c: add aml i2c driver
PD#138714: initial add amlogic i2c driver.

Change-Id: Ifdcaa41eb1ab7d2dd88ac065332c29b67f169505
Signed-off-by: Xuhua Zhang <xuhua.zhang@amlogic.com>
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
2017-02-26 23:46:02 -08:00
Alex Shi
0dbbc74421 Merge branch 'linux-linaro-lsk-v4.9' into linux-linaro-lsk-v4.9-android 2017-02-27 12:13:50 +08:00
Greg Kroah-Hartman
3737a5f722 Linux 4.9.13 2017-02-26 11:11:18 +01:00
Brian Foster
d004006055 xfs: clear delalloc and cache on buffered write failure
commit fa7f138ac4 upstream.

The buffered write failure handling code in
xfs_file_iomap_end_delalloc() has a couple minor problems. First, if
written == 0, start_fsb is not rounded down and it fails to kill off a
delalloc block if the start offset is block unaligned. This results in a
lingering delalloc block and broken delalloc block accounting detected
at unmount time. Fix this by rounding down start_fsb in the unlikely
event that written == 0.

Second, it is possible for a failed overwrite of a delalloc extent to
leave dirty pagecache around over a hole in the file. This is because is
possible to hit ->iomap_end() on write failure before the iomap code has
attempted to allocate pagecache, and thus has no need to clean it up. If
the targeted delalloc extent was successfully written by a previous
write, however, then it does still have dirty pages when ->iomap_end()
punches out the underlying blocks. This ultimately results in writeback
over a hole. To fix this problem, unconditionally punch out the
pagecache from XFS before the associated delalloc range.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-26 11:10:52 +01:00
Michael Schenk
57d759622a rtlwifi: rtl_usb: Fix for URB leaking when doing ifconfig up/down
commit 575ddce050 upstream.

In the function rtl_usb_start we pre-allocate a certain number of urbs
for RX path but they will not be freed when calling rtl_usb_stop. This
results in leaking urbs when doing ifconfig up and down. Eventually,
the system has no available urbs.

Signed-off-by: Michael Schenk <michael.schenk@albis-elcon.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-26 11:10:52 +01:00
Tejun Heo
1cb3de83ab block: fix double-free in the failure path of cgwb_bdi_init()
commit 5f478e4ea5 upstream.

When !CONFIG_CGROUP_WRITEBACK, bdi has single bdi_writeback_congested
at bdi->wb_congested.  cgwb_bdi_init() allocates it with kzalloc() and
doesn't do further initialization.  This usually works fine as the
reference count gets bumped to 1 by wb_init() and the put from
wb_exit() releases it.

However, when wb_init() fails, it puts the wb base ref automatically
freeing the wb and the explicit kfree() in cgwb_bdi_init() error path
ends up trying to free the same pointer the second time causing a
double-free.

Fix it by explicitly initilizing the refcnt to 1 and putting the base
ref from cgwb_bdi_destroy().

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Fixes: a13f35e871 ("writeback: don't embed root bdi_writeback_congested in bdi_writeback")
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-26 11:10:52 +01:00
Lv Zheng
62c153f346 ACPICA: Linuxize: Restore and fix Intel compiler build
commit ffab9188e4 upstream.

ACPICA commit b59347d0b8b676cb555fe8da5cad08fcd4eeb0d3

The following commit cleans up compiler specific inclusions:

  Commit: 9fa1cebdbf
  Subject: ACPICA: OSL: Cleanup the inclusion order of the compiler-specific headers

But breaks one thing due to the following old issue:

 Buidling Linux kernel with Intel compiler originally depends on acgcc.h
 not acintel.h.

So after making Intel compiler build working in ACPICA upstream by
correctly using acintel.h, it becomes unable to build Linux kernel using
Intel compiler as there is no acintel.h in the kernel source tree.

This patch releases acintel.h to Linux kernel and fixes its inclusion in
acenv.h.

Fixes: 9fa1cebdbf (ACPICA: OSL: Cleanup the inclusion order of the compiler-specific headers)
Link: https://github.com/acpica/acpica/commit/b59347d0
Tested-by: Stepan M Mishura <stepan.m.mishura@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-26 11:10:52 +01:00
Jiri Kosina
8f9872be6d netfilter: nf_ct_helper: warn when not applying default helper assignment
commit dfe75ff8ca upstream.

Commit 3bb398d925 ("netfilter: nf_ct_helper: disable automatic helper
assignment") is causing behavior regressions in firewalls, as traffic
handled by conntrack helpers is now by default not passed through even
though it was before due to missing CT targets (which were not necessary
before this commit).

The default had to be switched off due to security reasons [1] [2] and
therefore should stay the way it is, but let's be friendly to firewall
admins and issue a warning the first time we're in situation where packet
would be likely passed through with the old default but we're likely going
to drop it on the floor now.

Rewrite the code a little bit as suggested by Linus, so that we avoid
spaghettiing the code even more -- namely the whole decision making
process regarding helper selection (either automatic or not) is being
separated, so that the whole logic can be simplified and code (condition)
duplication reduced.

[1] https://cansecwest.com/csw12/conntrack-attack.pdf
[2] https://home.regit.org/netfilter-en/secure-use-of-helpers/

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-26 11:10:52 +01:00
Thomas Gleixner
e6bdd8d2ff goldfish: Sanitize the broken interrupt handler
commit 6cf18e6927 upstream.

This interrupt handler is broken in several ways:

  - It loops forever when the op code is not decodeable

  - It never returns IRQ_HANDLED because the only way to exit the loop
    returns IRQ_NONE unconditionally.

The whole concept of this is broken. Creating devices in an interrupt
handler is beyond any point of sanity.

Make it at least behave halfways sane so accidental users do not have to
deal with a hard to debug lockup.

Fixes: e809c22b8f ("goldfish: add the goldfish virtual bus")
Reported-by: Gabriel C <nix.or.die@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-26 11:10:52 +01:00
Thomas Gleixner
2709c2a1b0 x86/platform/goldfish: Prevent unconditional loading
commit 47512cfd0d upstream.

The goldfish platform code registers the platform device unconditionally
which causes havoc in several ways if the goldfish_pdev_bus driver is
enabled:

 - Access to the hardcoded physical memory region, which is either not
   available or contains stuff which is completely unrelated.

 - Prevents that the interrupt of the serial port can be requested

 - In case of a spurious interrupt it goes into a infinite loop in the
   interrupt handler of the pdev_bus driver (which needs to be fixed
   seperately).

Add a 'goldfish' command line option to make the registration opt-in when
the platform is compiled in.

I'm seriously grumpy about this engineering trainwreck, which has seven
SOBs from Intel developers for 50 lines of code. And none of them figured
out that this is broken. Impressive fail!

Fixes: ddd70cf93d ("goldfish: platform device for x86")
Reported-by: Gabriel C <nix.or.die@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-26 11:10:52 +01:00
Johan Hovold
fef3fdf2d8 USB: serial: console: fix uninitialised spinlock
commit 14816b16fa upstream.

Since commit 4a51096937 ("tty: Make tty_files_lock per-tty") a new
tty_struct spin lock is taken in the tty release path, but the
USB-serial-console hack was never updated hence leaving the lock of its
"fake" tty uninitialised. This was eventually detected by lockdep.

Make sure to initialise the new lock also for the fake tty to address
this regression.

Yes, this code is a mess, but cleaning it up is left for another day.

Fixes: 4a51096937 ("tty: Make tty_files_lock per-tty")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-26 11:10:52 +01:00
Johan Hovold
960a38eae8 USB: serial: ark3116: fix register-accessor error handling
commit 9fef37d7cf upstream.

The current implementation failed to detect short transfers, something
which could lead to bits of the uninitialised heap transfer buffer
leaking to user space.

Fixes: 149fc791a4 ("USB: ark3116: Setup some basic infrastructure for new ark3116 driver.")
Fixes: f4c1e8d597 ("USB: ark3116: Make existing functions 16450-aware and add close and release functions.")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-26 11:10:52 +01:00
Johan Hovold
a2ce74e35d USB: serial: opticon: fix CTS retrieval at open
commit 2eee05020a upstream.

The opticon driver used a control request at open to trigger a CTS
status notification to be sent over the bulk-in pipe. When the driver
was converted to using the generic read implementation, an inverted test
prevented this request from being sent, something which could lead to
TIOCMGET reporting an incorrect CTS state.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 7a6ee2b027 ("USB: opticon: switch to generic read implementation")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-26 11:10:52 +01:00
Johan Hovold
a1fc6fb5f3 USB: serial: spcp8x5: fix modem-status handling
commit 5ed8d41023 upstream.

Make sure to detect short control transfers and return zero on success
when retrieving the modem status.

This fixes the TIOCMGET implementation which since e1ed212d85 ("USB:
spcp8x5: add proper modem-status support") has returned TIOCM_LE on
successful retrieval, and avoids leaking bits from the stack on short
transfers.

This also fixes the carrier-detect implementation which since the above
mentioned commit unconditionally has returned true.

Fixes: e1ed212d85 ("USB: spcp8x5: add proper modem-status support")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-26 11:10:51 +01:00
Johan Hovold
26805681a4 USB: serial: ftdi_sio: fix line-status over-reporting
commit a6bb1e17a3 upstream.

FTDI devices use a receive latency timer to periodically empty the
receive buffer and report modem and line status (also when the buffer is
empty).

When a break or error condition is detected the corresponding status
flags will be set on a packet with nonzero data payload and the flags
are not updated until the break is over or further characters are
received.

In order to avoid over-reporting break and error conditions, these flags
must therefore only be processed for packets with payload.

This specifically fixes the case where after an overrun, the error
condition is continuously reported and NULL-characters inserted until
further data is received.

Reported-by: Michael Walle <michael@walle.cc>
Fixes: 72fda3ca6f ("USB: serial: ftd_sio: implement sysrq handling on
break")
Fixes: 166ceb6907 ("USB: ftdi_sio: clean up line-status handling")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-26 11:10:51 +01:00
Johan Hovold
a1510a8c0d USB: serial: ftdi_sio: fix extreme low-latency setting
commit c6dce26266 upstream.

Since commit 557aaa7ffa ("ft232: support the ASYNC_LOW_LATENCY
flag") the FTDI driver has been using a receive latency-timer value of
1 ms instead of the device default of 16 ms.

The latency timer is used to periodically empty a non-full receive
buffer, but a status header is always sent when the timer expires
including when the buffer is empty. This means that a two-byte bulk
message is received every millisecond also for an otherwise idle port as
long as it is open.

Let's restore the pre-2009 behaviour which reduces the rate of the
status messages to 1/16th (e.g. interrupt frequency drops from 1 kHz to
62.5 Hz) by not setting ASYNC_LOW_LATENCY by default.

Anyone willing to pay the price for the minimum-latency behaviour should
set the flag explicitly instead using the TIOCSSERIAL ioctl or a tool
such as setserial (e.g. setserial /dev/ttyUSB0 low_latency).

Note that since commit 0cbd81a9f6 ("USB: ftdi_sio: remove
tty->low_latency") the ASYNC_LOW_LATENCY flag has no other effects but
to set a minimal latency timer.

Reported-by: Antoine Aubert <a.aubert@overkiz.com>
Fixes: 557aaa7ffa ("ft232: support the ASYNC_LOW_LATENCY flag")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-26 11:10:51 +01:00
Johan Hovold
f3d56f7a58 USB: serial: ftdi_sio: fix modem-status error handling
commit 427c3a95e3 upstream.

Make sure to detect short responses when fetching the modem status in
order to avoid parsing uninitialised buffer data and having bits of it
leak to user space.

Note that we still allow for short 1-byte responses.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-26 11:10:51 +01:00