fix false disconnect due to a signal sent to the reading process

- In the current implementation, when a signal is sent to the reading process,
  read is cancelled by calling usb_ep_dequeue, which lead into calling
  acc_complete_out with ECONNRESET, but the current logic treats it as
  disconnection, which makes the device inaccessible until cable is actually
  disconnected.
- The fix calls disconnect only when ESHUTDOWN error is passed.
- If data has already arrived while trying cancelling, the data is marked
  as available, and it will be read out on the next read. This is necessary
  as USB bulk is assumed to guarantee no data loss.

Signed-off-by: keunyoung <keunyoung@google.com>
tcp: add a sysctl to config the tcp_default_init_rwnd

The default initial rwnd is hardcoded to 10.

Now we allow it to be controlled via
  /proc/sys/net/ipv4/tcp_default_init_rwnd
which limits the values from 3 to 100

This is somewhat needed because ipv6 routes are
autoconfigured by the kernel.

See "An Argument for Increasing TCP's Initial Congestion Window"
in https://developers.google.com/speed/articles/tcp_initcwnd_paper.pdf

Change-Id: I386b2a9d62de0ebe05c1ebe1b4bd91b314af5c54
Signed-off-by: JP Abgrall <jpa@google.com>
msm: vidc: fix memory leak issue in dynamic buffer mode

While flushing output buffers held in v4l2 video
driver, i.e, with ref count equal to 2, the driver
was freeing the binfo structure. This would leak
the mapped output buffer memory. By avoiding
freeing of the binfo structure, the driver waits
for the release reference event from the firmware
to free and unmap the output buffer. Also move
initialization of dequeued flag for buffers to be
held in driver, till the time we queue this buffer
to firmware. By not doing so, the video driver can
enter a race condition, whereby, a output buffer could
be unmapped and freed before v4l2 client has called
dequeue on the buffer.

Change-Id: Ic95f13b9f4426574012539a76c0b87bedb8e805a
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
msm: vidc: fix corruption of registered buffer list

The buffer list for output buffers is accessed from
different threads leading to race conditions. Consider
the case of firmware throwing up a fatal error, which gets
propagated to v4l2 client. The v4l2 client closes the
driver fd, which will trigger msm_vidc_release_buffers
to release all output buffers and free node from
the registered buffer list. During this time, if
firmware sends a release reference event, the buffer
node being accessed in msm_vidc_release_buffers could
be freed, triggering kernel panic.

Change-Id: I522edff06a62dbc2ab60d6cca5990babb18d5c6c
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
(cherry picked from commit 7533645e6c683cb7aa9ae61247657994383d6bec)
i2c_qup: Improve implementation of PM callbacks

Refactor PM callbacks and remove redundant variable.
Add support for configuration of clockcontrol event.
Now the clock's state may be set by pm calls (as before)
or by a transfer's begining and ending.
Runtime-PM is still used in autosuspend configuration for
expensive NoC voting/unvoting since that may go to remote
processor.

CRs-Fixed: 592435
Change-Id: I54f7c67f768336f66765a04006b4c8e4734ac277
Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Sana Venkat Raju <c_vsana@codeaurora.org>
i2c_qup: Fix for unhandled IRQ

I2C qup driver handle scenario where runtime
PM is not enabled and enables clocks explicitly.
But it checks runtime PM suspended state in ISR
routine before processing further which can lead to issue
of unhandled valid IRQ sometimes because I2C client
can initiate transaction very early after system
resume and runtime PM is not enabled.

Add atomic flag to synchronize between active transaction
request when clocks are enabled and ISR.

CRs-Fixed: 670480
Change-Id: I175bc29a7b5b6e713ab6ec28deb34b2b0d23fa8a
Signed-off-by: Sana Venkat Raju <c_vsana@codeaurora.org>
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
Merge remote-tracking branch 'do/LG-STOCK-KK' into LG-STOCK-KK
msm: mdss: Add missing BL lock around BL-related info

The bl_updated variable requires the BL lock. Otherwise, it can be
corrupted and cause backlight issues.

Change-Id: I55eb4b8d525765ede4f27a404f5c3f1f0b446719
Signed-off-by: Benet Clark <benetc@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_fb.c
	drivers/video/msm/mdss/mdss_mdp_splash_logo.c
msm: mdss: Add backlight notification support for PP features

Notify post-processing features whenever there is a backlight change, so
that PP feature can update accordingly.

Change-Id: I2317088752444478bcfd9cf4f6acfa8553e85d30
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: control backlight level during blank and unblank events

Add code to set the backlight level to zero for blank event
and restore the backlight level to its previous value during
unblank event. This will fix any unexpected panel flicker
that might show up on the screen during panel ON sequence.

CRs-Fixed: 608091
Change-Id: I871a067b0cc40d893b8b7e5a25103ebb914f9b7a
Signed-off-by: Chandan Uddaraju <chandanu@codeaurora.org>
Signed-off-by: Benet Clark <benetc@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_fb.c
msm: mdss: acquire list_lock before calling free pipe

If unblank call and display thread tries to free pipe
list at the same time; one of the caller might hit the
null free list and leads to crash. Acquire list_lock
before calling the free pipe API.

Change-Id: Ieb6af1700803e3049ea918e2be358e55e43d477a
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
mmc: sdhci: Fix issue with SDHCI_NEEDS_RETUNING

The following two issues are addressed with this change -

1. The current code sets SDHCI_NEEDS_RETUNING flag even for tuning
commands and it will unecessarily cause tuning to be done again
for the next read/write command. Hence, we must not set this flag
for any CRC failures to tuning commands.

2. If SDHCI_NEEDS_RETUNING flag is set and if all tuning phases
pass, then the driver attempts to change the driver type by sending
CMD6 which is a not a tuning command. The driver will thus attempt
to do re-tuning again before sending CMD6 and goes forever in a
recursive loop. Hence, clear SDHCI_NEEDS_RETUNING flag before
executing tuning.

Change-Id: Iaf3b24b93fdf655392fe02c973799e465960a495
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
msm: mdss: check for fb node refcount before calling null commit

Add a frame buffer reference count check before calling
null commit to release the free list pipes. This avoids
unnecessary flickering on screen if a process tries to open
and close the fb node without performing any operation.

Change-Id: I96b824edccf27f0ddb796c420ef1feb49f65ddea
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
drivers: dma: warn if ioremap fails

dma-removed alloc hook tries to ioremap a carve-out in order
to memset it to 0s. Warn the user if it fails due to low
vmalloc space.

CRs-fixed: 652009
Change-Id: If8d1a220c8e604222a44c5bf5201fc2d03e370b8
Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>

Conflicts:
	drivers/base/dma-removed.c
arm: dma-removed: Add option to skip buffer zeroing

The DMA framework currently zeros all buffers because it (righfully so)
assumes that drivers will soon need to pass the memory to a device.
Some devices/use case may not require zeroed memory and there can
be an increase in performance if we skip the zeroing. Use the
DMA_ATTR_SKIP_ZEROING attr to allow skipping of DMA zeroing.

Change-Id: Ie7a8ae547834c29a6a4f327095e099c53526f3f7
Signed-off-by: Taniya Das <tdas@codeaurora.org>
msm: mdss: Add support to configure the video mode interleave bit

Some video mode panels need to have the command mode
operation interleaved on the last line of the video stream.
Add support to enable this register via a panel dtsi property.

Change-Id: I3dfe36816d7602da4f66d09ea23ac9c6185f9858
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
msm: mdss: fix the pack alignment of MDP output for RGB666 format

Currently for RGB666 format, the MDP output is set as LSB aligned
and banding artifacts are observed due to this. Set the MDP output
to be MSB aligned to avoid these artifacts and for the display
to show up fine with RGB666 format.

Change-Id: Id8b7bf03218dd0ea70ada34912afd092e239b89f
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
msm: mdss: Dynamic FPS using VFP

Using Fixed fps and v_total for BW calculations, it
results in underrun if dynamic fps and v_total is used.
Dynamic FPS change should be Mutex protected for
synchronization between read/write so that multiple
processes don’t change fps at the same time. Line
count should be checked to make sure we have sufficient
lines before we start programming FPS. Do not configure
new fps when vsync timeout happens. Add support for
FIFO empty recovery.

CRs-Fixed: 651333

Change-Id: Icff48a7f85755484a321f0de26d4816f895c367e
Signed-off-by: Justin Philip <jphili@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_dsi_host.c
	drivers/video/msm/mdss/mdss_mdp_ctl.c
	drivers/video/msm/mdss/mdss_mdp_intf_video.c