UPSTREAM: USB: misc: usb3503: add dt support

Added device tree support for usb3503 driver and add new document with
device tree binding information.

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit eab8050c0168ab6595e9ac6bc72a14d27390ea7a)
Cherry picked from upstream's torvalds/linux.git/master

BUG=chrome-os-partner:19875
TEST=see later patch

Signed-off-by: Julius Werner <jwerner@chromium.org>

Change-Id: Ia1a6fb1042fc48c5df56e7bcde3df68af5d11d9e
Reviewed-on: https://gerrit.chromium.org/gerrit/57155
Commit-Queue: Julius Werner <jwerner@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: Julius Werner <jwerner@chromium.org>
UPSTREAM: Introduce THERMAL_TREND_RAISE_FULL and THERMAL_TREND_DROP_FULL

These two new thermal_trend types are used to tell the governor
that the temeprature is raising/dropping quickly.

Thermal cooling governors should handle this situation and make
proper decisions, e.g. set cooling state to upper/lower limit directly
instead of one step each time.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
(cherry picked from commit d069015e268bcac6c8bd8997b3235f5f977d3ab6)

Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
BUG=chromium:221027
TEST=none (needs rest of series to land before bug is fixed)

Change-Id: Iff7839709b05a8ddab550f0345635036b3049e27
Reviewed-on: https://gerrit.chromium.org/gerrit/57091
Tested-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Commit-Queue: Sonny Rao <sonnyrao@chromium.org>
UPSTREAM: Introduce THERMAL_TREND_RAISE/DROP_FULL support for step_wise governor

step_wise governor should set the device cooling state to
upper/lower limit directly when THERMAL_TREND_RAISE/DROP_FULL.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
(cherry picked from commit 3dbfff3dfe6714aeefb615c65bec0800dc5a4c51)

Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
BUG=chromium:221027
TEST=none (needs rest of series to land before bug is fixed)

Change-Id: I457412fca3f6661f7e354bf17545353f570edcbf
Reviewed-on: https://gerrit.chromium.org/gerrit/57092
Tested-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Commit-Queue: Sonny Rao <sonnyrao@chromium.org>
UPSTREAM: step_wise: Unify the code for both throttle and dethrottle

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
(cherry picked from commit b8bb6cb999858043489c1ddef08eed2127559169)

Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
BUG=chromium:221027
TEST=none (needs rest of series to land before bug is fixed)

Change-Id: Ib0bff98995bddfd1893d488a25f6a9af0cd37e18
Reviewed-on: https://gerrit.chromium.org/gerrit/57093
Tested-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Commit-Queue: Sonny Rao <sonnyrao@chromium.org>
UPSTREAM: ACPI / thermal: do not always return THERMAL_TREND_RAISING for active trip points

Commit 4ae46be "Thermal: Introduce thermal_zone_trip_update()"
introduced a regression causing the fan to be always on even when
the system is idle.

My original idea in that commit is that:
 - when the current temperature is above the trip point,
   keep the fan on, even if the temperature is dropping.
 - when the current temperature is below the trip point,
   turn on the fan when the temperature is raising,
   turn off the fan when the temperature is dropping.

But this is what the code actually does:
 - when the current temperature is above the trip point,
   the fan keeps on.
 - when the current temperature is below the trip point,
   the fan is always on because thermal_get_trend()
   in driver/acpi/thermal.c returns THERMAL_TREND_RAISING.
Thus the fan keeps running even if the system is idle.

Fix this in drivers/acpi/thermal.c.

[rjw: Changelog]
References: https://bugzilla.kernel.org/show_bug.cgi?id=56591
References: https://bugzilla.kernel.org/show_bug.cgi?id=56601
References: https://bugzilla.kernel.org/show_bug.cgi?id=50041#c45
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Matthias <morpheusxyz123@yahoo.de>
Tested-by: Ville Syrjälä <syrjala@sci.fi>
Cc: 3.7+ <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 94a409319561ec1847fd9bf996a2d5843ad00932)

Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
BUG=chromium:221027
TEST=suspend/resume and make sure fans quiet down eventually after resume

Change-Id: I8456cb3b41455eee91783f4242bc9adce2aae88a
Reviewed-on: https://gerrit.chromium.org/gerrit/57094
Tested-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Commit-Queue: Sonny Rao <sonnyrao@chromium.org>
arm: exynos5420: dt: Corrects lcd htiming values for 60Hz vsync

Changing left_margin and hsync_len values in order to get 60Hz
vblank rate.

BUG=None
TEST=vbltest
output changes from 58.04Hz to 59.92Hz

Change-Id: I01abc1a5c1c6b704ff6f3e5c7d84cafebe2822ed
Signed-off-by: Akshu Agrawal <akshu.a@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/57038
Reviewed-by: ajaykumar <ajaykumar.rs@samsung.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Akshu Agrawal <akshu@chromium.org>
Commit-Queue: Akshu Agrawal <akshu@chromium.org>
sound: soc: exynos: Don't set jack_cb until jack is initialized

This patch defers setting the jack_cb function until the jack has been
initialized. This avoids a race where jack_report will try to lock the
jack's mutex before it has been initialized.

BUG=None
TEST=Boot snow with HDMI attached, no crashes

Change-Id: If47783c5809ac8a43d0fd952f1ffde1763aa4198
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57146
CHROMIUM: Input: atmel_mxt_ts - Use mxt_obj_size(object) instead of object->size

mxt_obj_size(object) has the real size of the object which is
object->size + 1. And the same for using mxt_obj_instances(object)
instead of object->instance.

Signed-off-by: Yufeng Shen <miletus@chromium.org>

BUG=None.
TEST=device config update now succeeds.

Change-Id: I22a5908d7733500589678191a3f279e806210a84
Reviewed-on: https://gerrit.chromium.org/gerrit/57259
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Yufeng Shen <miletus@chromium.org>
Commit-Queue: Yufeng Shen <miletus@chromium.org>
clk: exynos: Adjust EPLL settings for 49152000 to 49, 3, 3, 9962

There is an issue where the audio code doesn't deal well when we use
(49, 3, 3, 9961).  It's believed that this issue has to do with the
fact that the clk_get_rate() when we use 9961 is just under the
required frequency and code doesn't like that.  Specifically:
  49, 3, 3, 9961 = 49151992 Hz
  49, 3, 3, 9962 = 49152008 Hz

Long term it would be nice to evaluate the code to make it more
robust, but for now let's fix the bug.  See http://crosbug.com/p/19879
for cleaning up the table anyway.

BUG=chrome-os-partner:19772
BUG=chrome-os-partner:19578
TEST=Boot up and play 48 kHz audio

Change-Id: Ife09d9741c163159a4d4349f99a3318192d68420
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57330
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: config: use ext4 for ext2/ext3 mounting

The ext4 fs has grown an option to transparently handle mount requests
for ext2 and ext3 filesystems.  This means we can disable both the ext2
and ext3 drivers entirely.  No userspace changes are necessary as the
ext4 driver will register itself as the handler for all three.

This good for a few reasons:
 - upstream treats ext2/ext3 as dead code and all work (both features &
   optimizations) are going into ext4 only
 - Ted has stated that ext4 performs better than ext2/ext3 even when the
   fs itself isn't formatted as ext4
 - Google itself uses ext4 in its infrastructure (it moved away from ext2
   a few years ago) which means it's no longer validating ext2
 - the kernel .text shrinks by ~220k and .data by ~17.5k
 - our rootfs & stateful & encrypted partitions now share code paths, so
   less cache eviction due to both ext2 and ext4 being used (speculation)
 - less code for us to worry about securing :)

Now that we've branched R28, this is probably a good time to make the
switch so as to maximize coverage before the next branch.

BUG=chromium:239821
TEST=booted an alex
TEST=`cbuildbot {arm,amd64,x86}-generic-full` passes (vmtests)
TEST=`cbuildbot {lumpy,x86-alex,daisy}-release` passes (hwtests)
CQ-DEPEND=CL:50835

Change-Id: I7ceb27ab5108223d4dd16ce9631e3dd4ee705108
Signed-off-by: Mike Frysinger <vapier@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57021
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
UPSTREAM: USB: misc: usb3503: Fix compiler warning

This patch fixes the compiler warning of uninitialized variable.

drivers/usb/misc/usb3503.c: In function ‘usb3503_probe’:
drivers/usb/misc/usb3503.c:215:13: warning: ‘mode’ may be used uninitialized
in this function [-Wuninitialized]

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 8ab03dd48a549f140597a55a1564083b171d1349)
Cherry picked from upstream's torvalds/linux.git/master

BUG=chrome-os-partner:19875
TEST=see later patch

Signed-off-by: Julius Werner <jwerner@chromium.org>

Change-Id: Ia1baae53417fb3646aebf14aaa47f59dbccac871
Reviewed-on: https://gerrit.chromium.org/gerrit/57156
Commit-Queue: Julius Werner <jwerner@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: Julius Werner <jwerner@chromium.org>
UPSTREAM: USB: misc: usb3503: use module_i2c_driver to simplify the code

Use the module_i2c_driver() macro to make the code smaller
and a bit simpler.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 8244ac043c5334012006d542d1cd5c1e3fe2f32a)
Cherry picked from upstream's torvalds/linux.git/master

BUG=chrome-os-partner:19875
TEST=see later patch

Signed-off-by: Julius Werner <jwerner@chromium.org>

Change-Id: Ib487ccf92b1f2f9bb5452d4cedcbb54fbeb46633
Reviewed-on: https://gerrit.chromium.org/gerrit/57157
Commit-Queue: Julius Werner <jwerner@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: Julius Werner <jwerner@chromium.org>
UPSTREAM: usb: misc: usb3503: Add to select the ports to disable

This patch is to disable the USB ports unconnected to USB3503. In order to
disable the port, 'port_off_mask' must be set.

* Disable PORT1 only
	.port_off_mask = USB3503_OFF_PORT1;

* Disable PORT1 and PORT3 only
	.port_off_mask = USB3503_OFF_PORT1 | USB3503_OFF_PORT3;

* Enables all ports
	.port_off_mask = 0;

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
(cherry picked from commit e8e44a4896a5f0bde1af36a31b7ec662bdaa44ef)
Cherry picked from upstream's gregkh/usb.git/usb-next

BUG=chrome-os-partner:19875
TEST=see later patch

Change-Id: I0d108e669f3c69d1903961bdd8b707cc9e726139
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57358
Reviewed-by: Simon Glass <sjg@chromium.org>
UPSTREAM: usb: misc: usb3503: Adding device tree entry 'disabled-ports'

This patch is to add a property 'disabled-ports' representing the unused port
of USB3503. USB3503 can support up to 3 USB host port and each ports can be
controlled to be enabled or disabled. Do not describe this property if all
ports must be enabled.

You can represent the ports to disable in the device tree.

	usb3503@08{
		...
		disabled-ports = <2 3>;
		...
	};

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
(cherry picked from commit e8b58b49130f40c29bb95cd5d9b36955ff703822)
Cherry picked from upstream's gregkh/usb.git/usb-next

BUG=chrome-os-partner:19875
TEST=see later patch

Change-Id: Ia1f160f821c5403e8cab68a300de1253269ae3a9
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57359
Reviewed-by: Simon Glass <sjg@chromium.org>
UPSTREAM: usb: misc: usb3503: Fix up whitespace

Remove an erroneous tab that should be a space.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ccf92c94135059c2fa7ee67bbd19af5103547510)
Cherry picked from upstream's gregkh/usb.git/usb-next

BUG=chrome-os-partner:19875
TEST=see later patch

Change-Id: I18b2adec45bd866b6a6c62ddb688e55557265d17
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57158
Reviewed-by: Simon Glass <sjg@chromium.org>
UPSTREAM: usb: misc: usb3503: Remove 100ms sleep on reset, conform to data sheet

The usb3503 driver sleeps a flat 100ms when resetting the chip, with a
comment about waiting for the reference clock. This seems to be a
board-specific detail that should not hold up boot across all platforms.
This patch reduces the sleep to the 4ms initialization delay that the
chip itself actually requires (as per its data sheet). If certain boards
require more time to set up the reference clock, they should change this
through local patches or with a proper, configurable synchronization
mechanism.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 06a962fa7f9bf068eb1238d7aa20453b9e11a9fd)
Cherry picked from upstream's gregkh/usb.git/usb-next

BUG=chrome-os-partner:19875
TEST=see later patch

Change-Id: I0f87673ebc39dc26cb14c377c96cc1be85ad0f99
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57267
Reviewed-by: Simon Glass <sjg@chromium.org>
CHROMIUM: config: Add new usb3503 driver to chromeos-exynos5

This patch adds the .config entries for the usb3503 driver pulled from
upstream. We only need it on Exynos5 devices for now, and it shouldn't
hurt to make it a module.

BUG=chrome-os-partner:19875
TEST=see later patch

Change-Id: I0852b9bcc6608bda1431a7059c95dfafd59c0914
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57159
Reviewed-by: Simon Glass <sjg@chromium.org>
CHROMIUM: dts: Add smsc,usb3503 to peach_pit device tree

This patch adds the device tree bindings for the new USB3503 HSIC hub
driver to Peach-Pit. It should probably go into the generic file
(instead of rev1), but that counts for most other things in there too,
so let's put it with the other I2C devices for now and wait for someone
to migrate them in bulk.

BUG=chrome-os-partner:19875
TEST=Boot pit rev1, run lsusb, make sure 0424:3503 and 0bda:0129 show up

Change-Id: Id24b80f7d0039e7263216ee20c6d4477eeee22ad
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57160
Reviewed-by: Simon Glass <sjg@chromium.org>
CHROMIUM: md: dm-bootcache, dm-verity, dm-verity-chromeps - support for PARTUUID

Added support for UUIDs that are labeled PARTUUID=%U[/PARTNTOFF=%d].
This is in preparation of converting to this format that
will let us delete the UUID code in these three device mappers.

BUG=chromium:224066
TEST=platform_CorruptRootfs with/without new format, bootcache on/off, verity on/off

Change-Id: I753ba957835479412fc59ff6454168915a9b3ce6
Signed-off-by: Paul Taysom <taysom@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51530
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56945
CHROMIUM: drivers/tty: Don't hangup shared ttys

When you run "restart ui", one X server quits while another one
starts. For a while, two X servers share the same tty, and when
the old X server eventually quits, the tty layer hangs up the
tty, which among other things stubs out the tty's ioctl
functions. Later on, the new X server (which shares the tty
functions) tries to call some ioctls on the tty and fails. This
in turn causes the new X server to abort.

Since tests tend to restart ui a lot, this problem causes tests
to fail pretty often.

This patch checks the tty->count to make sure we're the last
consumer before hanging up the tty.

BUG=chromium:243812
TEST=run restart ui a bunch of time, X server stops crashing
TEST=instrumented the kernel code to check that the tty hangs up properly once all X servers using it are gone

Change-Id: Ia9bd9d71c0389296fb27cc01d0d7b29f31b8a444
Reviewed-on: https://gerrit.chromium.org/gerrit/57290
Reviewed-by: Puneet Kumar <puneetster@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
Commit-Queue: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>