msm: acpuclock-8226: Support 998MHz and 1.2GHz rates

The higher end rates of 998MHz and 1.2 GHz have been
tested and validated. Update the frequency tables to
allow these frequencies to be used for scaling.

Change-Id: I4a98c8e6a72cdda33ef5378e80ff256385e29c2b
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
msm: pil-q6v5-mss: Make MSS regulator voting optional

On some chipsets, the modem is able to vote for its
own regulator and proxy voting takes care of the vote
during modem bootup. Make the regulator voting optional
in these cases.

Change-Id: I7a3dfc7dc41c823d574967981735d3bd80dd9410
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
arm/dt: msm8226/8610: Remove the vdd_mss-supply property

The vdd_mss-supply property is not required on the MSM8610
and MSM8226. This is because the modem is on the CX power
rail in these targets and is perfectly capable of voting
for CX on its own.

Change-Id: Ia2fe50b76856a3f27969fe2dcb31331defc5c563
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
USB: ci13xxx_udc: Don't wait infinitely in bus reset

The current code infinitely waits for all bits in PRIME register to be
cleared by the controller during bus reset.  In some error scenarios,
controller is not clearing PRIME register contents.  When this happens
the target crashes due to watchdog bark.  Convert this infinite loop
to finite loop.  Also convert controller reset loop to finite loop.

CRs-Fixed: 482867
Change-Id: I2e13ad8f53e8dbb2b9939dd13bf3ef8091d55058
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
msm: clock-8610: Add missing dummy clock for IOMMU

Add missing dummy clock for graphics IOMMU. This will allow
code to run in emulation environment.

Change-Id: Ie57137ddfdf4ea5d9bc7f93dfb681725ab79251c
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
arm/dt: iommu: Enable alt. core clock for IOMMU

Enable alternative core clock for graphics IOMMU.
Graphics IOMMU requires an extra clock to allow us to
access graphics IOMMU registers. Without this clock we
might end up with un-clocked access when accessing the
IOMMU registers.

Change-Id: I75a4eedeef062c48bca423fbaaee1176b771c4f1
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
msm: socinfo: Support additional MSM8974 IDs

Update the SoC ID mapping table to support additional
MSM8974 chip IDs.

Change-Id: I4c749dd86c414f87daeffaae8f330f651128e87e
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
msm: mdss: Comply with content protection requirement

Some contents are secure and cannot be displayed on non
secure displays. For example, wireless display can be
non secure and should not display some specific data.
Add a check to ensure protected data does not go to
unsecure wireless display and remains only on primary panel.

Change-Id: If83e21ed66833e648d5d7fad812da56eb5b259c1
CRs-Fixed: 477822
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
msm: kgsl: prevent race between mmap() and free on timestamp

When KGSL_MEMFLAGS_USE_CPU_MAP is set, we must check that the
address from get_unmapped_area() is not used as part of a
mapping that is present only in the GPU pagetable and not the
CPU pagetable. These mappings can occur because when a buffer
is freed on timestamp, the CPU mapping is destroyed immediately
but the GPU mapping is not destroyed until the GPU timestamp
has passed.

Because kgsl_mem_entry_detach_process() removed the rbtree
entry before removing the iommu mapping, there was a window
of time where kgsl thought the address was available even
though it was still present in the iommu pagetable. This
could cause the address to get assigned to a new buffer,
which would cause iommu_map_range() to fail since the old
mapping was still in the pagetable. Prevent this race by
removing the iommu mapping before removing the rbtree entry
tracking the address.

Change-Id: I8f42d6d97833293b55fcbc272d180564862cef8a
CRs-Fixed: 480222
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
thermal: msm8974-tsens: Fix 8x10 fuse masks

Fix fuse masks for point0 and point1 base that
are used for obtaining the base offsets for
one and two point calibration.

Change-Id: I33bc3ccb17b844509616a44f0146b7f8c93fb52b
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
arm/dt: msm8610: Enable TSENS to use calibration data

Remove using default slopes and offset for TSENS offset
calibration. Instead use the efuse calibration data to
compute the offset based on the calibration mode supported
by the HW. Also remove local initialization as TSENS HW
is initialized at boot.

Change-Id: I991f4de522250fac0c70697361b39f4e5ad3130a
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
msm_serial_hs: Register UART with BLSP BAM in satellite mode

Execution Environment(EE) enables BLSP BAM and does not allow apps
side to write to BAM CTRL registers any more.

Hence UART driver needs to register BLSP BAM in satellite mode using
SPS_BAM_MGR_DEVICE_REMOTE.

Change-Id: If628eb468893c3e488a5793f129a68bcf57bdf47
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
wcnss: Add support to download calibrated data

WCNSS Firmware needs raw NV data (settings & some register values),
to do the power-on calibration. Once firmware does the power-on
calibration; it can then re-use the calibrated data. And it need not
do the calibration again when the next time it boots. WCNSS sends this
calibrated data to Apps; and Apps saves this into a persistent area.
And in the subsequent bootup, Apps sends the calibrated data to WCNSS.

Add interfaces to read calibrated data; and also add inteface to write
calibrated data to platform driver.

Change-Id: Ic18d40150093024b10a53e28f8a423dd9d3846eb
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
msm: mdss: hdmi: pll settings for vesa formats

Add pll settings for VESA formats at pixel frequencies
of 65MHz and 108MHz. These pixel frequencies are
required to support VESA(DVI) video formats, in
particular, add support for 1024x768p and 1280x1024p
video formats. These formats are supported on many
existing monitors.

Change-Id: I5f8368d12a8dc5b13342e6ffc87a6545f8d2b179
CRs-Fixed: 438028
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
msm: ipa: fix unclocked IPA register access

Due to interrupt mitigation logic, IPA driver can access IPA
BAM registers after IPA clocks have been turned off. This
commit ensures IPA remains clocked till polling operation is
completed.

Change-Id: I7c2175f9f1c1fae02c1bbaffde92941ddfc66ea9
Signed-off-by: Ravi Gummadidala <rgummadi@codeaurora.org>
netlink: use kfree_rcu() in netlink_release()

On some suspend/resume operations involving wimax device, we have
noticed some intermittent memory corruptions in netlink code.

Stéphane Marchesin tracked this corruption in netlink_update_listeners()
and suggested a patch.

It appears netlink_release() should use kfree_rcu() instead of kfree()
for the listeners structure as it may be used by other cpus using RCU
protection.

netlink_release() must set to NULL the listeners pointer when
it is about to be freed.

Also have to protect netlink_update_listeners() and
netlink_has_listeners() if listeners is NULL.

Add a nl_deref_protected() lockdep helper to properly document which
locks protects us.

CRs-Fixed: 484684
Change-Id: I4d65f8787d33a5d220b08686887ef205337cd6c3
Reported-by: Jonathan Kliegman <kliegs@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Stéphane Marchesin <marcheu@google.com>
Cc: Sam Leffler <sleffler@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Git-commit: 6d772ac5578f711d1ce7b03535d1c95bffb21dff
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
msm: mdss: hdmi: add support for vesa formats

Add support for VESA formats at pixel frequencies
of 65MHz and 108MHz. These pixel frequencies are
required to support VESA(DVI) video formats, in
particular, add support for 1024x768p and 1280x1024p
video formats. These formats are supported on many
existing monitors.

CRs-Fixed: 438028
Change-Id: Ibe55648f32fface8ab310a431e9fb670085a86f7
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
power: qpnp-bms: fix rtc cleanup

Currently the BMS tries to close the rtc class if it fails to open.
However, when this happens, the open function returns NULL. Passing
a NULL to the rtc_class_close function crashes the kernel.

Fix this by doing nothing if the rtc class fails to open.

Change-Id: I30e7d7608b745815aaa8d5c43912e6a20b2eb6f7
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-bms: fix resume timing

Kernel time does not change during suspend. This causes BMS to have
issues where SoC upon resume can vary wildly from the SoC on suspend
because the kernel's 20 second workqueue does not kick in.

Fix this by canceling remaining SoC work upon suspend and rescheduling
them depending on how much time has passed upon resume.

CRs-Fixed: 480859
Change-Id: I9089873ca221354344a86cdff5014eb0b763d051
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-bms: do not pull SoC to 0 based on voltage

When the BMS driver was less accurate, a voltage based SOC clamp was
added in order to keep SoC from shutting down the device incorrectly
at higher voltages and from keeping the device on and going into UVLO
at lower voltages.

However, the ADC voltage reads can dip below cutoff momentarily due
to a faulty read or a large current spike. This can cause the SoC
to go to 0 unnaturally.

Fix this by removing the low end of the voltage clamp so SoC does not
get pulled to 0 and shutdown the device with current spikes.

Change-Id: I66ab467956aff755a0949cbf13249aa73a6c7135
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>