CHROMIUM: Input: elan_i2c - advanced feature support

This is the combination of three patches that fixed and enabled
the advanced features of the elan_i2c driver.

CHROMIUM: Input: elan_i2c - Add sysfs and IAP functions

Signed-off-by: Duson Lin <dusonlin@emc.com.tw>

BUG=chromium:343376,chromium:352814
TEST=on chromebook with Elan touchpad, boot and touchpad works.

Original-Change-Id: I67bb59fac9dfb7e5adbcdd8b135b4aad3595e7a6
Originally-reviewed-on: https://chromium-review.googlesource.com/180914
Originally-reviewed-by: Benson Leung <bleung@chromium.org>
Originally-tested-by: Benson Leung <bleung@chromium.org>
Commit-Queue: Bernie Thompson <bhthompson@chromium.org>
(cherry picked from commit 52f31ab8c47264d40bd23dbe8084a39ff1476a47)
[bleung : pick elan support patches to 3.8]
Originally-signed-off-by: Benson Leung <bleung@chromium.org>

CHROMIUM: Input: elan_i2c - Fix the bug about null pointer dereference in elan_isr on boot.

Signed-off-by: Duson Lin <dusonlin@emc.com.tw>

BUG=chrome-os-partner:26130,chromium:352814
TEST=on chromebook with Elan touchpad, boot and touchpad works.

Original-Change-Id: I099a3cd9e96941282d50efef330e04e013244a99
Originally-reviewed-on: https://chromium-review.googlesource.com/187760
Originally-reviewed-by: Benson Leung <bleung@chromium.org>
Originally-Commit-Queue: Benson Leung <bleung@chromium.org>
Originally-tested-by: Benson Leung <bleung@chromium.org>
(cherry picked from commit 729d51dd7df0abc3ed62400cd3055a4369c24777)
[bleung : pick elan support patches to 3.8]
Originally-signed-off-by: Benson Leung <bleung@chromium.org>

CHROMIUM: Input: elan_i2c - Enable/disable TP during suspend based on wakeup.

BUG=chrome-os-partner:25730,chromium:352814
TEST=on chromebook with Elan touchpad, boot and touchpad works.

Original-Change-Id: I22bc9ba762e4a1d71c703d0d8ff1627fcd0b2bfd
Originally-reviewed-on: https://chromium-review.googlesource.com/186870
Originally-reviewed-by: Benson Leung <bleung@chromium.org>
Originally-tested-by: Benson Leung <bleung@chromium.org>
Commit-Queue: Benson Leung <bleung@chromium.org>
(cherry picked from commit 49e40e8cc5c1146782e34c28b630472094878d1d)
[bleung : pick elan support patches to 3.8]
Originally-signed-off-by: Benson Leung <bleung@chromium.org>

Change-Id: I2d71e4537d90b8226912aaaa873233d1fa2374a6
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/197034
Reviewed-by: Yufeng Shen <miletus@chromium.org>
Updating elan_i2c touchpad driver to version 1.5.2

CHROMIUM: Input: elan_i2c - Add retry mechanism.

When send initialize, disable, enable and sleep commands,
driver add retry machenism (3 times) to avoid host I2C occured
execption error (maybe tx timeout or no clock/data signal)
let TP no function.

Signed-off-by: Duson Lin <dusonlin@emc.com.tw>
BUG=chrome-os-partner:26110, chrome-os-partner:26800
TEST=on chromebook with Elan touchpad, boot and touchpad works.

Original-Change-Id: I6d0285f3cdb716124980fa4df1c71f3c99c1df22
Originally-reviewed-on: https://chromium-review.googlesource.com/190460
Originally-reviewed-by: Benson Leung <bleung@chromium.org>
Originally-tested-by: Benson Leung <bleung@chromium.org>
Originally-reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Original-Commit-Queue: Bernie Thompson <bhthompson@chromium.org>

CHROMIUM: Input: elan_i2c - Add structure point checking

We add checking structure point is null or not before calling
input sub-system in elan_isr() to avoid excepted kernl panic.

Signed-off-by: Duson Lin <dusonlin@emc.com.tw>
BUG=chrome-os-partner:27191
TEST=on chromebook with Elan touchpad, boot and touchpad works.

Original-Change-Id: I987151e41b985ee2b93b6468f40a73bf822143f9
Originally-reviewed-on: https://chromium-review.googlesource.com/191666
Originally-reviewed-by: Benson Leung <bleung@chromium.org>
Originally-tested-by: Benson Leung <bleung@chromium.org>
Originally-reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Original-Commit-Queue: Bernie Thompson <bhthompson@chromium.org>

Change-Id: I57cb4a2a56e7cf53fe83922c354b75c7dbe72397
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/197820
CHROMIUM: iwl7000: do not sched scan while associated

Currently the FW doesn't support sched scan while associated,
so prevent it.

BUG=chrome-os-partner:28055
TEST=run various scenarios that previously resulted in sysassert
due to scheduled scan

Change-Id: I9d223316164fceb8cc1cae9e1e014599f7ab4c9b
Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/196978
Reviewed-by: Paul Stewart <pstew@chromium.org>
(cherry picked from commit 020e7858de3417acb9497ca69275c098786c6854)
Reviewed-on: https://chromium-review.googlesource.com/198596
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
drm/exynos/fimd: only finish pageflip if START == START_S

A framebuffer gets committed to FIMD's default window like this:
 exynos_drm_crtc_update()
  exynos_plane_commit()
   exynos_drm_crtc_plane_commit()
    fimd_win_commit()

fimd_win_commit() programs BUF_START[0].  At each vblank, FIMD hardware
copies the value from BUF_START to BUF_START_S (BUF_START's shadow
register), starts scanning out from BUF_START_S, and asserts its irq.

This irq is handled by fimd_irq_handler(), which calls
exynos_drm_crtc_finish_pageflip() to free the old buffer that FIMD just
finished scanning out, and potentially commit the next pending flip.

There is a race, however, if fimd_win_commit() programs BUF_START(0)
between the actual vblank irq, and its corresponding fimd_irq_handler().

 => FIMD vblank: BUF_START_S[0] := BUF_START[0], and irq asserted
 | => fimd_win_commit(0) writes new BUF_START[0]
 |    exynos_drm_crtc_try_do_flip() marks exynos_fb as prepared
 => fimd_irq_handler()
    exynos_drm_crtc_finish_pageflip() sees prepared exynos_fb,
         and unmaps "old" fb
 ==> but, since BUF_START_S[0] still points to that "old" fb...
 ==> FIMD iommu fault

This patch ensures that fimd_irq_handler() only calls
exynos_drm_crtc_finish_pageflip() if any previously scheduled flip
has really completed.

This works because exynos_drm_crtc's flip fifo ensures that
fimd_win_commit() is never called more than once per
exynos_drm_crtc_finish_pageflip().

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>

BUG=chromium:336839
TEST=i=0; while true; do i=$((i+1)); echo "$(date) iteration ${i}"; \
      restart ui; sleep 5; done
   => No kcrash due to fimd iommu fault

Change-Id: I92de4a476e0634609bb86ea1ced99c329084cf88
Previous-Reviewed-on: https://chromium-review.googlesource.com/197205
(cherry picked from commit 3f0baafb79b6250356c24be68fdab79053598f40)
Reviewed-on: https://chromium-review.googlesource.com/197945
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
Commit-Queue: Daniel Kurtz <djkurtz@chromium.org>
Configure Elan touchpad i2c address for Wolf

The upcoming Elan Wolf devices need to know to look for Elan touchpads
on the i2c bus so that they will be functional.

BUG=chrome-os-partner:28429
TEST=built a test image with it and the touchpad was functional

Original-Change-Id: I2798d29e7984ee7fccd15be465b9c705fbdb340e
Originally-signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Originally-reviewed-on: https://chromium-review.googlesource.com/198283
Originally-reviewed-by: Benson Leung <bleung@chromium.org>

Change-Id: I655da6af71fd625d3095cdd1bfb8e9080cc46e09
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/198639
Revert "drm/exynos/fimd: only finish pageflip if START == START_S"

This reverts commit 9af502a1590cfd16cb0c3935eee486269f4e1f50.

BUG=chromium:371037
TEST=On daisy,peach_pi,peach_pit
  run webgl aquarium for 1 hour
  => no ui hangs

Change-Id: I6223e446354c0485a45d938b2e457e9159e52d4c
Reviewed-on: https://chromium-review.googlesource.com/198773
Reviewed-by: Dharani Govindan <dharani@chromium.org>
Tested-by: Dharani Govindan <dharani@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Commit-Queue: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
CHROMIUM: iwl7000: fix uapsd_disable module parameter

Later versions of the driver have uAPSD enabled unconditionally,
so the backported patch introduced an error. Fix this.

BUG=chrome-os-partner:27440
TEST=run throughput test again affected AP with and without uAPSD

Change-Id: I00dcfe148f565285be80ffa65769ff3e0bd617f3
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/198332
Reviewed-by: Matt Chen <matt.chen@intel.com>
Tested-by: Matt Chen <matt.chen@intel.com>
Reviewed-by: Paul Stewart <pstew@chromium.org>
(cherry picked from commit b634b7fd372e578283e6c209f190fd039ba7781b)
Reviewed-on: https://chromium-review.googlesource.com/199044
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
CHROMIUM: iwl7000: add uapsd_disable module parameter

Some APs (e.g. TP-LINK TL-WA801N) are disabling aggregation (downlink
to station) when U-APSD is enabled, resulting in low throughput.
Add a module parameter to allow disabling U-APSD support in the driver.

BUG=chrome-os-partner:27440
TEST=run throughput test again affected AP with and without uAPSD

Change-Id: I35591b33a0b44de9724ee9e091228443344b7785
Signed-off-by: Matt Chen <matt.chen@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/197016
Reviewed-by: Paul Stewart <pstew@chromium.org>
(cherry picked from commit 6c6016e2c6b38832eced031e12fd8c6e3beae379)
Reviewed-on: https://chromium-review.googlesource.com/199028
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>