msm: mdss: hdmi: NUL-terminate spd data

NUL-terminate SPD Vendor name and SPD
Product description data stored in the
control structure of hdmi driver. This
avoids overflows in print messages and info
frames.

Change-Id: I0a0adcfad06625e4d7368d3c5cd0ec38f0e047d8
CRs-Fixed: 520148
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
radio: iris: Add the parameter to turn on/off sig blend

FM driver will always enable the sig blend feature, it will cause
FM seperation failure during lab test.So add this new parameter
to disable the feature by adb command to pass the test.

Change-Id: I187d4e5fff4aabfb994a905e174bb8ce941e2c16
Signed-off-by: Sheng Fang <fsheng@codeaurora.org>
ASoC: wcd9xxx: Disable RC oscillator after use

Currently RC oscillator is left enabled even after
its use when headset is inserted and then removed.
Disable RC oscillator after headset is removed during
clock block put.

Change-Id: Ic799be15f900b7261455e27c4e6b7b95c049f6e4
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
USB: phy-msm-usb: Enable USB Interrupt only if ASYNC IRQ is not present

Some USB controllers have different IRQ line to exit from
LPM. This is ASYNC IRQ. If this IRQ is present, we dont
need to enable or disable the USB interrupt during otg
suspend and resume respectively.

There is a new requirement for XO shutdown during idle.
To allow XO in idle CPU states. When CPU is idle, if an
irq is enabled and is not capable of waking up from xo,
the xo shutdown is aborted. Hence non-wakeup capable irq
must be disabled.

Change-Id: I3197a1b413a1bf849db3572442cc8dbc5f264b53
CRs-Fixed: 520531
Signed-off-by: Sujeet Kumar <ksujeet@codeaurora.org>
ARM: dts: apq: remove unnecessary configuration of pmic gpio 36

DragonBoard8074 does not use pmic gpio 36 so removing it.

Change-Id: I5bc6908cda40eb08831afb696fbb2567a462878a
Signed-off-by: Asaf Penso <apenso@codeaurora.org>
ARM: dts: Don't put SDHC1's vdd-io regulator in lpm for msm8610 CDP/MTP

The vdd-io regulator for eMMC powers the controller inside the eMMC
device. Setting this regulator to lpm mode when the device goes to sleep
might restrict the amount of power that the card can draw. This might
lead to undeterministic behavior and thereby put the card in bad state,
hence don't set this regulator to lpm.

Change-Id: Ia0f571673fbaa9e583e8f4c3cc079e7d2fa9bbdd
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
power: qpnp-charger: allow charging in host mode

If host mode is enabled, allow the BATFET to be closed
thus that a DC charger is still able to charge the battery.

Change-Id: I3f863db42b028fa51637d3eb02f0931a02311e27
CRs-Fixed: 495760
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
mdss: display: remove the pwm gpio request from edp backlight

There is no use of the pwm gpio inside the driver so cleaning up the code
and removing it from devicetree.

Change-Id: I72c038f3082aa6ed18ea9142de75faecc1e1e0fd
Signed-off-by: Asaf Penso <apenso@codeaurora.org>
mdss: display: making lpg channel and pwm period as optional

These properties need to be optional and used only when having an embedded
DP monitor, i.e. eDP.

When using the eDP driver with external DP monitor there is no need to
configure the fields for the external backlight since it is done by the
monitor itself.

Change-Id: If1010e99c82e276991f30055140118aba29b0ecd
Signed-off-by: Asaf Penso <apenso@codeaurora.org>
msm: kgsl: Use the right set of flags for issuing user commands

KGSL_CMD_FLAGS_EOF is both a valid command flag from the user and
a valid internal flag for the ringbuffer submit code.  This is
the only flag that can do this - the other internal flags either
have different meanings or aren't valid user flags.  Use an internal
register to store the command flags in adreno_ringbuffer_issueibcmds
so we don't accidently end up sending in the wrong control flags to the
ringbuffer code.

CRs-fixed: 546449
Change-Id: Ic0dedbadb9245002a60aa54cb51d35d98b9cb531
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
ASoC: msm: q6: check upper bounds when copy ac3 params

Although AC3 maximum param size is fixed, better check upper bounds
when copy user data. It might cause overflow, possibly cause memory
corruption.

Change-Id: I2f7cec8edd9e013de1433ea06480b963ec307196
Signed-off-by: Fred Oh <fred@codeaurora.org>
msm: kgsl: Don't use uninitialized values in hang detection

Under some circumstances some of the registers used for hang detection
are not defined (usually because the hardware doesn't support them).
The hang detect code properly skips those registers when reading the
hardware but the corresponding offsets in the destination array are
still compared to detect a hang.  Since the array was defined on the
stack and those particular members were never read from the hardware
the values could be non zero a real GPU hang could be missed.

Skip the undefined hang detect registers in all three for() loops
where the list of hang detect registers are used.

CRs-fixed: 540224
Change-Id: Ic0dedbad6e654e3a4e6db5468eac698e91e7f32b
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
timekeeping: Add missing update call in timekeeping_resume()

The leap second rework unearthed another issue of inconsistent data.

On timekeeping_resume() the timekeeper data is updated, but nothing
calls timekeeping_update(), so now the update code in the timer
interrupt sees stale values.

This has been the case before those changes, but then the timer
interrupt was using stale data as well so this went unnoticed for quite
some time.

Add the missing update call, so all the data is consistent everywhere.

CRs-fixed: 536881
Change-Id: I5f7d5219749a3f6330d074ef8866533ebda3bfca
Reported-by: Andreas Schwab <schwab@linux-m68k.org>
Reported-and-tested-by: "Rafael J. Wysocki" <rjw@sisk.pl>
Reported-and-tested-by: Martin Steigerwald <Martin@lichtvoll.de>
Cc: LKML <linux-kernel@vger.kernel.org>
Cc: Linux PM list <linux-pm@vger.kernel.org>
Cc: John Stultz <johnstul@us.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Git-commit: 3e997130bd2e8c6f5aaa49d6e3161d4d29b43ab0
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
timekeeping: utilize the suspend-nonstop clocksource to count suspended time

There are some new processors whose TSC clocksource won't stop during
suspend. Currently, after system resumes, kernel will use persistent
clock or RTC to compensate the sleep time, but with these nonstop
clocksources, we could skip the special compensation from external
sources, and just use current clocksource for time recounting.

This can solve some time drift bugs caused by some not-so-accurate or
error-prone RTC devices.

The current way to count suspended time is first try to use the persistent
clock, and then try the RTC if persistent clock can't be used. This
patch will change the trying order to:
	suspend-nonstop clocksource -> persistent clock -> RTC

When counting the sleep time with nonstop clocksource, use an accurate way
suggested by Jason Gunthorpe to cover very large delta cycles.

CRs-fixed: 536881
Change-Id: I59c21b1ce5ae81cebc8cf3e817d9b3f951302a3d
Signed-off-by: Feng Tang <feng.tang@intel.com>
[jstultz: Small optimization, avoiding re-reading the clocksource]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Git-commit: e445cf1c4257cc0238d72e4129eb4739f46fd3de)
[sboyd: Took tk and clock local variables]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
clocksource: arm_arch_timer: Use clocksource for suspend timekeeping

The ARM architected timers keep counting during suspend so we can
mark this clocksource with the CLOCK_SOURCE_SUSPEND_NONSTOP. This
flag will indicate that this clocksource can be used for
calculating suspend time and injecting sleep time into the
timekeeping core. This will usually be more accurate than using
an external RTC or architecture specific persistent clock.

CRs-fixed: 536881
Change-Id: I882bf19a87ceb642aa069bbf26802c66c96b4426
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
msm: pm-8x60: Fix suspend time tracking

Calls to sched_clock() after syscore devices have been suspend
will return the same value until the syscored devices are
resumed. Furthermore, the value won't jump forward to account for
the time left in suspend so we can't use it to calculate how much
time we spent in suspend.

We could expose the hardware directly to the pm code but it's
better to use generic interfaces. Move to using the timekeeping
APIs to determine how long we were in suspend. Unfortunately, we
can't use the timekeeping APIs this early in the resume path, so
we must read the current time of day before we suspend the
timekeeping core and after we resume the timekeeping core. Move
the calls to the suspend_late() and wake() callbacks so we can
properly read the amount of suspend time.

CRs-fixed: 536881
Change-Id: I3b47511afb75926e51e82fc83929f405404fbf07
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
cpufreq: ondemand: add input_boost interface

Currently Ondemand governor handles any input event
like touch by scaling the CPU frequency to maximum
available on the target.

This change adds a new sysfs interface "input_boost"
whereby the CPU will scale to this frequency on input events.
The value of this sysfs is user defined so input events
can now be handled by scaling the CPU to lower frequencies
than target max.

Change-Id: I5428fd8797c9984b17a66b01a44557f2160e8b68
Signed-off-by: Dilip Gudlur <dgudlur@codeaurora.org>
msm: audio: qdsp6v2: Zero the cfg stack var

Write zeroes into the stack variable cfg to ensure
no previously written stack data is sent to
user-space.

Change-Id: Ie571949e3613c9e5a916b23e1dc19605496d9dbf
CRs-Fixed: 551574
Signed-off-by: Kenneth Westfield <kwestfie@codeaurora.org>
ASoC: msm: Move ASM custom topology data out of Debugfs define

Move variables used for ASM custom topology out of
the debugfs define. ASM custom topology should be
enabled even when debugfs is not.

Change-Id: Ie16191c04d80981e48e11ddda71ccbe1ccbc18ca
CRs-fixed: 551711
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
ASoC: wcd9320: remove hard coded mad mic bias

Currently MICBIAS1 is hard coded as bias needs to be turned on
by MAD HW. Expose a control to user space to set MIC input needs
be used by MAD. Based on the mic, set the correct mic bias to be
used by MAD HW by scanning machine audio routes.

CRs-Fixed: 538266
Change-Id: Ib85be87e50554b9587f7bafb5b58333a88df6766
Signed-off-by: Kiran Kandi <kkandi@codeaurora.org>