drm/exynos: Fix interlaced modes

A previous patch removed a call to drm_mode_set_crtcinfo in the hdmi
driver with flag zero, this was overwriting drm subsystem's default of
halving vertical timings when interlaced. To accommodate the doubled
vertical values, the hdmi driver was dividing vertical values manually.
This patch removes that division and instead uses the values directly.

BUG=chromium:253382
TEST=Tested on snow with both interlaced and progressive modes

Change-Id: Icf8ab3cf223a2dc402f9e5516ce9eabee3206fdd
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63743
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
CHROMIUM: drm/anx7808: Configure HDMI based on sink.

Instead of configuring HDMI/DVI bit based on the dongle type, configure based
on output type.

BUG=chrome-os-partner:21436
TEST=Connect to DELL 3008FPW through HDMI-DVI adapter and see that external monitor shows video.

Change-Id: I225ecc93c651430eba2e6082915097b9cd5dbbe2
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63942
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
CHROMIUM: drm/anx7808: Handle suspend/resume.

Adds standard power management operations to handle suspend and resume.  This
handles the case of plugging a dongle during suspend state.

BUG=chrome-os-partner:19883
TEST=On spring, run powerd_suspend; plug in HDMI dongle connected to external
monitor; Push power button.  See that external display comes up.

Change-Id: I8269eaf079be71b88050bd932f0d70c1a2f90f9d
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63943
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
ANDROID: trace: Add an option to show tgids in trace output

The tgids are tracked along side the saved_cmdlines tracking, and can be
included in trace output by enabling the 'print-tgid' trace option. This is
useful when doing post-processing of the trace data, as it allows events to be
grouped by tgid.

Signed-off-by: Jamie Gennis <jgennis@google.com>
(cherry picked from commit 152e04a6f7f3f197a20df4af02bc1014f62fad80)

Source: https://android.googlesource.com/kernel/common/+/android-3.4
Ignoring style errors and warnings from checkpatch.pl.

BUG=chromium:261485
TEST=Enable ftrace and enable print-tgid trace option and see that tgid being
logged in ftrace output.

Change-Id: I7be230aafd4c1477e0e9025a60f73706a243e63c
Signed-off-by: Ricky Liang <jcliang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62446
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
ARM: MALI: fix race in calculating GPU utilisation

Since kbasep_pm_record_gpu_{active,idle}() get the current
time before grabbing the PM metrics spinlock, they race with
kbase_pm_get_dvfs_utilisation() which may time_period_start
between that time.  Once kbasep_pm_record_gpu_{active,idle}()
acquire the spinlock, they will be using a timestamp which
is now before time_period_start, causing the idle and/or busy
counters to overflow.

BUG=chrome-os-partner:21219,chromium:267776
TEST=Boot Pit; haven't been able to reproduce utilisation
overflow BUG.

Change-Id: I096aba45f37a0a7a40d1c5c4796da152eb9b56f2
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63938
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64655
s5p-mfc: support MIN_BUFFERS query for encoder

Add V4L2_CID_MIN_BUFFERS_FOR_OUTPUT query for encoder.
Once mfc encoder state is HEAD_PARSED, which is sequence
header produced, dpb_count is avaialable. Let user space
query this value.

BUG=chrome-os-partner:18019
TEST=build, run mfc encoder on CrOS snow

Change-Id: I4724d06300663c957d9da85411b0ea3ce5caeea4
Signed-off-by: avnd kiran <avnd.kiran@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/64198
Tested-by: kiran <kiran@chromium.org>
Reviewed-by: John Sheu <sheu@chromium.org>
Commit-Queue: kiran <kiran@chromium.org>
CHROMIUM: zram: fix 32-bit overflow

The 64-bit division operator is not available in 32-bit kernels,
so have to use do_div.

BUG=chromium:245703
TEST=compiled

Change-Id: I44ab763ea9e115cef6212f6524518cf7d9eac8c7
Signed-off-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64695
Reviewed-by: Doug Anderson <dianders@chromium.org>
CHROMIUM: exynos: Don't enable WiFi "regulators" more than once

The WiFi enable/reset "regulators" were "enabled" each time we turned
on the LCD and never disabled.  This just kept incrementing the
refcount over and over again and prevented the
mwifiex_sdio_mwi87xx_reset() from working.

Change the code to only enable the regulators once.

BUG=chrome-os-partner:20221
TEST=Run this before and after suspend/resume and see 1 each time:
 cd /sys/class/regulator
 cd $(grep wifi-en */name | cut -d/ -f1)
 grep "" num_users
TEST=WiFi works across suspend/resume

Change-Id: I23f43632fea02bf5dd7186d1f1badf689675bfdf
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64844
Reviewed-by: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Ashok Nagarajan <asnagarajan@chromium.org>
Tested-by: Ashok Nagarajan <asnagarajan@chromium.org>
s5p-mfc: support dynamic encoding parameter changes

Add support for dynamic encoding parameter changes in MFCv6.  Parameters
set are applied with the next OUTPUT buffer queued to the device with
VIDIOC_QBUF.

Supported parameters are:

* GOP size (V4L2_CID_MPEG_VIDEO_GOP_SIZE)
* framerate (from VIDIOC_S_PARM)
* VBR target bitrate (V4L2_CID_MPEG_VIDEO_BITRATE)
* (h264) frame type (V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE)

Signed-off-by: John Sheu <sheu@google.com>

BUG=chromium:221441
BUG=chrome-os-partner:18019
TEST=local build, run on CrOS snow

Change-Id: I41d7c5f33a2d0800434051605bf63bf247e38da2
Reviewed-on: https://gerrit.chromium.org/gerrit/64822
Reviewed-by: Pawel Osciak <posciak@chromium.org>
Commit-Queue: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
BACKPORT: ALSA: usb - Don't create "Speaker" mixer controls on headphones and headsets

A lot of headsets/headphones have a "Speaker" mixer control. This confuses
PulseAudio to think it is a speaker instead of a headphone/headset.
Therfore, we rename it to "Headphone".

We determine if something is a headphone similar to how udev determines
form factor (see 78-sound-card.rules).

BugLink: https://bugs.launchpad.net/bugs/1082357
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 9b4ef97757953c6071563b7cbfc689e3dd771603)

BUG=chromium:263529
TEST=run alsamixer to check mixer name
Change-Id: I08ddeaedad35e3d0e860fa2c7a0ceb4f87c77b51
Signed-off-by: Chih-Chung Chang <chihchung@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64885
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
CHROMIUM: s5p-mfc: don't leak private buffers and cause havoc on deallocating them

Releasing buffers via REQBUFS(0) results in the driver allocating over
existing buffers and leaking memory, so check if we already have something
allocated and free it before proceeding with allocation.

Also don't overwrite sizes of already allocated buffers, so that we don't
randomly explode if we fail allocating fresh ones and then try to free
the old ones with sizes of buffers that failed to allocate.

Signed-off-by: Pawel Osciak <posciak@chromium.org>

BUG=chromium:269460
TEST=boot, video playback

Change-Id: I24919a65e9d5dfb1e096a87fe208ac94180bcc63
Reviewed-on: https://gerrit.chromium.org/gerrit/64946
Tested-by: Pawel Osciak <posciak@chromium.org>
Reviewed-by: kiran <kiran@chromium.org>
Reviewed-by: John Sheu <sheu@chromium.org>
Commit-Queue: Pawel Osciak <posciak@chromium.org>
UPSTREAM: gdm72xx: replace obsolete NLMSG_* with type safe nlmsg_*

Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b96dc464994cb6d839c3b307b20061b440dc3edb)
Signed-off-by: Ben Chan <benchan@chromium.org>

BUG=chrome-os-partner:21768
TEST=Run network_WiMaxSmoke on daisy and lumpy with WiMAX module.

Change-Id: Ic8bb9f005f27ed2cbbe2cfef2bd7a3579dbe1a82
Reviewed-on: https://gerrit.chromium.org/gerrit/65127
Commit-Queue: Ben Chan <benchan@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
UPSTREAM: gdm72xx: remove unnecessary cast in gdm_wimax.c

This patch removes an unnecessary cast on the return value
of alloc_netdev(), since alloc_netdev() returns a pointer
to the allocated struct net_device anyway.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 9ef4090385a0c35192229ca77c9de273824040b4)
Signed-off-by: Ben Chan <benchan@chromium.org>

BUG=chrome-os-partner:21768
TEST=Run network_WiMaxSmoke on daisy and lumpy with WiMAX module.

Change-Id: I5c90d0c2f8447cfef802340bb53893499b8a27d4
Reviewed-on: https://gerrit.chromium.org/gerrit/65128
Commit-Queue: Ben Chan <benchan@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
UPSTREAM: staging: gdm72xx: WIMAX_GDM72XX should depend on either USB or MMC

The gdm72xx driver needs to have either the USB or SDIO implementation
enabled to provide useful functionalities, so the driver should depend
on either USB or MMC. This patch makes WIMAX_GDM72XX depend on either
USB or MMC.

Also, WIMAX_GDM72XX needs to be built as a module if its dependent
interface, either USB or MMC, is built as a module. This patch enforces
that in the WIMAX_GDM72XX_USB and WIMAX_GDM72XX_SDIO dependency.

Reported-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Ben Chan <benchan@chromium.org>
Cc: Sage Ahn <syahn@gctsemi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 82ba972572f4f4e768cae8fed51399747dd5605c)
Signed-off-by: Ben Chan <benchan@chromium.org>

BUG=chrome-os-partner:21768
TEST=Run network_WiMaxSmoke on daisy and lumpy with WiMAX module.

Change-Id: I995675e62f55372023fd020d509b6b8882e7aedf
Reviewed-on: https://gerrit.chromium.org/gerrit/65129
Commit-Queue: Ben Chan <benchan@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
UPSTREAM: staging: gdm72xx: potential use after free in send_qos_list()

Sometimes free_qos_entry() sometimes frees its argument.  I have moved
the dereference of "entry" ahead on line to avoid a use after free.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f2a6fed1ceaecf6054627f0ddbd4becf43c997fc)
Signed-off-by: Ben Chan <benchan@chromium.org>

BUG=chrome-os-partner:21768
TEST=Run network_WiMaxSmoke on daisy and lumpy with WiMAX module.

Change-Id: I643275ad5b613993238561e8fd8fa6cd214144c4
Reviewed-on: https://gerrit.chromium.org/gerrit/65130
Commit-Queue: Ben Chan <benchan@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
CHROMIUM: s5p-mfc: do not clear_work_bit() during resolution change.

BUG=chromium:177422
TEST=switchtest raw files and MSE test players

Change-Id: Idbb8a3c90a42423f7fcd51002c8ba03c988d0cb6
Signed-off-by: avnd kiran <avnd.kiran@samsung.com>
[posciak@chromium.org: removed display status control from the original
patch]
Signed-off-by: Pawel Osciak <posciak@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64754
Reviewed-by: John Sheu <sheu@chromium.org>
CHROMIUM: v4l: Add resolution change event.

This event indicates that the decoder has reached a point in the stream,
at which the resolution changes. The userspace is expected to provide a new
set of CAPTURE buffers for the new format before decoding can continue.

BUG=chromium:177422
TEST=none

Change-Id: Ic63dfc6b0c2936b1b0a7fbb03fc85b14f7a4d73c
Signed-off-by: Pawel Osciak <posciak@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65271
Reviewed-by: John Sheu <sheu@chromium.org>
CHROMIUM: s5p-mfc: add support for resolution change event

When a resolution change point is reached, queue an event to signal the
userspace that a new set of buffers is required before decoding can
continue.

BUG=chromium:177422
TEST=switchtest raw files and MSE test players

Change-Id: Ia21adad3585a63d0b452fbb2debe666d35ccb158
Signed-off-by: Pawel Osciak <posciak@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65272
Reviewed-by: John Sheu <sheu@chromium.org>
CHROMIUM: BACKPORT: lib/lzo: Update LZO compression to current upstream version

This commit updates the kernel LZO code to the current upsteam version
which features a significant speed improvement - benchmarking the Calgary
and Silesia test corpora typically shows a doubled performance in
both compression and decompression on modern i386/x86_64/powerpc machines.

Signed-off-by: Markus F.X.J. Oberhumer <markus@oberhumer.com>
(cherry picked from commit 8b975bd3f9089f8ee5d7bbfd798537b992bbc7e7)
Signed-off-by: Stephen Barber <smbarber@chromium.org>

BUG=chromium:269723
TEST=Boot and verify that read/write performance has improved by dd'ing
to /dev/zram0. Verify that checksum of decompressed data matches
original data.

Backported from Linux 3.9.

Change-Id: Iea48a73a45c38d4d78d140ed5efc3fcf60d07ca1
Reviewed-on: https://gerrit.chromium.org/gerrit/64995
Reviewed-by: Olof Johansson <olofj@chromium.org>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>
CHROMIUM: BACKPORT: lib/lzo: huge LZO decompression speedup on ARM by using unaligned access

Signed-off-by: Markus F.X.J. Oberhumer <markus@oberhumer.com>
(cherry picked from commit 42b775abafafdf811ef300e869a4e1480ef1cf95)
Signed-off-by: Stephen Barber <smbarber@chromium.org>

BUG=chromium:269723
TEST=Boot and verify that read/write performance has improved by dd'ing
to /dev/zram0. Verify that checksum of decompressed data matches
original data.

Backported from linux-next (next-20130806).

Change-Id: I382e112b35fbb62439b53c23534c753b14ceb1ff
Reviewed-on: https://gerrit.chromium.org/gerrit/64996
Reviewed-by: Olof Johansson <olofj@chromium.org>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>