CHROMIUM: PM: Adjust messaging for wake events during suspend

This adds in a new message to the suspend code which adds an indication to
the log that suspend was cancelled due to a wake event occouring during
the suspend sequence. It also adjusts the message printed in suspend.c to
reflect the potential that a suspend was aborted, as opposed to a device
failing to suspend.

Without these message adjustments one can end up with a kernel log that says
that a device failed to suspend with no actual device suspend failures,
which can be confusing to the log examiner.

BUG=chrome-os-partner:19817
TEST=Manual, run suspend resume stress tests and watch for the new messages.

Change-Id: I1a087338a81331b0494d5000d4c85569a0882b7d
Signed-off-by: Bernie Thompson <bhthompson@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57060
Reviewed-by: Todd Broch <tbroch@chromium.org>
s5p-mfc: Add support for EOS command and EOS event in video decoder

<UPSTREAM MERGE NOT REQUIRED>

Add support for V4L2_DEC_CMD_STOP command which will instruct MFC device
to finish decoding and release all remaining frames kept for reference to
the user. After dequeueing last decoded frame the driver will generate an
V4L2_EVENT_EOS event.

Change-Id: I274b7c59637a9f15cf3276b30e8b268710f81b9b
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Kyngmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/57165
Commit-Queue: John Sheu <sheu@chromium.org>
Reviewed-by: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
s5p-mfc: Remove potential uninitialized variable usage

<UPSTREAM MERGE NOT REQUIRED>

Make sure mem_info[] array is not used uninitialized. This prevents
following compiler warning:
drivers/media/platform/s5p-mfc/s5p_mfc.c: In function s5p_mfc_probe:
drivers/media/platform/s5p-mfc/s5p_mfc.c:1032:33: warning: mem_info[0] may be used uninitialized in this function [-Wuninitialized]
drivers/media/platform/s5p-mfc/s5p_mfc.c:1021:15: note: mem_info[0] was declared here
drivers/media/platform/s5p-mfc/s5p_mfc.c:1032:33: warning: mem_info[1] may be used uninitialized in this function [-Wuninitialized]
drivers/media/platform/s5p-mfc/s5p_mfc.c:1021:15: note: mem_info[1] was declared here

Change-Id: I6e15c946b5818a42405705c7378a5dcb2da1c97b
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/57166
Commit-Queue: John Sheu <sheu@chromium.org>
Reviewed-by: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
CHROMIUM: spring: dts: Do not suspend TPM.

On spring the TPM is powered during suspend so there's no reason to
suspend (and resume) the device.  Change should speedup suspend &
resume.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BUG=chrome-os-partner:18843
TEST=manual, suspend resume device then test tpm

  stop tcsd
  tpmc getvf
  tpmc getpf

Change-Id: I694c215d76711efbb2ab923c31da6322e7b2ea17
Reviewed-on: https://gerrit.chromium.org/gerrit/57839
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
s5p-mfc: Optimize copy time stamp handling

<UPSTREAM MERGE NOT REQUIRED>

For the sake of simplicity and readability memcpy was replaced with
assignment.

Change-Id: If7fb6a3682193feb77683d5626c306bf403fa84b
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/57167
Commit-Queue: John Sheu <sheu@chromium.org>
Reviewed-by: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
s5p-mfc: Remove special clock usage in driver

<UPSTREAM MERGE NOT REQUIRED>

MFC uses two clocks - MFC gate clock and special clock
which is named as "sclk_mfc" in exynos4 and "aclk_333" in
exynos5 SoC. The driver was doing just a clk_prepare on
this special clock without a clk_enable call. As this
sclk is the parent of gate clock, it gets prepared and
enabled along with the gate clock. So there is no need
for the driver to use this sclk. This patch removes the
sclk usage from driver.

Change-Id: Id28615ce702edeaa79533fe8ea72ed964a4aad44
Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/57169
Commit-Queue: John Sheu <sheu@chromium.org>
Reviewed-by: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
CHROMIUM: hid-logitech-wtp: fixed finger status

Fingers status was not parsed correctly which caused fingers to not be
reported in some cases.

BUG=chromium:240850
TEST=manual test

Change-Id: Ia08277a85161403b29e036f356ca344188564200
Signed-off-by: Dennis Kempin <denniskempin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57661
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
CHROMIUM: hid.h: Added HID_DJ_DEVICE macro

This macro allows devices on the DJ bus to be defined the same way as
devices on the bluetooth and usb bus.
Most importantly it has the same API for Kernel 3.8 and 3.4, which is
not the case for the HID_DEVICE macro.

BUG=chromium:240850
TEST=no functional change.

Change-Id: I89e197a5c7f0129f1f5b55182cbba6af5c326e91
Signed-off-by: Dennis Kempin <denniskempin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57662
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
CHROMIUM: hid-logitech-wtp: Support Touch Mice T400/T620

Add support for touch mice and implement the TouchMouseRawTouchPoints
feature to support the models T400 and T620.

BUG=chromium:240850
TEST=manual testing with both devices

Change-Id: Ifa1a3d9e682209980387ba3510304791cf955224
Signed-off-by: Dennis Kempin <denniskempin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57663
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
CHROMIUM: hid-logitech-wtp: fixed mouse support

The BluetoothTouchMouse Feature was not supported by the driver which
breaks some devices.

BUG=chromium:240850
TEST=manual test with various devices

Change-Id: I69a66032a3c745bdbafcb6d666c9906d648d45fa
Signed-off-by: Dennis Kempin <denniskempin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57664
CHROMIUM: hid-logitech-wtp: Fixed button issue on WTP

The buttons on WTP do not work when a finger is present on the touchpad.
This is caused by the raw event overriding the button state. WTP does
not send button states in the raw events. This CL adds a new event
format to distinguish between those two cases.

BUG=chromium:240850
TEST=manual test on WTP device

Change-Id: I97f43967a19fa0e902439c495f786a559ea3a11a
Signed-off-by: Dennis Kempin <denniskempin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57665
s5p-mfc: separate encoder parameters for h264 and mpeg4

<UPSTREAM MERGE NOT REQUIRED>

This patch fixes a bug which caused overwriting h264 codec
parameters by mpeg4 parameters during V4L2 control setting.

Change-Id: Ic086f8cf5446860d4225eb8c8c3098ef649bd067
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/57170
Commit-Queue: John Sheu <sheu@chromium.org>
Reviewed-by: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
s5p-mfc: v4l2 controls setup routine moved to initialization code

<UPSTREAM MERGE NOT REQUIRED>

Callback .start_streaming is called once for every queue,
so v4l2_ctrl_handler_setup was called twice during stream start.
Moving v4l2_ctrl_handler_setup to context initialization
reduces numbers of calls and seems to be more consistent with API.

Change-Id: I1f4d1b986b737d91b6a6036cbe991cc3d6c5b285
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/57171
Commit-Queue: John Sheu <sheu@chromium.org>
Reviewed-by: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
s5p-mfc: added missing end-of-lines in debug messages

<UPSTREAM MERGE NOT REQUIRED>

Many debug messages missed end-of-line.

Change-Id: I93b13b6d346314394725d795573fbeefa46b4f44
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/57172
Commit-Queue: John Sheu <sheu@chromium.org>
Reviewed-by: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
exynos-gsc: fix system crash when gscalar probe fails

Make sure to unregister the device if gscalar failed to initialize.

Without this change, if gscalar probe fails after
gsc_register_m2m_device(), system would tend
to crash at bootup right after GScaler failed to initialize.

BUG=chrome-os-partner:19643
TEST=Fake probe failure after gsc_register_m2m_device().
Before: crash observed while booting after hitting the fake failure
After: No crash observed while booting

Change-Id: I534b6b5622dacf7e51b38f33b97168d7772275a3
Signed-off-by: avnd kiran <avnd.kiran@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/57738
Tested-by: kiran <kiran@chromium.org>
Reviewed-by: Pawel Osciak <posciak@chromium.org>
Commit-Queue: kiran <kiran@chromium.org>
CHROMIUM: drm/i915: tune the RC6 timeout for stability

It's basically the same deal as the RC6+ issues on ivy bridge
(https://gerrit.chromium.org/gerrit/#/c/42655/) except this
time with RC6 on sandy bridge. Like last time the core of the
issue is that the existing timings don't work 100% with our
voltage regulator, so once in a couple suspend/resumes the
kernel will print a warning message about the GPU not getting
out of RC6.

Luckily this time the shared timings are already working (from
the ivy bridge work) so we only need to adjust the one
RC6-specific timing, GEN6_RC6_THRESHOLD.

Just like with the RC6+ change, I couldn't see any measurable
power difference with an idle lumpy.

BUG=chromium:235116
TEST=ran the power_Resume a bunch on stumpy, didn't see an RC6 error
TEST=tested lumpy for power regressions on idle

Change-Id: If69b96126c7d7047195899bdaf540316c0875a6b
Reviewed-on: https://gerrit.chromium.org/gerrit/57869
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
s5p-mfc: Add NULL check for allocated buffer

<UPSTREAM MERGE NOT REQUIRED>

In certain cases, dma_alloc_coherent returns NULL. Add check for
NULL pointer.

Change-Id: I45648a01d99c0e1cbc3f589b976c11c35223866f
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/57173
Commit-Queue: John Sheu <sheu@chromium.org>
Reviewed-by: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
s5p-mfc: fix encoder crash after VIDIOC_STREAMOFF

VIDIOC_STREAMOFF clears the encoder's destination queue -- routines run
from the interrupt handler cannot assume that the queue is non-empty.

BUG=chrome-os-partner:18019
TEST=build, run on CrOS snow with v4l2_enc_dec

Change-Id: Iac09417ab1a8f7f0ad2ad32ebabdae09306af393
Signed-off-by: John Sheu <sheu@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/56506
Commit-Queue: John Sheu <sheu@chromium.org>
Reviewed-by: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
CHROMIUM: spring: dts: enable camera FET

Starting DVT2, the camera 3.3V rail is connected behind the TPS65090
FET5.
For now, we always turn it on.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BUG=chrome-os-partner:20027
TEST=on Spring, boot the machine and check that FET5 is ON by typing
"pmu" in the EC console and reading 0x1f in register 0x13.

Change-Id: I1366cf966366147c274193d4fff6fb3695564d24
Reviewed-on: https://gerrit.chromium.org/gerrit/57973
Reviewed-by: Todd Broch <tbroch@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
s5p-mfc: encoder VIDIOC_STREAMON wait on HW init

The encoder initialization sequence for s5p-mfc relies on an
initialization job sent to the HW to determine the number of DPB buffers
required for encoding.  Make VIDIOC_STREAMON for the CAPTURE queue wait
until this job is complete, or the subsequent setup of the OUTPUT queue
may race with the HW job and not receive the required DPB count in time.

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

Change-Id: Ia99115ddf992233df4335b11c567b03fe38da8e1
Signed-off-by: John Sheu <sheu@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/56507
Reviewed-by: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
Commit-Queue: John Sheu <sheu@chromium.org>