cascardo/linux.git
11 years agoCHROMIUM: md: dm-verity: Fix to avoid a deadlock in dm-bufio
Paul Taysom [Thu, 31 Jan 2013 21:44:23 +0000 (13:44 -0800)]
CHROMIUM: md: dm-verity: Fix to avoid a deadlock in dm-bufio

Changed the dm-verity prefetching to use a worker thread to avoid
a deadlock in dm-bufio.

If generic_make_request is called recursively, it queues the I/O
request on the current->bio_list without making the I/O request
and returns. The routine making the recursive call cannot wait
for the I/O to complete.

The deadlock occurred when one thread grabbed the bufio_client
mutex and waited for an I/O to complete but the I/O was queued
on another thread's current->bio_list and it was waiting to get
the mutex held by the first thread.

The fix allows only one I/O request from dm-verity to dm-bufio
per thread. To do this, the prefetch requests were queued on worker
threads.

In addition to avoiding the deadlock, this fix made a slight
improvement in performance.

seconds_kernel_to_login:
  with prefetch:    8.43s
  without prefetch: 9.2s
  worker prefetch:  8.28s

BUG=chromium-os:39148
TEST=./run_remote_tests.sh --board=$B --remote=$IP suite:smoke
Signed-off-by: Paul Taysom <taysom@chromium.org>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@kernel.org
Change-Id: I5f3cddfed507abfb8198fee71e713495f076b772
Reviewed-on: https://gerrit.chromium.org/gerrit/42422
Tested-by: Paul Taysom <taysom@chromium.org>
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Commit-Queue: Paul Taysom <taysom@chromium.org>

11 years agoCHROMIUM: md: dm-verity fixes chromeos needs
Paul Taysom [Wed, 16 Jan 2013 22:55:05 +0000 (14:55 -0800)]
CHROMIUM: md: dm-verity fixes chromeos needs

This CL has all the changes that needed to be made to
the upstream version of dm-verity.
1. Notify
2. Same paramaters as the old version of dm-verity
3. Opening device by uuid

See CL 41206

At Mandeep's suggestion, I've modified the upstream version of
verity to accept the legacy parameters. This means we can move
to the upstream version of verity without making changes to
out build, install and signing scripts.

Results from platform_BootPerfServer/control.perfalerts
on a Lucas
      baseline CL
reboot_in_syslog 23 111
seconds_firmware_boot 30.86 30.75
seconds_kernel_to_chrome_exec 4.64 4.82
seconds_kernel_to_chrome_main 5.55 6.11
seconds_kernel_to_login 8.32 8.14
seconds_kernel_to_network 8.73 8.17
seconds_kernel_to_startup 1.63 1.72
seconds_kernel_to_startup_done 2.4 2.37
seconds_kernel_to_x_started 4.55 4.73
seconds_power_on_to_kernel 30.86 30.75
seconds_power_on_to_login 39.18 38.89 (30 sec wait for dev)

BUG=chromium-os:31803
TEST=platform_DMVerityCorruption, platform_DMVerityBitCorruption

Change-Id: Iaedc50bc679c931d77044589de1a305fcb5b0180
Signed-off-by: Paul Taysom <taysom@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41468

11 years agoCHROMIUM: md: dm-verity convert to upstream version
Paul Taysom [Mon, 14 Jan 2013 16:36:18 +0000 (08:36 -0800)]
CHROMIUM: md: dm-verity convert to upstream version

This CL only has the upstream version of dm-verity.c.
It was take from the 3.4.22 version of linux.
I've also removed dm-verity.h and dm-bht.c which are not
part of the upstream version of verity.
Removed the old documenation and added the new documents.
The next CL will have have the changes to make it work.

BUG=chromium-os:31803
TEST=platform_DMVerityCorruption, platform_DMVerityBitCorruption

Change-Id: Ic7050bc2609ef322080f76286a1f41417dc7def8
Signed-off-by: Paul Taysom <taysom@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41206

11 years agoCHROMIUM: input: cyapa - handling rt_suspend for fw_update
Tai-Hsu Lin [Tue, 12 Mar 2013 07:03:31 +0000 (15:03 +0800)]
CHROMIUM: input: cyapa - handling rt_suspend for fw_update

This patch handle the case where fw update may fail if the
device is currently runtime suspended. It forces the device
to resume before issuing soft reset. The patch also increases
waiting time/retry counts for a few commands.

Signed-off-by: Tai-Hsu Lin <sheckylin@chromium.org>
CQ-DEPEND=If3bd68194309bbe225c2357609ede1a7595b5eba
BUG=chromium-os:39500
TEST=echo 1000 > ${DEVICE_PATH}/power/runtime_suspend_scanrate/ms
echo -n 1 > ${DEVICE_PATH}/update_fw

Before the fix, fw update would fail. After the fix, it should
succeed.

Change-Id: I2cb891e28c7564a5bb47924a231d25e57e70373c
Reviewed-on: https://gerrit.chromium.org/gerrit/45307
Reviewed-by: Benson Leung <bleung@chromium.org>
Commit-Queue: Tai-Hsu Lin <sheckylin@chromium.org>
Tested-by: Tai-Hsu Lin <sheckylin@chromium.org>
11 years agoCHROMIUM: input: cyapa - adding more debug message
Tai-Hsu Lin [Mon, 11 Mar 2013 10:08:15 +0000 (18:08 +0800)]
CHROMIUM: input: cyapa - adding more debug message

The patch adds debug messages when entering most functions
so that the call stack is more visible for the developer. It
also adds messages for some cases where the errors were silently
handled before.

Signed-off-by: Tai-Hsu Lin <sheckylin@chromium.org>
BUG=chromium-os:39606
TEST=boot a machine with Cypress trackpad and check the dmesg.

Change-Id: If3bd68194309bbe225c2357609ede1a7595b5eba
Reviewed-on: https://gerrit.chromium.org/gerrit/45063
Reviewed-by: Benson Leung <bleung@chromium.org>
Tested-by: Tai-Hsu Lin <sheckylin@chromium.org>
Commit-Queue: Tai-Hsu Lin <sheckylin@chromium.org>

11 years agoCHROMIUM: charger-manager: Rewrite probe function
Simon Glass [Sun, 10 Feb 2013 04:32:57 +0000 (20:32 -0800)]
CHROMIUM: charger-manager: Rewrite probe function

Split the probe function into separate functions in preparation for device
tree enablement.

Drop the extra rtc warning in the setup function and just do it once in
the probe function.

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow
See that the charger-manager still probes and appears to run correctly.

Change-Id: Ied0ddbc57c83869eb75a5b769ed2233b7742af15
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43025
Reviewed-by: Benson Leung <bleung@chromium.org>
11 years agoCHROMIUM: drm/i915: bounds check execbuffer relocations
Kees Cook [Fri, 8 Mar 2013 02:09:58 +0000 (18:09 -0800)]
CHROMIUM: drm/i915: bounds check execbuffer relocations

It is possible to wrap the counter used to allocate the buffer for
relocation copies. This could lead to heap writing overflows.

BUG=chromium-os:39733
TEST=link build, PoC fails

[sending upstream]

Change-Id: Ifdd4ae846042852a4462d70cfa3c3b84d5a9d133
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45118
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
11 years agoCHROMIUM: signal: always clear sa_restorer on execve
Kees Cook [Mon, 11 Mar 2013 20:33:13 +0000 (13:33 -0700)]
CHROMIUM: signal: always clear sa_restorer on execve

When the new signal handlers are set up, the location of sa_restorer is
not cleared, leaking a parent process's address space location to
children.  This allows for a potential bypass of the parent's ASLR by
examining the sa_restorer value returned when calling sigaction().

Based on what should be considered "secret" about addresses, it only
matters across the exec not the fork (since the VMAs haven't changed until
the exec).  But since exec sets SIG_DFL and keeps sa_restorer, this is
where it should be fixed.

Given the few uses of sa_restorer, a "set" function was not written since
this would be the only use.  Instead, we use __ARCH_HAS_SA_RESTORER, as
already done in other places.

Example of the leak before applying this patch:

$ cat /proc/$$/maps
...
7fb9f3083000-7fb9f3238000 r-xp 00000000 fd:01 404469 .../libc-2.15.so
...
$ ./leak
...
7f278bc74000-7f278be29000 r-xp 00000000 fd:01 404469 .../libc-2.15.so
...
1 0 (nil) 0x7fb9f30b94a0
4000000 (nil) 0x7f278bcaa4a0
4000000 (nil) 0x7f278bcaa4a0
4 0 (nil) 0x7fb9f30b94a0
...

BUG=chromium:177956
TEST=link build, PoC fails to show leaks

[sent upstream https://lkml.org/lkml/2013/3/11/498]
[changed #ifdef for pre-3.9 defines]
Change-Id: Icb92cc8a616f326f8df783b749ba1ffad24d98ce
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45130
Reviewed-by: Julien Tinnes <jln@chromium.org>
11 years agoCHROMIUM: power,mkbp: Update PSU status via EC's MKBP.
Todd Broch [Wed, 6 Mar 2013 17:11:37 +0000 (09:11 -0800)]
CHROMIUM: power,mkbp: Update PSU status via EC's MKBP.

EC has only one interrupt to the AP which is used to
signal keyboard input has arrived.

In order to signal change in power supply unit status (PSU) without
complicating and slowing keyboard response, we've added a virtual
keystroke, KEY_BATTERY, to signal change in PSU state.

Signed-off-by: Todd Broch <tbroch@chromium.org>
BUG=chrome-os-partner:17927
TEST=manual,

1. Plug-in AC supply, boot and login as root
2. Examine current PSU type
   cat /sys/class/power_supply/cros_ec-charger/type
   Mains
3. Unplug PSU, repeat 2. see same result
4. From EC console press 'BATTERY_KEY'
   kpbress 0 7 1
5. Re-examine PSU type
   cat /sys/class/power_supply/cros_ec-charger/type
   UNKNOWN

Repeat steps 1-5 for various PSUs

Change-Id: Ie80f7ae45f8bb47dbad893eb87e5fb6df7a3e3cd
Reviewed-on: https://gerrit.chromium.org/gerrit/45074
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
11 years agoCHROMIUM: ALSA: hda/ca0132 - Fix division by zero in ca0132_update_latency()
Chih-Chung Chang [Sat, 9 Mar 2013 13:05:33 +0000 (21:05 +0800)]
CHROMIUM: ALSA: hda/ca0132 - Fix division by zero in ca0132_update_latency()

The original code avoids the division if the runtime parameters have
not been set by checking if it is still in the SNDRV_PCM_STATE_OPEN
state. However if the system is suspended between snd_pcm_open() and
snd_pcm_hw_params(), the state is changed from SNDRV_PCM_STATE_OPEN to
SNDRV_PCM_STATE_SUSPENDED, and the check misses the case.

The new check just looks at the runtime parameters directly to see if
it is already set.

BUG=chromium-os:39661
TEST=compile kernel

Change-Id: I2ba983e00e61c330fe04a5a93f34101f01893ac3
Signed-off-by: Chih-Chung Chang <chihchung@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45022

11 years agoCHROMIUM: Input: atkbd - skip re-probing on non-KBD i8042 ports
Chung-yih Wang [Mon, 4 Mar 2013 11:10:07 +0000 (19:10 +0800)]
CHROMIUM: Input: atkbd - skip re-probing on non-KBD i8042 ports

The serio0 or "i8042 KBD port" (defined in i8042.c) is used for a system to
connect AT keyboard device in general. When a system resumes from suspend,
kernel rescans all serio ports again for matching devices with serio
driver one by one. Currently, the retry mechanism in atkbd_probe() may take
few milliseconds for each serial port. There will be four auxiliary ports if
multiplexing is enabled on the second serial port, and this will add the
latency of system resume or boot significantly. The patch tries to skip
reprobe mechanism for non-KBD ports in order to reduce the unresponsiveness
for a system with ps/2-type of touchpad resuming from suspend. By skipping
reprobes on non-KBD i8042 ports it could save 1+ seconds of latency.

BUG=chrome-os-partner:15015
TEST=on device; use powerd_suspend and then hit a key to wake it up
   see if the trackpoint/trackpoint could be active in 2+ seconds
   after resume instead of 3~4 seconds long

Change-Id: I0e62c351225b06af44b55e8600f6e37b05ae5a06
Signed-off-by: Chung-yih Wang <cywang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44518
Reviewed-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
11 years agoCHROMIUM: power: charger-manager: Use device tree node
Simon Glass [Sun, 17 Jun 2012 17:26:42 +0000 (10:26 -0700)]
CHROMIUM: power: charger-manager: Use device tree node

We should use the device tree for charger manager. As a first step, check
the node and enable the driver only if present.

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow

Change-Id: Ic57d927a8dc2a15c250fe280a8c330e3b8e896f1
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/40168

11 years agoCHROMIUM: power: dts: Add device tree binding for battery-system
Simon Glass [Sun, 17 Jun 2012 17:28:19 +0000 (10:28 -0700)]
CHROMIUM: power: dts: Add device tree binding for battery-system

This node brings together the various chargers and batteries into a single
unit called the battery system. It provides a unified view of the charge
state to user space.

This initial binding provides for the existing parameters in the driver.

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow

Change-Id: Ib5714d10dc2849779abb3f413deb5446fdfbdf81
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/40167
Reviewed-by: Benson Leung <bleung@chromium.org>
11 years agoUPSTREAM: mwifiex: add set_antenna handler support
Amitkumar Karwar [Tue, 3 Jul 2012 02:32:33 +0000 (19:32 -0700)]
UPSTREAM: mwifiex: add set_antenna handler support

This enables user to set mode of Tx/Rx path using "iw set antenna"
command. For non MIMO chips, the command will be used for selecting
specific antenna or configuring antenna diversity mode.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Paul Stewart <pstew@chromium.org>
BUG=chrome-os-partner:17995
TEST=Used "iw phy phy0 set antenna 3 3" and "iw phy phy0 set antenna 1 1"
("iw phy phy0 set antenna 2 2" does not work).

Change-Id: I34a16db8c9d14eb4f8123fbb8005a56f28f3c429
Reviewed-on: https://gerrit.chromium.org/gerrit/44729
Reviewed-by: Ajay Gummalla <agummalla@chromium.org>
Reviewed-by: Bing Zhao <bzhao@marvell.com>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
11 years agoUPSTREAM: ALSA: hda/ca0132 - Avoid division by zero in dspxfr_one_seg()
Xi Wang [Thu, 7 Mar 2013 05:13:51 +0000 (00:13 -0500)]
UPSTREAM: ALSA: hda/ca0132 - Avoid division by zero in dspxfr_one_seg()

Move the zero check `hda_frame_size_words == 0' before the modulus
`buffer_size_words % hda_frame_size_words'.

Also remove the redundant null check `buffer_addx == NULL'.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Conflicts:
sound/pci/hda/patch_ca0132.c

BUG=chromium-os:39661
TEST=play audio on link.

Change-Id: I926b440ba3a5d2a7ccbba63b60a7d5f116b93766
Reviewed-on: https://gerrit.chromium.org/gerrit/44902
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
11 years agoCHROMIUM: drm/exynos: Clean up DRM_DEBUG messages
Daniel Kurtz [Wed, 6 Mar 2013 04:29:09 +0000 (12:29 +0800)]
CHROMIUM: drm/exynos: Clean up DRM_DEBUG messages

The DRM_DEBUG messages in this driver do a pretty good job of generating
a function trace in dmesg when enabled.

This patch attempts to make this trace more useful in a few ways:
 (1) Instead of dumping file names (which can be trivially deduced from
function names using grep), prefer dumping function parameters, especially
when they are drm object handles.

 (2) Since DRM_DEBUG_* already dump function name; no need to explicitly
print it.

 (3) Use the same style for naming CRTC, CONNECTOR and ENCODER in debug
messages as is used in the drm common code.

 (4) Log when drm objects are created, add include the new objects handle.

 (5) Add debug messages to a few more non-critical path functions.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
BUG=chromium-os:36608
TEST=Enable DRM_DEBUG_KMS, reboot, and inspect drm messages in dmesg

Change-Id: I6dc2e86be6ef64ca0384c407c9e90ad3c8b0f9e1
Reviewed-on: https://gerrit.chromium.org/gerrit/38890
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
Commit-Queue: Daniel Kurtz <djkurtz@chromium.org>

11 years agoRevert "UPSTREAM: mmc: dw_mmc: correct the calculation for CLKDIV"
Daniel Kurtz [Fri, 8 Mar 2013 03:56:36 +0000 (19:56 -0800)]
Revert "UPSTREAM: mmc: dw_mmc: correct the calculation for CLKDIV"

This reverts commit abde7fecdb4aa9cdf11fc90c6bef5ddf8c193265

For some reason, with this patch my daisy kernel won't boot on my Lucas.  Reverting for now for more investigation later.

BUG=chromium-os:39730
TEST=built & tested on daisy.  Chrome OS boots w/out black screen.

Change-Id: I0b9f9bf363fcf87766299e76152d2a03ad89e469
Reviewed-on: https://gerrit.chromium.org/gerrit/44910
Commit-Queue: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
11 years agoUPSTREAM: mmc: dw_mmc: correct the calculation for CLKDIV
Seungwon Jeon [Tue, 22 May 2012 04:01:21 +0000 (13:01 +0900)]
UPSTREAM: mmc: dw_mmc: correct the calculation for CLKDIV

In case of "host->bus_hz < slot->clock", divider value is
miscalculated. And clock divider register value is multiple of 2. If
calculated divider value is odd number, result can be over-clocking.

Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
Acked-by: Will Newton <will.newton@gmail.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
BUG=chrome-os-partner:16752
TEST=Boot spring+HS200 eMMC and check dmesg for mmc.0 output.

Signed-off-by: Grant Grundler <grundler@chromium.org>
Resolved conflict with previously backported:
    Author: Abhilash Kesavan <a.kesavan@samsung.com>
    Date:   Mon Nov 19 10:26:21 2012 +0530

    mmc: dw_mmc: Add sdio power bindings

    Add dt-based retrieval of host sdio pm capabilities. Based on
    the dt based discovery do a bus init in the resume function.

Change-Id: I50a5e258c2fc0985bed327f898bd9c7cac86bd3f
Reviewed-on: https://gerrit.chromium.org/gerrit/44788
Reviewed-by: Doug Anderson <dianders@chromium.org>
Commit-Queue: Grant Grundler <grundler@chromium.org>
Reviewed-by: Grant Grundler <grundler@chromium.org>
Tested-by: Grant Grundler <grundler@chromium.org>
11 years agoCHROMIUM: power: tps65090: Add charger regulator and device tree support
Simon Glass [Sun, 17 Jun 2012 16:51:09 +0000 (09:51 -0700)]
CHROMIUM: power: tps65090: Add charger regulator and device tree support

Add a simple fdt binding to this driver. Also use a static struct to
provide the required power supply detail instead of assigning them at
run-time.

If the fdt node is not present or is disabled, we do not register the
driver. If the charger sub-node is not present, we do not register the
regulator, and operate entirely in passive mode (as the driver always
did before this change).

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow

Change-Id: I93ec83b44f53f497d1adf745ddb45e2d438402e4
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/40166
Reviewed-by: Benson Leung <bleung@chromium.org>
11 years agoCHROMIUM: Update tps65090 device tree entry for charger
Simon Glass [Sun, 3 Feb 2013 22:30:20 +0000 (14:30 -0800)]
CHROMIUM: Update tps65090 device tree entry for charger

Add a sub-node for charger. We do not specify a name for the regulator
since that would enable this function of the driver, although it would
not really have any effect. Still, we don't want this until/unless
charger-manager is enabled.

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow
With other changes, see that the charger can be enabled and disabled under
charger-manager control.

Change-Id: Ida12beedae31e848e775b7083ea2c998a35bda32
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43024

11 years agoRevert "CHROMEOS: config: Enable addrtype iptables match"
Paul Stewart [Wed, 6 Mar 2013 21:45:00 +0000 (13:45 -0800)]
Revert "CHROMEOS: config: Enable addrtype iptables match"

The addrtype rule ended up unused for multicast-reply
classification since this rule appears to interact improperly with NFQUEUE rules.  As such, since it is unused,
it should be removed.

This reverts commit 2dba2b3b1c217795cc72dc5b61057d7020e1b3f7

BUG=chromium-os:38605
TEST=Compile kernel

Change-Id: I4b05b73252a054249a4dd46f029277867798f2a5
Reviewed-on: https://gerrit.chromium.org/gerrit/44758
Reviewed-by: Grant Grundler <grundler@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
11 years agoCHROMIUM: Trigger a card reset on reaching tx_timeout threshold
Ashok Nagarajan [Thu, 21 Feb 2013 03:07:23 +0000 (19:07 -0800)]
CHROMIUM: Trigger a card reset on reaching tx_timeout threshold

tx_timeout doesn't always lead to a cmd_timeout. There are occurrences where
cmd_timeout never gets triggered for a long time and we encounter a kernel
crash. In this patch, we track the consecutive timeouts (tx_timeout_cnt). When
tx_timeout_cnt exceeds the threshold, trigger a card reset thereby avoiding a
kernel crash.

BUG=chrome-os-partner:15129
TEST=trigger tx_timeout and check if we see chip is reset after reaching
     threshold

Change-Id: Ie893630ef3da9a091b178843bdec6e0bb88eb16d
Signed-off-by: Ashok Nagarajan <asnagarajan@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43696

11 years agoCHROMIUM: dts: spring: Enable cros_ec-charger in device tree.
Todd Broch [Tue, 5 Mar 2013 21:22:42 +0000 (13:22 -0800)]
CHROMIUM: dts: spring: Enable cros_ec-charger in device tree.

Signed-off-by: Todd Broch <tbroch@chromium.org>
BUG=chrome-os-partner:17927
TEST=manual,
1. boot kernel, login as root
2. plug in various PSU's
3. check online status
   power-supply-info | grep online
   online:           yes
4. unplug PSU
   power-supply-info | grep online
   online:           no

Change-Id: Idc1d9fb52f9288ca6b0cce243be18087a51a1803
Reviewed-on: https://gerrit.chromium.org/gerrit/44683
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
11 years agoCHROMIUM: config: exynos5: Enable cros_ec-charger driver.
Todd Broch [Tue, 5 Mar 2013 21:19:02 +0000 (13:19 -0800)]
CHROMIUM: config: exynos5: Enable cros_ec-charger driver.

Signed-off-by: Todd Broch <tbroch@chromium.org>
BUG=chrome-os-partner:17927
TEST=compile kernel successfully and see object file created.
  CC      drivers/power/chromeos_ec-charger.o

Change-Id: Idbb099932810e6d46a1ba65ccd711251caa98244
Reviewed-on: https://gerrit.chromium.org/gerrit/44682
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
11 years agoCHROMIUM: power: chromeos_ec: charger driver.
Todd Broch [Fri, 1 Mar 2013 15:30:32 +0000 (07:30 -0800)]
CHROMIUM: power: chromeos_ec: charger driver.

On spring, the charger (tps65090) is abstracted via EC interface.

This CL creates a driver for the charger using EC's MKBP interface
(EC_CMD_POWER_INFO) and provides power supply property
POWER_SUPPLY_PROP_ONLINE.

Signed-off-by: Todd Broch <tbroch@chromium.org>
BUG=chrome-os-partner:17927
TEST=code compiles

Change-Id: I03c444e82771871f47dbd12a7f4f282c2e95be3d
Reviewed-on: https://gerrit.chromium.org/gerrit/44681
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
11 years agoRevert "CHROMIUM: TEMPORARY: dump stack to help debug p/17609"
Luigi Semenzato [Tue, 5 Mar 2013 21:01:21 +0000 (13:01 -0800)]
Revert "CHROMIUM: TEMPORARY: dump stack to help debug p/17609"

This reverts commit 0af3fa94028ea0279311f81c0788910da770ce30.
Bug was reproduced, stack trace was achieved, done with this.

BUG=chrome-os-partner:17609
TEST=none

Change-Id: Ic8cc3dcc39dba88c43e3f22186c7b2feaa6036fe
Signed-off-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44665
Reviewed-by: Doug Anderson <dianders@chromium.org>
11 years agoCHROMIUM: drm/bridge: control LCD and backlight FETs
Vincent Palatin [Tue, 5 Mar 2013 02:22:41 +0000 (18:22 -0800)]
CHROMIUM: drm/bridge: control LCD and backlight FETs

Ensure we are powering on and off the FETs controlling the backlight and
the LCD VDD.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:18122
TEST=on Spring, use "powerd_suspend" to suspend the machine, and check
the state of the TPS65090 FETs by using the "pmu" on the EC command
line.

Change-Id: I3a0d03fdac18b4d13de2d33de6ba2e0429dd0daf
Reviewed-on: https://gerrit.chromium.org/gerrit/44599
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
11 years agoCHROMIUM: mfd: init/link earlier
Vincent Palatin [Tue, 5 Mar 2013 01:47:35 +0000 (17:47 -0800)]
CHROMIUM: mfd: init/link earlier

Move multi function devices earlier in the link sequence, in parity with
regulators.
The eDP bridge loaded by the DRM driver needs to be able to control the
screen regulators.

The regulators linking was moved earlier to have them available for
other subsystems :
https://lkml.org/lkml/2008/12/2/10

Now a lot of regulators are instantiated from MFD, so we need to move
the MFD to keep this benefit.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:18122
TEST=boot on Spring and see the traces from the virtual TPS65090
regulators earlier than the display port initialization.

Change-Id: I62223ea9fa79651a787754d45e05dd26edb7a029
Reviewed-on: https://gerrit.chromium.org/gerrit/44598
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
11 years agoexynos/mfc: add sysmmu power on/off calls
Prathyush K [Tue, 31 Jul 2012 07:50:52 +0000 (13:20 +0530)]
exynos/mfc: add sysmmu power on/off calls

This patch calls the sysmmu driver helper functions for resuming
and suspending its two sysmmus during mfc power on/off. This is required
for the sysmmus to resume/suspend along with the parent mfc device.

BUG=chrome-os-partner:11793
TEST=MFC/GSC/Sysmmu get suspended after probe and resume upon
video playback. Tested on Daisy.

Change-Id: I989af8bb0aacb9991443ca90eb47068c67623a38
Signed-off-by: Prathyush K <prathyush.k@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/29165
Tested-by: Prathyush Kalashwaram <prathyush@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Commit-Ready: Olof Johansson <olofj@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42960
Commit-Queue: John Sheu <sheu@chromium.org>
Reviewed-by: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
11 years agoexynos: mfc: Increase the IOMMU memory size from 128MB to 256MB
Arjun KV [Thu, 5 Jul 2012 09:47:48 +0000 (15:17 +0530)]
exynos: mfc: Increase the IOMMU memory size from 128MB to 256MB

This change is required for 1080p multiple instance video playback.
We need to increase the MFC, GSC and DRM-FIMD IOMMU memory size
from 128MB to 256MB.
With this change all VDA scenarios including multi instance playback
are handled.

BUG=None
TEST=emerge-daisy chromeos-kernel,
run 4 instance 1080p h264 video.

Change-Id: Iabbbccdc366145891b0e0f4eb12a41e68fe62451
Signed-off-by: Arjun KV <arjun.kv@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/26813
Reviewed-by: kiran <kiran@chromium.org>
Tested-by: kiran <kiran@chromium.org>
Reviewed-by: Sunil M <sunilm.samsung@gmail.com>
Reviewed-by: Subash Patel <subash@chromium.org>
Reviewed-by: Pawel Osciak <posciak@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/42959
Commit-Queue: John Sheu <sheu@chromium.org>
Reviewed-by: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
11 years agodrm/bridge: Convert ps8622 into a drm_bridge
Sean Paul [Wed, 27 Feb 2013 06:45:05 +0000 (01:45 -0500)]
drm/bridge: Convert ps8622 into a drm_bridge

Change ps8622 driver from an i2c driver to a drm_bridge. This allows us
to control the bridge with dpms, as well as more tightly control the
order of power on.

BUG=chrome-os-partner:17557
TEST=Builds

Change-Id: Ie98b5728ee99cad311c72122fdf781b40467c126
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43941
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
11 years agoCHROMIUM: CONFIG: Change PS8622 to DRM_PS8622
Sean Paul [Mon, 25 Feb 2013 20:52:26 +0000 (15:52 -0500)]
CHROMIUM: CONFIG: Change PS8622 to DRM_PS8622

The config option changed, update to reflect the new name.

BUG=chrome-os-partner:17557
TEST=Builds

Change-Id: Id904cf20c2bda00dd7a2a9d59c70297ef1e05e2d
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43940
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
11 years agodrm/bridge: Move ps8622 driver into drm/bridge
Sean Paul [Mon, 25 Feb 2013 20:35:25 +0000 (15:35 -0500)]
drm/bridge: Move ps8622 driver into drm/bridge

Move the ps8622 bridge driver into drm/bridge.

BUG=chrome-os-partner:17557
TEST=Builds

Change-Id: I153539311c5a31aafab9deff1f74384a70bc48c4
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43939
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
11 years agodrm/exynos: Convert ptn bridge to drm_bridge
Sean Paul [Mon, 25 Feb 2013 20:26:25 +0000 (15:26 -0500)]
drm/exynos: Convert ptn bridge to drm_bridge

BUG=chrome-os-partner:17557
TEST=Tested on snow

Change-Id: Ie9cc502325953bcb97b69660bebfe4641cda4acd
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43926
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
11 years agodrm/i2c: Move ptn3460 from i2c to bridge directory
Sean Paul [Fri, 22 Feb 2013 20:17:24 +0000 (15:17 -0500)]
drm/i2c: Move ptn3460 from i2c to bridge directory

In preparation of drm_bridge-ifying the ptn3460 driver.

BUG=chrome-os-partner:17557
TEST=Build kernel for daisy

Change-Id: Ia17fe2d4de3c23734e86716b47ee0337c55f518b
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43925
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
11 years agodrm/exynos: Move dp training into mode_set
Sean Paul [Mon, 25 Feb 2013 19:52:41 +0000 (14:52 -0500)]
drm/exynos: Move dp training into mode_set

Move the DP link training from the interrupt worker to the mode_set
callback.

BUG=chrome-os-partner:17557
TEST=Tested on snow, no regressions noted

Change-Id: I06fecce43500e4a2b64eda4aca18c889a811b1ed
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43924
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
11 years agoARM: EXYNOS: MFC: Add IOMMU mapping to MFC probe
John Sheu [Thu, 7 Feb 2013 01:13:54 +0000 (17:13 -0800)]
ARM: EXYNOS: MFC: Add IOMMU mapping to MFC probe

IOMMU mapping is created for mfc device during probe. This
requires the sysmmu_l and sysmmu_r property be set in the DTS
file. First, the sysmmu device nodes are found and then the
sysmmu platform devices are retrieved. A IOMMU mapping is then created
for mfc_l and mfc_r devices.

Change-Id: I270211bd2583492818d2f2eb2c9bac73ba3956cd
Signed-off-by: Prathyush K <prathyush.k@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/42958
Reviewed-by: Pawel Osciak <posciak@chromium.org>
Commit-Queue: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
11 years agoCHROMIUM: s5p-mfc: backport upstream s5p-mfc driver.
John Sheu [Thu, 7 Feb 2013 00:23:15 +0000 (16:23 -0800)]
CHROMIUM: s5p-mfc: backport upstream s5p-mfc driver.

<UPSTREAM MERGE NOT REQUIRED>

Backport the upstream driver, for the purpose of enabling s5p-mfc hardware
video encoding.

Backport of changes up to 734d1ece37fbf3d2ddfc71bc6c69e0fe35f02542 from
linuxtv/staging/for_v3.9

Signed-off-by: John Sheu <sheu@google.com>
BUG=chromium-os:38376
BUG=chromium:167417
TEST=local build, run on snow

Change-Id: Iae484f49a16a8e753b8951b2db4433bc549a5e97
Reviewed-on: https://gerrit.chromium.org/gerrit/42957
Commit-Queue: John Sheu <sheu@chromium.org>
Reviewed-by: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
11 years agoCHROMIUM:config:Enable CP210X module
Steev Klimaszewski [Wed, 20 Feb 2013 20:12:03 +0000 (14:12 -0600)]
CHROMIUM:config:Enable CP210X module

The CP210X is another fairly common serial adapter.

BUG=None
TEST=Compile, boot kernel, plug in cp210x adapter, check that you get a
/dev/ttyUSB0 device.

Change-Id: Ibf79904fef9f93efca135960d48f7200b8c5fef8
Signed-off-by: Steev Klimaszewski <threeway@gmail.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/43625
Commit-Queue: Olof Johansson <olofj@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
11 years agoARM: GPU: MALI: G3D ASV Lock Bit implementation
Arjun KV [Wed, 19 Dec 2012 06:54:53 +0000 (12:24 +0530)]
ARM: GPU: MALI: G3D ASV Lock Bit implementation

If G3D ASV lock bit is configured, all voltages in the G3D ASV table
have to be increased by 25mV.

BUG=chrome-os-partner:16615
TEST=Compile and boot kernel, cannot test
the exact changes till we get the new chip.

Change-Id: I8784ed290807ac5db86c706177403260742bbe89
Signed-off-by: Arjun.K.V <arjun.kv@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/39467
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>

11 years agoarm: exynos5: INT ASV Lock Bit implementation
Arjun KV [Wed, 19 Dec 2012 06:10:25 +0000 (11:40 +0530)]
arm: exynos5: INT ASV Lock Bit implementation

If INT ASV lock bit is configured, all voltages in the INT ASV table
have to be increased by 25mV.

BUG=chrome-os-partner:16615
TEST=Compile and boot kernel, cannot test
the exact changes till we get the new chip.

Change-Id: I64ec69874bd4753b61efd46708cdf82046310dd2
Signed-off-by: Arjun.K.V <arjun.kv@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/39466
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>

11 years agoarm: exynos5: ARM ASV Lock Bit implementation
Arjun KV [Wed, 19 Dec 2012 05:29:00 +0000 (10:59 +0530)]
arm: exynos5: ARM ASV Lock Bit implementation

If lock bit is configured, voltage for cpu frequency in some
ranges(800-200MHz, 1000-200MHz, 1100-200MHz) should be locked with the
voltage of the locked cpu frequency.  e.g. in 800-200MHz range all
frequencies below 800MHz will be configured with same voltage as
800MHz.

BUG=chrome-os-partner:16615

TEST=Compile and boot kernel.  Add printouts to
exynos5250_cpufreq_get_asv() to confirm that the min_t() doesn't
actually change the index on existing systems where lock bits are all
0.  Check that `dmesg` contains "EXYNOS5250: ASV lock int: 0 g3d: 0
arm: 0" which means that lock bits are all disabled.

[dianders cleaned up patch and CL description]

Change-Id: If5fcfae38af1bd01a5646ae94f7b010e564411cd
Signed-off-by: Arjun.K.V <arjun.kv@samsung.com>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39465

11 years agoCHROMEOS: config: turn on HID_BATTERY_STRENGTH
Yufeng Shen [Wed, 27 Feb 2013 23:21:56 +0000 (18:21 -0500)]
CHROMEOS: config: turn on HID_BATTERY_STRENGTH

This option allows external HID device to report its battery info
under /sys/class/power_supply/hid-xxx-battery

Signed-off-by: Yufeng Shen <miletus@chromium.org>
BUG=chromium-os:39317
TEST=Tested on Link with the new kernel, connect an Apple Magic Mouse
     to it, and the battery info is shown under
     /sys/class/power_supply/hid-xxx-battery

Change-Id: Ia05d8593673d5d1bd0e3f0def643713d8cb81e8e
Reviewed-on: https://gerrit.chromium.org/gerrit/44245
Reviewed-by: Olof Johansson <olofj@chromium.org>
Commit-Queue: Yufeng Shen <miletus@chromium.org>
Tested-by: Yufeng Shen <miletus@chromium.org>
11 years agoUPSTREAM: HID: add Kconfig text to HID_BATTERY_STRENGTH
Jiri Kosina [Tue, 24 Apr 2012 08:51:30 +0000 (10:51 +0200)]
UPSTREAM: HID: add Kconfig text to HID_BATTERY_STRENGTH

HID_BATTERY_STRENGTH is missing both help text and description text.

BUG=chromium-os:39317
TEST=set CONFIG_HID_BATTERY_STRENGTH=y in base.config. build the
  kernel, and check that this option is enabled in the built kernel

cherry-picked from upstream commit
692d30d63b80b174d0ed24bbffb7a1ea536d5fee
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Change-Id: I2925c344b918e8b03953679ee5f856860fa09aa7
Reviewed-on: https://gerrit.chromium.org/gerrit/44249
Reviewed-by: Olof Johansson <olofj@chromium.org>
Commit-Queue: Yufeng Shen <miletus@chromium.org>
Reviewed-by: Yufeng Shen <miletus@chromium.org>
Tested-by: Yufeng Shen <miletus@chromium.org>
11 years agoCHROMIUM: config: Renormalize splitconfig
Doug Anderson [Thu, 28 Feb 2013 21:57:05 +0000 (13:57 -0800)]
CHROMIUM: config: Renormalize splitconfig

Just ran: ./chromeos/scripts/kernelconfig oldconfig
...and hit return for everything.  AKA: no functional change
here, this just tells us where we are.

BUG=None
TEST=Compiled and booted on one device.

Change-Id: I92d6e364e9c95882e5c8bc10450fe97c79115e76
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44312
Reviewed-by: Mike Frysinger <vapier@chromium.org>
11 years agoCHROMIUM: config: Build spidev into the kernel (not a module)
Doug Anderson [Thu, 28 Feb 2013 21:58:11 +0000 (13:58 -0800)]
CHROMIUM: config: Build spidev into the kernel (not a module)

A recovery image needs to be able to access SPI in order to reflash
the firmware, but the recovery image doesn't include any modules.
Make spidev part of the kernel to avoid having yet another weird
config difference for the recovery kernel.

BUG=chrome-os-partner:13068
TEST=Manual:
1. Get an official recovery image (that is marked to do a firmware
   flash) that contains this CL plus the modification to
   mod_image_for_recovery.sh that enables it.
2. Boot on snow.
3. After reboot confirm that firmware got updated.
4. Also after reboot look in console-ramoops.  If you see this:
    [ 1157.020235] Chromium OS LSM: init_module locked module=
    "/lib/modules/3.4.0/kernel/drivers/spi/spidev.ko" pid=1574
    cmdline="modprobe spidev"
   ...then that's bad and it means that we loaded the spidev module
   from the target USB key which isn't what we want to do.
TEST=Manual:
1. Hack up recovery image as described in chrome-os-partner:13068.
2. From first shell prompt in hacked recovery image type:
   chroot /usb /usr/sbin/flashrom -r /tmp/foo.bin
3. Confirm that flashrom reports no errors.
4. Type lsmod
5. Confirm that spidev is not listed

Change-Id: Ic156895cb186d04d2c32370d7cf70a3ec4af55bc
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44311
Reviewed-by: Mike Frysinger <vapier@chromium.org>
11 years agoCHROMIUM: eCryptfs: allow userspace messaging to be disabled
Kees Cook [Thu, 28 Feb 2013 00:01:13 +0000 (16:01 -0800)]
CHROMIUM: eCryptfs: allow userspace messaging to be disabled

When the userspace messaging (needed for ecryptfsd) is not needed, allow
eCryptfs to build with it removed. This saves on kernel code size and
reduces potential attack surface by removing the /dev/ecryptfs node.

BUG=chromium-os:35732
TEST=link build, /dev/ecryptfs is gone, eCryptfs still works.

[sent upstream for review:
 http://marc.info/?l=ecryptfs-users&m=136204079607329&w=2]

Change-Id: I1b2be61e0a455fc9f6e09a9f4a1b1f6d65d1903a
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44278
Reviewed-by: Will Drewry <wad@chromium.org>
11 years agoUPSTREAM: eCryptfs: Copy up attributes of the lower target inode after rename
Tyler Hicks [Thu, 13 Sep 2012 19:00:56 +0000 (12:00 -0700)]
UPSTREAM: eCryptfs: Copy up attributes of the lower target inode after rename

After calling into the lower filesystem to do a rename, the lower target
inode's attributes were not copied up to the eCryptfs target inode. This
resulted in the eCryptfs target inode staying around, rather than being
evicted, because i_nlink was not updated for the eCryptfs inode. This
also meant that eCryptfs didn't do the final iput() on the lower target
inode so it stayed around, as well. This would result in a failure to
free up space occupied by the target file in the rename() operation.
Both target inodes would eventually be evicted when the eCryptfs
filesystem was unmounted.

This patch calls fsstack_copy_attr_all() after the lower filesystem
does its ->rename() so that important inode attributes, such as i_nlink,
are updated at the eCryptfs layer. ecryptfs_evict_inode() is now called
and eCryptfs can drop its final reference on the lower inode.

http://launchpad.net/bugs/561129

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Tested-by: Colin Ian King <colin.king@canonical.com>
Cc: <stable@vger.kernel.org> [2.6.39+]
BUG=chromium-os:35732
TEST=daisy build, ENOSPC bubbles up to userspace

(cherry picked from upstream commit 8335eafc2859e1a26282bef7c3d19f3d68868b8a)
Signed-off-by: Kees Cook <keescook@chromium.org>
Change-Id: I9d4aa7e91b6f132a1f16d9a8b509681977091907
Reviewed-on: https://gerrit.chromium.org/gerrit/44158
Tested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Kees Cook <keescook@chromium.org>

11 years agoUPSTREAM: eCryptfs: Call lower ->flush() from ecryptfs_flush()
Tyler Hicks [Thu, 13 Sep 2012 01:38:00 +0000 (18:38 -0700)]
UPSTREAM: eCryptfs: Call lower ->flush() from ecryptfs_flush()

Since eCryptfs only calls fput() on the lower file in
ecryptfs_release(), eCryptfs should call the lower filesystem's
->flush() from ecryptfs_flush().

If the lower filesystem implements ->flush(), then eCryptfs should try
to flush out any dirty pages prior to calling the lower ->flush(). If
the lower filesystem does not implement ->flush(), then eCryptfs has no
need to do anything in ecryptfs_flush() since dirty pages are now
written out to the lower filesystem in ecryptfs_release().

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
BUG=chromium-os:35732
TEST=daisy build, ENOSPC bubbles up to userspace

(cherry picked from upstream commit 64e6651dcc10e9d2cc6230208a8e6c2cfd19ae18)
Signed-off-by: Kees Cook <keescook@chromium.org>
Change-Id: I44d6ba0eb30b6eebbfbedf3a1d7a8d7eaed28c01
Reviewed-on: https://gerrit.chromium.org/gerrit/44157
Tested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Kees Cook <keescook@chromium.org>

11 years agoUPSTREAM: eCryptfs: Write out all dirty pages just before releasing the lower file
Tyler Hicks [Thu, 13 Sep 2012 01:02:46 +0000 (18:02 -0700)]
UPSTREAM: eCryptfs: Write out all dirty pages just before releasing the lower file

Fixes a regression caused by:

821f749 eCryptfs: Revert to a writethrough cache model

That patch reverted some code (specifically, 32001d6f) that was
necessary to properly handle open() -> mmap() -> close() -> dirty pages
-> munmap(), because the lower file could be closed before the dirty
pages are written out.

Rather than reapplying 32001d6f, this approach is a better way of
ensuring that the lower file is still open in order to handle writing
out the dirty pages. It is called from ecryptfs_release(), while we have
a lock on the lower file pointer, just before the lower file gets the
final fput() and we overwrite the pointer.

https://launchpad.net/bugs/1047261

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Reported-by: Artemy Tregubenko <me@arty.name>
Tested-by: Artemy Tregubenko <me@arty.name>
Tested-by: Colin Ian King <colin.king@canonical.com>
BUG=chromium-os:35732
TEST=daisy build, ENOSPC bubbles up to userspace

(cherry picked from upstream commit 7149f2558d5b5b988726662fe58b1c388337805b)
Signed-off-by: Kees Cook <keescook@chromium.org>
Change-Id: Ie713a160fb3899869af63fcf4ad0c29a2ab8ea79
Reviewed-on: https://gerrit.chromium.org/gerrit/44156
Tested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Kees Cook <keescook@chromium.org>

11 years agoUPSTREAM: eCryptfs: check for eCryptfs cipher support at mount
Tim Sally [Thu, 12 Jul 2012 23:10:24 +0000 (19:10 -0400)]
UPSTREAM: eCryptfs: check for eCryptfs cipher support at mount

The issue occurs when eCryptfs is mounted with a cipher supported by
the crypto subsystem but not by eCryptfs. The mount succeeds and an
error does not occur until a write. This change checks for eCryptfs
cipher support at mount time.

Resolves Launchpad issue #338914, reported by Tyler Hicks in 03/2009.
https://bugs.launchpad.net/ecryptfs/+bug/338914

Signed-off-by: Tim Sally <tsally@atomicpeace.com>
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
BUG=chromium-os:35732
TEST=daisy build, ENOSPC bubbles up to userspace

(cherry picked from upstream commit 5f5b331d5c21228a6519dcb793fc1629646c51a6)
Signed-off-by: Kees Cook <keescook@chromium.org>
Change-Id: If3d6f7f13047e7a9a64c0f79441ca52ebab17979
Reviewed-on: https://gerrit.chromium.org/gerrit/44155
Tested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Kees Cook <keescook@chromium.org>

11 years agoUPSTREAM: eCryptfs: Revert to a writethrough cache model
Tyler Hicks [Tue, 3 Jul 2012 23:50:57 +0000 (16:50 -0700)]
UPSTREAM: eCryptfs: Revert to a writethrough cache model

A change was made about a year ago to get eCryptfs to better utilize its
page cache during writes. The idea was to do the page encryption
operations during page writeback, rather than doing them when initially
writing into the page cache, to reduce the number of page encryption
operations during sequential writes. This meant that the encrypted page
would only be written to the lower filesystem during page writeback,
which was a change from how eCryptfs had previously wrote to the lower
filesystem in ecryptfs_write_end().

The change caused a few eCryptfs-internal bugs that were shook out.
Unfortunately, more grave side effects have been identified that will
force changes outside of eCryptfs. Because the lower filesystem isn't
consulted until page writeback, eCryptfs has no way to pass lower write
errors (ENOSPC, mainly) back to userspace. Additionaly, it was reported
that quotas could be bypassed because of the way eCryptfs may sometimes
open the lower filesystem using a privileged kthread.

It would be nice to resolve the latest issues, but it is best if the
eCryptfs commits be reverted to the old behavior in the meantime.

This reverts:
32001d6f "eCryptfs: Flush file in vma close"
5be79de2 "eCryptfs: Flush dirty pages in setattr"
57db4e8d "ecryptfs: modify write path to encrypt page in writepage"

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Tested-by: Colin King <colin.king@canonical.com>
Cc: Colin King <colin.king@canonical.com>
Cc: Thieu Le <thieule@google.com>
BUG=chromium-os:35732
TEST=daisy build, ENOSPC bubbles up to userspace

(cherry picked from upstream commit 821f7494a77627fb1ab539591c57b22cdca702d6)
Signed-off-by: Kees Cook <keescook@chromium.org>
Change-Id: I78b810a47117ddc53f641150a6d097fd95856ae7
Reviewed-on: https://gerrit.chromium.org/gerrit/44154
Tested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Kees Cook <keescook@chromium.org>

11 years agoUPSTREAM: eCryptfs: Initialize empty lower files when opening them
Tyler Hicks [Thu, 21 Jun 2012 06:50:59 +0000 (23:50 -0700)]
UPSTREAM: eCryptfs: Initialize empty lower files when opening them

Historically, eCryptfs has only initialized lower files in the
ecryptfs_create() path. Lower file initialization is the act of writing
the cryptographic metadata from the inode's crypt_stat to the header of
the file. The ecryptfs_open() path already expects that metadata to be
in the header of the file.

A number of users have reported empty lower files in beneath their
eCryptfs mounts. Most of the causes for those empty files being left
around have been addressed, but the presence of empty files causes
problems due to the lack of proper cryptographic metadata.

To transparently solve this problem, this patch initializes empty lower
files in the ecryptfs_open() error path. If the metadata is unreadable
due to the lower inode size being 0, plaintext passthrough support is
not in use, and the metadata is stored in the header of the file (as
opposed to the user.ecryptfs extended attribute), the lower file will be
initialized.

The number of nested conditionals in ecryptfs_open() was getting out of
hand, so a helper function was created. To avoid the same nested
conditional problem, the conditional logic was reversed inside of the
helper function.

https://launchpad.net/bugs/911507

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Cc: John Johansen <john.johansen@canonical.com>
Cc: Colin Ian King <colin.king@canonical.com>
BUG=chromium-os:35732
TEST=daisy build, ENOSPC bubbles up to userspace

(cherry picked from upstream commit e3ccaa9761200952cc269b1f4b7d7bb77a5e071b)
Signed-off-by: Kees Cook <keescook@chromium.org>
Change-Id: Ic6b303d2b8ff2690bc938adce850b2eaedab98a7
Reviewed-on: https://gerrit.chromium.org/gerrit/44153
Tested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Kees Cook <keescook@chromium.org>

11 years agoUPSTREAM: eCryptfs: Unlink lower inode when ecryptfs_create() fails
Tyler Hicks [Tue, 22 May 2012 20:09:50 +0000 (15:09 -0500)]
UPSTREAM: eCryptfs: Unlink lower inode when ecryptfs_create() fails

ecryptfs_create() creates a lower inode, allocates an eCryptfs inode,
initializes the eCryptfs inode and cryptographic metadata attached to
the inode, and then writes the metadata to the header of the file.

If an error was to occur after the lower inode was created, an empty
lower file would be left in the lower filesystem. This is a problem
because ecryptfs_open() refuses to open any lower files which do not
have the appropriate metadata in the file header.

This patch properly unlinks the lower inode when an error occurs in the
later stages of ecryptfs_create(), reducing the chance that an empty
lower file will be left in the lower filesystem.

https://launchpad.net/bugs/872905

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Cc: John Johansen <john.johansen@canonical.com>
Cc: Colin Ian King <colin.king@canonical.com>
BUG=chromium-os:35732
TEST=daisy build, ENOSPC bubbles up to userspace

(cherry picked from upstream commit 8bc2d3cf612994a960c2e8eaea37f6676f67082a)
Signed-off-by: Kees Cook <keescook@chromium.org>
Change-Id: I9ef97db96f1e1e594e5f995ae6c1293d1b3527e0
Reviewed-on: https://gerrit.chromium.org/gerrit/44152
Tested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Kees Cook <keescook@chromium.org>

11 years agoUPSTREAM: eCryptfs: Copy up POSIX ACL and read-only flags from lower mount
Tyler Hicks [Mon, 11 Jun 2012 22:42:32 +0000 (15:42 -0700)]
UPSTREAM: eCryptfs: Copy up POSIX ACL and read-only flags from lower mount

When the eCryptfs mount options do not include '-o acl', but the lower
filesystem's mount options do include 'acl', the MS_POSIXACL flag is not
flipped on in the eCryptfs super block flags. This flag is what the VFS
checks in do_last() when deciding if the current umask should be applied
to a newly created inode's mode or not. When a default POSIX ACL mask is
set on a directory, the current umask is incorrectly applied to new
inodes created in the directory. This patch ignores the MS_POSIXACL flag
passed into ecryptfs_mount() and sets the flag on the eCryptfs super
block depending on the flag's presence on the lower super block.

Additionally, it is incorrect to allow a writeable eCryptfs mount on top
of a read-only lower mount. This missing check did not allow writes to
the read-only lower mount because permissions checks are still performed
on the lower filesystem's objects but it is best to simply not allow a
rw mount on top of ro mount. However, a ro eCryptfs mount on top of a rw
mount is valid and still allowed.

https://launchpad.net/bugs/1009207

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Reported-by: Stefan Beller <stefanbeller@googlemail.com>
Cc: John Johansen <john.johansen@canonical.com>
BUG=chromium-os:35732
TEST=daisy build, ENOSPC bubbles up to userspace

(cherry picked from upstream commit 069ddcda37b2cf5bb4b6031a944c0e9359213262)
Signed-off-by: Kees Cook <keescook@chromium.org>
Change-Id: I1c087b735bbead871d8420c0346a25468539a6cd
Reviewed-on: https://gerrit.chromium.org/gerrit/44151
Tested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Kees Cook <keescook@chromium.org>

11 years agoUPSTREAM: eCryptfs: Gracefully refuse miscdev file ops on inherited/passed files
Tyler Hicks [Mon, 11 Jun 2012 16:24:11 +0000 (09:24 -0700)]
UPSTREAM: eCryptfs: Gracefully refuse miscdev file ops on inherited/passed files

File operations on /dev/ecryptfs would BUG() when the operations were
performed by processes other than the process that originally opened the
file. This could happen with open files inherited after fork() or file
descriptors passed through IPC mechanisms. Rather than calling BUG(), an
error code can be safely returned in most situations.

In ecryptfs_miscdev_release(), eCryptfs still needs to handle the
release even if the last file reference is being held by a process that
didn't originally open the file. ecryptfs_find_daemon_by_euid() will not
be successful, so a pointer to the daemon is stored in the file's
private_data. The private_data pointer is initialized when the miscdev
file is opened and only used when the file is released.

https://launchpad.net/bugs/994247

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Reported-by: Sasha Levin <levinsasha928@gmail.com>
Tested-by: Sasha Levin <levinsasha928@gmail.com>
BUG=chromium-os:35732
TEST=daisy build, ENOSPC bubbles up to userspace

(cherry picked from upstream commit 8dc6780587c99286c0d3de747a2946a76989414a)
Signed-off-by: Kees Cook <keescook@chromium.org>
Change-Id: I2d877799e3e4c6f4126f28cfacaca4c6e7f729a9
Reviewed-on: https://gerrit.chromium.org/gerrit/44150
Tested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Kees Cook <keescook@chromium.org>

11 years agoUPSTREAM: eCryptfs: Fix lockdep warning in miscdev operations
Tyler Hicks [Mon, 11 Jun 2012 17:21:34 +0000 (10:21 -0700)]
UPSTREAM: eCryptfs: Fix lockdep warning in miscdev operations

Don't grab the daemon mutex while holding the message context mutex.
Addresses this lockdep warning:

 ecryptfsd/2141 is trying to acquire lock:
  (&ecryptfs_msg_ctx_arr[i].mux){+.+.+.}, at: [<ffffffffa029c213>] ecryptfs_miscdev_read+0x143/0x470 [ecryptfs]

 but task is already holding lock:
  (&(*daemon)->mux){+.+...}, at: [<ffffffffa029c2ec>] ecryptfs_miscdev_read+0x21c/0x470 [ecryptfs]

 which lock already depends on the new lock.

 the existing dependency chain (in reverse order) is:

 -> #1 (&(*daemon)->mux){+.+...}:
        [<ffffffff810a3b8d>] lock_acquire+0x9d/0x220
        [<ffffffff8151c6da>] __mutex_lock_common+0x5a/0x4b0
        [<ffffffff8151cc64>] mutex_lock_nested+0x44/0x50
        [<ffffffffa029c5d7>] ecryptfs_send_miscdev+0x97/0x120 [ecryptfs]
        [<ffffffffa029b744>] ecryptfs_send_message+0x134/0x1e0 [ecryptfs]
        [<ffffffffa029a24e>] ecryptfs_generate_key_packet_set+0x2fe/0xa80 [ecryptfs]
        [<ffffffffa02960f8>] ecryptfs_write_metadata+0x108/0x250 [ecryptfs]
        [<ffffffffa0290f80>] ecryptfs_create+0x130/0x250 [ecryptfs]
        [<ffffffff811963a4>] vfs_create+0xb4/0x120
        [<ffffffff81197865>] do_last+0x8c5/0xa10
        [<ffffffff811998f9>] path_openat+0xd9/0x460
        [<ffffffff81199da2>] do_filp_open+0x42/0xa0
        [<ffffffff81187998>] do_sys_open+0xf8/0x1d0
        [<ffffffff81187a91>] sys_open+0x21/0x30
        [<ffffffff81527d69>] system_call_fastpath+0x16/0x1b

 -> #0 (&ecryptfs_msg_ctx_arr[i].mux){+.+.+.}:
        [<ffffffff810a3418>] __lock_acquire+0x1bf8/0x1c50
        [<ffffffff810a3b8d>] lock_acquire+0x9d/0x220
        [<ffffffff8151c6da>] __mutex_lock_common+0x5a/0x4b0
        [<ffffffff8151cc64>] mutex_lock_nested+0x44/0x50
        [<ffffffffa029c213>] ecryptfs_miscdev_read+0x143/0x470 [ecryptfs]
        [<ffffffff811887d3>] vfs_read+0xb3/0x180
        [<ffffffff811888ed>] sys_read+0x4d/0x90
        [<ffffffff81527d69>] system_call_fastpath+0x16/0x1b

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
BUG=chromium-os:35732
TEST=daisy build, ENOSPC bubbles up to userspace

(cherry picked from upstream commit 60d65f1f07a7d81d3eb3b91fc13fca80f2fdbb12)
Signed-off-by: Kees Cook <keescook@chromium.org>
Change-Id: I243163c4ca70dbc74d85a6fa59f5fb4d8b586103
Reviewed-on: https://gerrit.chromium.org/gerrit/44149
Tested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Commit-Queue: Kees Cook <keescook@chromium.org>

11 years agoUPSTREAM: eCryptfs: Properly check for O_RDONLY flag before doing privileged open
Tyler Hicks [Tue, 12 Jun 2012 18:17:01 +0000 (11:17 -0700)]
UPSTREAM: eCryptfs: Properly check for O_RDONLY flag before doing privileged open

If the first attempt at opening the lower file read/write fails,
eCryptfs will retry using a privileged kthread. However, the privileged
retry should not happen if the lower file's inode is read-only because a
read/write open will still be unsuccessful.

The check for determining if the open should be retried was intended to
be based on the access mode of the lower file's open flags being
O_RDONLY, but the check was incorrectly performed. This would cause the
open to be retried by the privileged kthread, resulting in a second
failed open of the lower file. This patch corrects the check to
determine if the open request should be handled by the privileged
kthread.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
BUG=chromium-os:35732
TEST=daisy build, ENOSPC bubbles up to userspace

(cherry picked from commit 9fe79d7600497ed8a95c3981cbe5b73ab98222f0)
Signed-off-by: Kees Cook <keescook@chromium.org>
Change-Id: I748856005c76dd310a5a1d8a053bcba01ddded77
Reviewed-on: https://gerrit.chromium.org/gerrit/44148
Tested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Kees Cook <keescook@chromium.org>

11 years agoCHROMIUM: charger-manager: Pass IRQ to wakeup check function
Simon Glass [Sun, 10 Feb 2013 03:48:20 +0000 (19:48 -0800)]
CHROMIUM: charger-manager: Pass IRQ to wakeup check function

Since charger-manager knows the IRQ number it is looking for in the
wake-up check (it gets it from the RTC class), pass it to the platform
function so that this does not need to be hard-coded.

Add a function to exynos which return true if a particular GPIO is known
to be the sole reason for the wakeup event.

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow
Turn on debugging in setup-charger. Try waking up on snow using the
keyboard, the lid and a timer ('rtcwake -s 35 -d /dev/rtc1 -m mem').
See that only the timer causes this function to return true.

Note I did not test simultaneous wakeup. This could perhaps be done by
introducing a long delay in the function, to give me time to cause another
type of wakeup event. However, I did see an EC wakeup event at one point
and this caused the function to return false as required.

Change-Id: I96eb0387e36c097f0df0256c6be4879b3180d259
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43022

11 years agoCHROMIUM: charger-manager: Tidy up suspend_again() device resume/suspend
Simon Glass [Sun, 10 Feb 2013 04:09:47 +0000 (20:09 -0800)]
CHROMIUM: charger-manager: Tidy up suspend_again() device resume/suspend

The current implementation is pretty-much hard-coded. It doesn't really
provide for different devices to be easy connected or specified via the
device tree.

During suspend_again(), create a list of devices that need to be resumed
by walking up through the parents of the power supply and rtc devices.
Resume the list in reverse order so that parents come first. Then suspend
the list in forward order so that the children are suspended first.

This provides more flexibility for devices to be specified at run-time.

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow
Tested with charger-manager with other changes. See that it can remain
suspended (i.e. returns to suspend automatically after each wake).

Change-Id: I7c9f04330c437b3da32e58dd1e53e0e550b37a71
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43023
Reviewed-by: Benson Leung <bleung@chromium.org>
11 years agoAdd debugging to trace the loss of hidden ssid
Bing Zhao [Tue, 26 Feb 2013 23:22:17 +0000 (15:22 -0800)]
Add debugging to trace the loss of hidden ssid

This patch will help to trace if hidden ssid is lost in firmware or driver.
SSID and mac address should be anonymized.

BUG=chrome-os-partner:17989
TEST=trigger a scan and grep for "inform bss" in dmesg/messages. Submit a
feedback report and verify if SSIDs and mac addresses are anonymized. Verified
with the feedback report 718249759.

Change-Id: I0df02a9f8eb1898f6f3af2438c614031bb44f329
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Ashok Nagarajan <asnagarajan@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44124
Reviewed-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
11 years agoCHROMIUM: mmc: Add in support to expose PRV for v4 MMCs
Bernie Thompson [Wed, 27 Feb 2013 18:56:59 +0000 (10:56 -0800)]
CHROMIUM: mmc: Add in support to expose PRV for v4 MMCs

The JEDEC MMC v4 spec defines a new PRV value in place of the original
fwrev and hwrev specified in v1. We can expose this in the kernel to enable
user space to more easily determine the product revision of a given MMC.

BUG=chrome-os-partner:17640
TEST=emerge-daisy_spring chromeos-kernel
Check for /sys/devices/dw_mmc.0/mmc_host/mmc0/mmc0:0001/prv

Change-Id: Ia241c743e64749909ad18851425a551e04d8cdb3
Signed-off-by: Bernie Thompson <bhthompson@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44190
Reviewed-by: Grant Grundler <grundler@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
11 years agoCHROMIUM: TEMPORARY: dump stack to help debug p/17609
Luigi Semenzato [Wed, 27 Feb 2013 17:41:54 +0000 (09:41 -0800)]
CHROMIUM: TEMPORARY: dump stack to help debug p/17609

This doesn't happen very often, so the dump_stack should
be tolerable.  I tried with a WARN_ON, but it made some
of our automated tests fail.

BUG=chrome-os-partner:17609
TEST=none

Change-Id: I3d5a0ebc25d272901e713209dc5d655322804f91
Signed-off-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44178
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
11 years agoRevert "CHROMIUM: TEMPORARY: instrumentation for crosbug.com/p/17609"
Luigi Semenzato [Wed, 27 Feb 2013 16:56:34 +0000 (08:56 -0800)]
Revert "CHROMIUM: TEMPORARY: instrumentation for crosbug.com/p/17609"

This reverts commit 046efd1b7dceabe4cc38c61c355a34c2bf657ca3.
The WARN_ON makes some automated tests fail.

BUG=chrome-os-partner:17609
TEST=none

Change-Id: I07da232e7d2f7456da41ea373dfa00275a8effa0
Signed-off-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44174
Commit-Queue: Grant Grundler <grundler@chromium.org>
Reviewed-by: Grant Grundler <grundler@chromium.org>
11 years agodrm: Add drm_bridge between encoder and connector
Sean Paul [Fri, 22 Feb 2013 19:01:26 +0000 (14:01 -0500)]
drm: Add drm_bridge between encoder and connector

This patch adds the notion of a drm_bridge between the encoder and the
connector. This allows us to handle bridge chips gracefully with dpms
and hotplug.

BUG=chrome-os-partner:17557
TEST=Tested on snow

Change-Id: I66b9f631bb924e443e79419a3dc3af0ef41fb70d
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43912

11 years agoCHROMIUM: TEMPORARY: instrumentation for crosbug.com/p/17609
Luigi Semenzato [Fri, 22 Feb 2013 22:51:39 +0000 (14:51 -0800)]
CHROMIUM: TEMPORARY: instrumentation for crosbug.com/p/17609

We have a hard time reproducing crosbug.com/p/17609.  It seems
to be correlated with a reset of the device.  We don't understand
why the reset happens and we're hoping that a stack trace will
give us some information.

From the logs we've seen, this doesn't happen very often, so
chances of spewing are low.  We get Link feedback reports with
this error almost daily.

BUG=chrome-os-partner:17609
TEST=not tested, or, rather, YOU test it
BRANCH=none

Signed-off-by: Luigi Semenzato <semenzato@chromium.org>
Change-Id: If24b4f2490919905d79cdf4e5b8b159cbe8aee6c
Reviewed-on: https://gerrit.chromium.org/gerrit/43832
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>

11 years agoCHROMIUM: dark resume: Make rtc_cmos part of kernel
Derek Basehore [Fri, 8 Feb 2013 05:26:32 +0000 (21:26 -0800)]
CHROMIUM: dark resume: Make rtc_cmos part of kernel

This change makes the rtc_cmos driver part of the kernel instead of a module.
This allows us to modify sysfs files for it (such as dark_resume_source) as part
of an upstart script. We need to change the owner of the dark_resume_source file
to power so powerd can enable the rtc cmos as a wake source.

BUG=chrome-os-partner:9812
TEST=check that rtc cmos is probed before user space starts.

Change-Id: Ie562fe78ade4f6b46ee1de970401435f52200fa4
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42926
Reviewed-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
11 years agoCHROMIUM: dark resume: Make usb devices not resume for dark resumes
Derek Basehore [Fri, 8 Feb 2013 05:22:06 +0000 (21:22 -0800)]
CHROMIUM: dark resume: Make usb devices not resume for dark resumes

This change checks if dark resume is activated for the usb device and if there
is a dark resume. If so, it returns immediately rather than resuming the usb
device. This allows us to prevent usb lights from flashing when we do a dark
resume.

BUG=chrome-os-partner:9812
TEST=suspend system, watch dark resumes

Change-Id: Ibbe347c9dbc54b2b5598ac25e846c132a0456b17
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42925
Reviewed-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
11 years agoCHROMIUM: dark resume: Add rtc-cmos wake source functionality
Derek Basehore [Fri, 8 Feb 2013 04:38:00 +0000 (20:38 -0800)]
CHROMIUM: dark resume: Add rtc-cmos wake source functionality

Add the proper callbacks and structs to rtc cmos such that user space can make
the rtc cmos a wake source for dark resume. The callback function checks a
register of the rtc cmos to see if an interrupt happened. Ideally this should
instead make an ACPI function call that checks what the wake source was and see
if that's the RTC, but we don't have that implemented yet.

BUG=chrome-os-partner:9812
TEST=suspend system, watch dark resumes

Change-Id: I2232b0247e0cf59394da7c530d9e63a6e70bbd17
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42924
Reviewed-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
11 years agoCHROMIUM: dark resume: Expose dark resume activation
Derek Basehore [Fri, 8 Feb 2013 04:34:20 +0000 (20:34 -0800)]
CHROMIUM: dark resume: Expose dark resume activation

Add a way for userspace to activate dark resume specifically for devices. This
will allow devices to specify to the kernel whether it should do something
different for a device (such as not come up at all) during a dark resume. This
allows drivers that run very different hardware to do something different based
on specific configurations for a machine.

BUG=chrome-os-partner:9812
TEST=suspend system, watch dark resumes happen

Change-Id: If2a6fab5500027d17347552b5a08b24d764aa946
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42923
Reviewed-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
11 years agoCHROMIUM: dark resume: Expose dark resume status to user space
Derek Basehore [Fri, 8 Feb 2013 04:27:46 +0000 (20:27 -0800)]
CHROMIUM: dark resume: Expose dark resume status to user space

Add sysfs file, /sys/power/dark_resume_state. This file can be queried to see if
a dark resume happened. If the value is 1, a dark resume happened. If 0, one did
not happen.

BUG=chrome-os-partner:9812
TEST=suspend system, watch dark resumes happen

Change-Id: Ie1b25ed1f5a3fee658e8014a098ba4ae23683f54
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42922
Reviewed-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
11 years agoCHROMIUM: dark resume: Add dark resume functionality
Derek Basehore [Fri, 8 Feb 2013 04:22:38 +0000 (20:22 -0800)]
CHROMIUM: dark resume: Add dark resume functionality

In drivers/base/power/main.c, create the concept of dark resume. This includes
checking for a dark resume before we resume devices and allowing devices to
query this state. It also adds creating wake sources that indicate if a dark
resume happened. If a device is in this list of devices, we ask it if it woke
the system up. If so, we count the system resume as a dark resume.

BUG=chrome-os-partner:9812
TEST=suspend system, watch dark resumes happen

Change-Id: I0c416c156759728284901f03e98f0c87933c9c9a
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42921
Reviewed-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
11 years agodrm/exynos: Move irq request after drm_dev assignment
Sean Paul [Tue, 26 Feb 2013 21:39:55 +0000 (16:39 -0500)]
drm/exynos: Move irq request after drm_dev assignment

There's a race between requesting the irq and dereferencing drm_dev in
the irq handler. Moving the request_irq until after drm_dev has been
assigned eliminates this race.

BUG=chrome-os-partner:17557
TEST=Builds, tested on snow

Change-Id: I8d29aad2c73cb70b24a693e768ffdb2752a48b57
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44087

11 years agoCHROMIUM: ALSA: hda/ca0132 - Toggle DAC format when starting a stream.
Chee Kin Cheong [Tue, 26 Feb 2013 18:12:27 +0000 (10:12 -0800)]
CHROMIUM: ALSA: hda/ca0132 - Toggle DAC format when starting a stream.

Sometimes the DAC format would be incorrect after resume even if the
register indicated it was correct. Add a toggle of the format to make
sure the DAC gets audio in the format it expects.

BUG=chrome-os-parnter:17740
TEST=overnight loopback test checking for audio while suspend/resuming
the codec.

Change-Id: Ib27c7cb2489ea1c2c864ed4c6bc4ff98e1142792
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44056
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
11 years agoCHROMIUM: rtc: Implement get_wake_irq for rtc-s3c
Simon Glass [Sun, 10 Feb 2013 03:41:11 +0000 (19:41 -0800)]
CHROMIUM: rtc: Implement get_wake_irq for rtc-s3c

Implement this method to provide the interrupt number for the chip.

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow
Tested with charger-manager with other changes. See that it can remain
suspended (i.e. returns to suspend automatically after each wake).

Change-Id: I3be10a73a1b0da5fd47d3b21aae37fb18a78bce4
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43021
Reviewed-by: Benson Leung <bleung@chromium.org>
11 years agoCHROMIUM: rtc: Implement get_wake_irq for rtc-max77686
Simon Glass [Sun, 10 Feb 2013 03:39:55 +0000 (19:39 -0800)]
CHROMIUM: rtc: Implement get_wake_irq for rtc-max77686

Implement this method to provide the interrupt number for the chip.

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow
Tested with charger-manager with other changes. See that it can remain
suspended (i.e. returns to suspend automatically after each wake).

Change-Id: Id6512d4110bddd5281e49bfe22e02449991c4507
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43020
Reviewed-by: Benson Leung <bleung@chromium.org>
11 years agoCHROMIUM: rtc: Add a method to obtain the wake interrupt number
Simon Glass [Sun, 10 Feb 2013 00:41:29 +0000 (16:41 -0800)]
CHROMIUM: rtc: Add a method to obtain the wake interrupt number

When an rtc wakes the system we need to find this out so that we can decide
whether to immediately suspend again, or to fully wake to user space. This
is required for drivers that want to monitor devices preiodically in suspend,
such as charger-manager.

Add a new rtc method which returns the IRQ used by an RTC. This IRQ number
can then be checked in the suspend_again handler, to see if it caused the
wake.

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow
Tested with charger-manager with other changes. See that it can remain
suspended (i.e. returns to suspend automatically after each wake).

Change-Id: I885aac2dfe15a3fb2c420857382224b98d475416
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43019
Reviewed-by: Benson Leung <bleung@chromium.org>
11 years agoCHROMIUM: charger-manager: Add a suspend count
Simon Glass [Sun, 3 Feb 2013 22:52:04 +0000 (14:52 -0800)]
CHROMIUM: charger-manager: Add a suspend count

Keep track of the number of times we have checked the battery while
in suspend. This is useful for checking that suspend_again() is doing
its job.

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow
Suspend the device, wait a minute and resume. See from the logs
(dmesg |tail -20) that the charger-manager suspend_again count is now
5 or 6, indicating that it was incrementing in suspend.
Change-Id: Ifcaf459e0acaef5b37b05b9f8d84584010fb0c95
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43018
Reviewed-by: Benson Leung <bleung@chromium.org>
11 years agoCHROMIUM: dts: spring: Enable TPS65090 regulators in device tree.
Todd Broch [Fri, 22 Feb 2013 22:24:19 +0000 (14:24 -0800)]
CHROMIUM: dts: spring: Enable TPS65090 regulators in device tree.

BUG=chrome-os-partner:17813
TEST=manual
1. compile, boot & login to system as root
2. See new regulators in sysfs
   cat /sys/devices/s3c2440-i2c.4/i2c-4/4-001e/cros_ec-tps65090.*/regulator/regulator.*/name

Signed-off-by: Todd Broch <tbroch@chromium.org>
Change-Id: Icf3e55f78d7d7081e303e91df92e3df25c922a31
Reviewed-on: https://gerrit.chromium.org/gerrit/43945
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
11 years agoCHROMIUM: config: exynos5: Enable cros_ec-tps65090 driver.
Todd Broch [Mon, 25 Feb 2013 22:30:00 +0000 (14:30 -0800)]
CHROMIUM: config: exynos5: Enable cros_ec-tps65090 driver.

BUG=chrome-os-partner:17813
TEST=compile kernel successfully see following object files created.
  drivers/regulator/cros_ec-tps65090.o

Signed-off-by: Todd Broch <tbroch@chromium.org>
Change-Id: Iea2b04152d51ca74e81da3a1051281df7b913a91
Reviewed-on: https://gerrit.chromium.org/gerrit/43970
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
11 years agoCHROMIUM: regulator: chromeos_ec: control for TPS65090 FETS.
Todd Broch [Fri, 15 Feb 2013 19:04:32 +0000 (11:04 -0800)]
CHROMIUM: regulator: chromeos_ec: control for TPS65090 FETS.

On spring, the TPS65090 is behind the EC on its host i2c interface.
This CL creates a driver to control those FETS via the EC's MKBP
interface.

BUG=chrome-os-partner:17813
TEST=manual,
1. compile & boot kernel (w/ hacked config)
2. See driver under sysfs
   ls /sys/bus/platform/drivers/cros_ec-tps65090

Change-Id: I89082de44e3fa6ccce09b70bf3b191906f858dc1
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43548
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
11 years agoCHROMIUM: charger-manager: Make psy_name_buf a pointer
Simon Glass [Sun, 3 Feb 2013 22:49:17 +0000 (14:49 -0800)]
CHROMIUM: charger-manager: Make psy_name_buf a pointer

There doesn't seem to be any reason to use a buffer here, when a pointer
can be used. This avoids copying, a buffer, and the size limit.

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow
See that the battery is still found and accessed correctly by
charger-manager.
Change-Id: Iff78dfc4be112c68b95850ac5687fa335ce103ed
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43017
Reviewed-by: Benson Leung <bleung@chromium.org>
11 years agoCHROMIUM: charger-manager: Move temperature thresholds to pdata
Simon Glass [Sun, 3 Feb 2013 22:45:00 +0000 (14:45 -0800)]
CHROMIUM: charger-manager: Move temperature thresholds to pdata

Rather than require a function to handle temperature thresholds,
specify the thresholds so that charger-manager can do the right thing
automatically. This is is easier for clients to use, and more
device-tree-friendly

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow
See that charger-manager works as before. There is currently no test
for temperature thresholds, so I manually printed them out after a
later change to see that they are correct.
Change-Id: Ide0efff77c3c4e7bd468abf9df3b80884014e28d
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43016
Reviewed-by: Benson Leung <bleung@chromium.org>
11 years agoexynos: i2c: Correct suspend/resume GPIO request/free
Simon Glass [Sun, 3 Feb 2013 22:32:03 +0000 (14:32 -0800)]
exynos: i2c: Correct suspend/resume GPIO request/free

The gpio_request() is done in the resume handler, but the gpio_free()
is done in the suspend_noirq() handler. These do not match.

Where the system comes up partially from suspend and then goes back to
sleep (via the suspend_again handler), the suspend_noirq() handler
is called but the resume handler is not. This means that we free
the GPIOs but do not request them again, and thus we end up freeing
them again on each suspend_again.

Correct this by putting the gpio_free() into the suspend() handler
instead of suspend_noirq(). The effect is the same, for a full
suspend/resume cycle

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow
Suspend and resume and see that the i2c bus resumes correctly.
Using charger-manager, take the device through several suspend_again
cycles and see that warnings about multiple gpio_free() calls are
no longer present in the logs.
Change-Id: If11f02675d948959d81fbc5cf05cbb38605b4791
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43015
Reviewed-by: Doug Anderson <dianders@chromium.org>
11 years agoCHROMIUM: power: Allow a power supply to be located by device node
Simon Glass [Sun, 3 Feb 2013 22:19:36 +0000 (14:19 -0800)]
CHROMIUM: power: Allow a power supply to be located by device node

Power supply naming depends on the attached bus and device. For example
an SBS device might have a name like sbs-004-1b, where the characters after
"sbs" come from the i2c bus to which the battery is attached.

This is not really suitable for device tree operation. We want to use a
phandle to point to the power supply, rather than hard-coded knowledge of
what linux might decide to name it.

Add a function to permit a power supply to be located by device node, which
is easy to discover from a phandle.

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow
See that charger-manager can locate the sbs battery correctly now when
using the device tree.

Change-Id: I0c906469e84406879285669c44f00224eee30136
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43014
Reviewed-by: Benson Leung <bleung@chromium.org>
11 years agoCHROMIUM: rtc: Allow opening rtc by OF node
Simon Glass [Sun, 3 Feb 2013 22:10:34 +0000 (14:10 -0800)]
CHROMIUM: rtc: Allow opening rtc by OF node

This new function allows a device tree phandle to be used to locate an rtc
class device. The name (rtc0, rtc1) depends on the device init order, which
means it cannot be used within the device tree.

BUG=chrome-os-partner:10617
TEST=build and boot to kernel prompt on snow
Using charger-manager, select either rtc0 or rtc1 as the rtc to use for
the timer alarms, and see that charger-manager wakes up and behaves
correctly in suspend_again() in each case.

Change-Id: Ia6206b26cd74297f16b8e68caf97b6f390f4a7c5
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43013
Reviewed-by: Benson Leung <bleung@chromium.org>
11 years agoCHROMIUM: atkbd: Enable wake events
Benson Leung [Fri, 15 Feb 2013 23:57:05 +0000 (15:57 -0800)]
CHROMIUM: atkbd: Enable wake events

Init wakeup on the atkbd so that keyboard activity increments
/sys/power/wakeup_count.

Signed-off-by: Benson Leung <bleung@chromium.org>
BUG=chromium-os:38844
TEST=cat /sys/power/wakeup_count
Press a key on the keyboard
cat /sys/power/wakeup_count
See that the number has incremented in response.

Change-Id: I74869db3a8d88400990433186e0acdb541d58162
Reviewed-on: https://gerrit.chromium.org/gerrit/43938
Reviewed-by: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Benson Leung <bleung@chromium.org>

11 years agodrm/exynos: Split crtc from encoder
Sean Paul [Thu, 21 Feb 2013 18:36:33 +0000 (13:36 -0500)]
drm/exynos: Split crtc from encoder

This patch removes all calls from exynos_crtc directly into
exynos_encoder and instead relies on drm to do the right thing (which it
does).

BUG=None
TEST=Tested on snow, hotplug/suspend/resume/idle on & off

Change-Id: Iddb907c3a028afe0e9155ef2a0b78aec8612d784
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43518

11 years agodrm/exynos: Don't reset mixer on win_disable
Sean Paul [Tue, 19 Feb 2013 17:49:43 +0000 (12:49 -0500)]
drm/exynos: Don't reset mixer on win_disable

This patch removes code which resets the mixer on win_disable of the
default overlay. The effect of this code is that it disables interrupts,
and resets all mixer registers to power-on-reset values, then
re-enables interrupts. The code was introduced in the S2R patch, it
probably hacked around a bug, but it's not needed any longer.

BUG=None
TEST=on snow; powerd_suspend/idle off/idle suspend/hotplug/multiple boots

Change-Id: Id65650c7ab7a4cbc508a2087d4354b780acdce1a
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43517
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
11 years agoCHROMIUM: sock_diag: Fix out-of-bounds access to sock_diag_handlers[]
Mathias Krause [Sat, 23 Feb 2013 18:29:07 +0000 (10:29 -0800)]
CHROMIUM: sock_diag: Fix out-of-bounds access to sock_diag_handlers[]

Userland can send a netlink message requesting SOCK_DIAG_BY_FAMILY
with a family greater or equal then AF_MAX -- the array size of
sock_diag_handlers[]. The current code does not test for this
condition therefore is vulnerable to an out-of-bound access opening
doors for a privilege escalation.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Acked-by: Eric Dumazet <edumazet@google.com>
BUG=chromium-os:39185
TEST=link build, exploit PoC fails

Change-Id: I6f924e8849f60e1a98cdc16cbcb8d4ef5ce611e1
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43867
Reviewed-by: Olof Johansson <olofj@chromium.org>
11 years agoCHROMIUM: i2c: wire the smart battery passthrough
Vincent Palatin [Wed, 20 Feb 2013 16:33:27 +0000 (08:33 -0800)]
CHROMIUM: i2c: wire the smart battery passthrough

On Spring, the smart battery is behind the EC.
We are connecting the regular SBS I2C driver and translating i2c
messages for the smart battery to the matching EC commands.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:17812
TEST=on Spring, read the battery status by using "power-supply-info"
command.

Change-Id: I4d1353d740201935e1bb9566a08f1a81b0262232
Reviewed-on: https://gerrit.chromium.org/gerrit/43610
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
11 years agoCHROMIUM: mfd: chromeos_ec: instantiate sub-devices from device tree
Vincent Palatin [Fri, 22 Feb 2013 00:58:44 +0000 (16:58 -0800)]
CHROMIUM: mfd: chromeos_ec: instantiate sub-devices from device tree

If the EC device tree node has sub-nodes, try to instantiate them as MFD
sub-devices.
We can configure the EC features provided by the board.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:17812
TEST=on Spring, check that flashrom is working to re-flash the EC
firmware.

Change-Id: Ib1501eb3408cc13acb05073928ee958cd94f9107
Reviewed-on: https://gerrit.chromium.org/gerrit/43783
Reviewed-by: Todd Broch <tbroch@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>

11 years agoCHROMIUM: exynos: dts: EC related configuration is per board
Vincent Palatin [Wed, 30 Jan 2013 18:45:37 +0000 (10:45 -0800)]
CHROMIUM: exynos: dts: EC related configuration is per board

Move the Smart Battery configuration to board-specific files.
On Daisy and Snow, the Smart Battery is on the same as the EC,
on Spring, it is behind the EC.

Declare board dependant EC sub-devices as children of the EC node.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:17812
TEST=on both Snow and Spring, check that "power-supply-info" returns
acceptable values.

Change-Id: I290e5e8f3591df29a20734e9eff7eb6e03f4a1ec
Reviewed-on: https://gerrit.chromium.org/gerrit/43609
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>

11 years agoCHROMIUM: drm/exynos: dp: configure GPIO for eDP hotplug detection
Vincent Palatin [Tue, 19 Feb 2013 20:47:30 +0000 (12:47 -0800)]
CHROMIUM: drm/exynos: dp: configure GPIO for eDP hotplug detection

the HPD line from the Parade eDP/LVDS bridge is used to trigger the
display controller initialization. Let's configure it as a proper
interrupt line to allow the Exynos display port controller driver to use
it.
The current Exynos needs special hackery to plug an interrupt on a
random GPIO.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:17228
TEST=on Spring, boot and see the counter of the HPD interrupt from
the eDP bridge incrementing.

Change-Id: I15c612fe57c0dab98e18c58e1ef092fd8e103a92
Reviewed-on: https://gerrit.chromium.org/gerrit/43535
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
11 years agoCHROMIUM: arm: s5p: fix section mismatch for gpioint
Vincent Palatin [Fri, 22 Feb 2013 17:01:33 +0000 (09:01 -0800)]
CHROMIUM: arm: s5p: fix section mismatch for gpioint

The gpioint irq creation might be called from hotpluggable devices,
so it needs to be marked as __devinit (and as nothing in the future).

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:12625
TEST=emerge-daisy_spring chromeos-kernel with
"CONFIG_DEBUG_SECTION_MISMATCH=y" and do not see any warning.

Change-Id: Ibc0880c90a4002063fd95e752e3fe417455afd22
Reviewed-on: https://gerrit.chromium.org/gerrit/43786
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>

11 years agoCHROMIUM: arm: s5p: add suspend/resume support to GPIO interrupts
Vincent Palatin [Thu, 21 Feb 2013 16:08:07 +0000 (08:08 -0800)]
CHROMIUM: arm: s5p: add suspend/resume support to GPIO interrupts

We need to restore the GPIO external interrupt configuration and mask
registers after resume as the hardware has lost those registers content.
We just use the cache maintained by the generic-irq layer.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:12625
TEST=manually check the EXTINT registers content before and after a
suspend/resume cycle, and no longer see an interrupt storm after
resuming.

Change-Id: I950362c8d2c7126f5a10502b414cee2d12d2cd4d
Reviewed-on: https://gerrit.chromium.org/gerrit/43726
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>

11 years agoCHROMIUM: bluetooth/usb: hack to cover up dma after free corruption
Sonny Rao [Thu, 21 Feb 2013 01:45:06 +0000 (17:45 -0800)]
CHROMIUM: bluetooth/usb: hack to cover up dma after free corruption

This is a horrible, gross hack to cover up the fact that we
sometimes get an apparent DMA from the interrupt endpoint on the
bluetooth module after shutting it down.  This ends up manifesting as
random kernel crashes, often from other users of kmalloc-16.

Since we don't have root cause (yet?) and can't do much about it, put
in this band-aid which will leak around 64 bytes of memory every time we
suspend/resume a usb bluetooth device.  We make no attempt to free
this memory because we don't know when the DMA could come in and it's
a relatively small amount so probably not worth trying to free it
later.

Another issue is that SLUB will mix together objects from different
slabs if they are all the same size.  So, in order to get a separate
slab in /proc/slabinfo, we turn on some of the slab debugging options.
The main reason for doing this is to let us track how much memory got
leaked through slabinfo.  This will trigger a BUG_ON() in
kmem_cache_create() if the kernel is compiled with
CONFIG_SLAB && !CONFIG_DEBUG_SLAB.

One day, when we have a real fix, we should remove this abomination.

Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
BUG=chrome-os-partner:12507
BUG=chrome-os-partner:17614
TEST=repeated suspend resume, should not see a kernel crash

Change-Id: Iebdfe033d178c664a91fce1164b255aa1c322ad0
Reviewed-on: https://gerrit.chromium.org/gerrit/43682
Commit-Queue: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Tested-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
11 years agoCHROMIUM: gpio: samsung: add support for interrupts on Exynos5 GPIOs
Vincent Palatin [Sat, 16 Feb 2013 01:11:25 +0000 (17:11 -0800)]
CHROMIUM: gpio: samsung: add support for interrupts on Exynos5 GPIOs

Add support for interrupts on all bank A and B GPIOs on Exynos 5,
in addition of the current XEINT pins.

Re-use the current Exynos4 / s5p code to minizime this CL overhead as we
probably won't use more that a couple of those interrupts but it's not
optimal in term of performance and it requires to do an explicit
5p_register_gpio_interrupt in the platform code for each GPIO used as an
interrupt.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:17228 chrome-os-partner:12625
TEST=on Spring, boot and see the counter of the HPD interrupt from the
eDP bridge incrementing.

Change-Id: I60bbe8e96d4028393f82e5717fdfa9ca19eb0773
Reviewed-on: https://gerrit.chromium.org/gerrit/43533
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>

11 years agodrm/exynos: Remove crtc->disable
Sean Paul [Thu, 21 Feb 2013 18:35:49 +0000 (13:35 -0500)]
drm/exynos: Remove crtc->disable

Remove the crtc->disable callback since it's not needed and most likely
incorrect anyways. DRM will fall back to dpms if disable is not defined,
and that will simplify the various paths we have. Furthermore, all
disable did was disable the default overlay on the crtc, which is not
the intended result.

BUG=None
TEST=Tested on snow with boot/hotplug/suspend/idle

Change-Id: I2b134662bfa56d35a0de9fbf761d7a8a3708009e
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43725

11 years agodrm/exynos: Don't win_disable if mixer is off
Sean Paul [Thu, 21 Feb 2013 18:18:03 +0000 (13:18 -0500)]
drm/exynos: Don't win_disable if mixer is off

The win_disable function shouldn't be called when the mixer is off. This
also prevents us from waiting for a vsync that will never happen (occurs
twice on boot, adding 2 seconds to the boot time).

BUG=None
TEST=Tested on snow, verified no regressions

Change-Id: I59e0df06336bbd28440cddf814b233e0027637c2
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43724