power: qpnp-charger: reset unsettled flag upon insertion

There could be a potential race between USB removal and userspace
code setting the input current settled property. A state where
USB was removed but input current settled property is set was observed.

Fix this by resetting input current settled property while USB is
inserted as well as USB removed.

Moreover prevent setting of this flag when USB is not present.

CRs-Fixed: 708352
Change-Id: I45196ce5ab0f7ad2b0ccefd33ba9d707f10aea55
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
ASoC: msm-lsm-client: handle close gracefully

The listen pcm device could get closed abruptly due to userspace
application crash. In such cases, the device close will be invoked
abruptly. Handle this scenario gracefully by properly cleaning up the
driver before close.

Change-Id: Ie841f300400d547260da92383712a9aa0689d7a7
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
Merge "ASoC: msm-lsm-client: handle close gracefully"
ASoC: msm: qdspv2: Fix junk characters in session name

Initialize MVM session name array to zero to avoid junk
characters at the end.

Change-Id: I441e5dbeb4052c937bb99f9c4c96a91c410db553
CRs-fixed: 702741
Signed-off-by: Karthik Reddy Katta <a_katta@codeaurora.org>
msm: mdss: disable irq to enforce mutex within dsi_event_thread

Mdp spin lock is used in dsi_event_thread and in irq context.
Disable irq while holding spinlock to avoid context switching
into irq context and cause spinlock recursion

CRs-fixed: 652850
Change-Id: I4bd8cadb1f5d83acc7e866344b7585e7944e08ac
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
Merge "ASoC: msm: qdspv2: Fix junk characters in session name"
rtc: alarm: set power_on_alarm again when calling alarm_resume

The power_on alarm might be replaced or cleared during alarm
suspend and resume process.So restore the power_on alarm into RTC
during alarm resume.

Change-Id: I1eefb082f9dfbd78517f3da1cc60a989853555fd
Signed-off-by: Mao Jinlong <c_jmao@codeaurora.org>
msm: mdss: Avoid unclocked register access with dsi_event_thread

In the case when ESD status check fails with DSI ACK
errors, there is a chance of unclocked register access when
DSI_INTR_CTRL register is being set.

Change-Id: I629b4ec642a86369b6ed693bdc6f8b4260ec1f5d
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
Merge "msm: mdss: Avoid unclocked register access with dsi_event_thread"
Merge "power: qpnp-charger: reset unsettled flag upon insertion"
netlink: fix possible spoofing from non-root processes

Non-root user-space processes can send Netlink messages to other
processes that are well-known for being subscribed to Netlink
asynchronous notifications. This allows ilegitimate non-root
process to send forged messages to Netlink subscribers.

The userspace process usually verifies the legitimate origin in
two ways:

a) Socket credentials. If UID != 0, then the message comes from
   some ilegitimate process and the message needs to be dropped.

b) Netlink portID. In general, portID == 0 means that the origin
   of the messages comes from the kernel. Thus, discarding any
   message not coming from the kernel.

However, ctnetlink sets the portID in event messages that has
been triggered by some user-space process, eg. conntrack utility.
So other processes subscribed to ctnetlink events, eg. conntrackd,
know that the event was triggered by some user-space action.

Neither of the two ways to discard ilegitimate messages coming
from non-root processes can help for ctnetlink.

This patch adds capability validation in case that dst_pid is set
in netlink_sendmsg(). This approach is aggressive since existing
applications using any Netlink bus to deliver messages between
two user-space processes will break. Note that the exception is
NETLINK_USERSOCK, since it is reserved for netlink-to-netlink
userspace communication.

Still, if anyone wants that his Netlink bus allows netlink-to-netlink
userspace, then they can set NL_NONROOT_SEND. However, by default,
I don't think it makes sense to allow to use NETLINK_ROUTE to
communicate two processes that are sending no matter what information
that is not related to link/neighbouring/routing. They should be using
NETLINK_USERSOCK instead for that.

Change-Id: I6382c2ecf3dc9ada1f6b7298ebb8bd08453d3a28
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Merge "rtc: alarm: set power_on_alarm again when calling alarm_resume"
Merge "msm: mdss: disable irq to enforce mutex within dsi_event_thread"
Merge "netlink: fix possible spoofing from non-root processes"
power: qpnp-charger: double check BAT_THERM voltage in BTC_HOT irq

BTC_HOT interrupt might be triggered by glitches on BAT_THERM pin and
causes charging stopped unexpected.

Using VADC to sample the voltage on BAT_THERM pin when BTC_TEMP_OK
interrupt triggered and BAT_TEMP_STATUS is HOT.If HOT_THD is set to
35% of the VREF_BAT_THM, and the voltage sampled on BATT_THERM is higher
than HOT_THD, override BTC VCP_DET comparator and toggle HOT_THD setting
to 25% to take charging back immediately.

CRs-Fixed: 717778
Change-Id: I77081997bce91cbfbd8cf21af877ba67021792c5
Signed-off-by: Chunmei Cai <ccai@codeaurora.org>
Merge "power: qpnp-charger: double check BAT_THERM voltage in BTC_HOT irq"
power: qpnp-charger: Add VCHG_LOOP_DBC_BYPASS property

Add a property VCHG_LOOP_DBC_BYPASS in battery power supply. It is used
for enabling/disabling the buck VCHG_LOOP debouncer timer.

Change-Id: If3f1ecb56abe2319e9defb6ef03a83b972632ef4
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
ASoC: wcd9306: Update condition to disable HPH PA after impedance detection

For headsets with threshold on mic, the flag hph_pa_dac_state gets
cleared once they are re-inserted into headphone jack with hph pas
are still ON. This causes impedance detection to disable the PA after
impedance computations. This will result into audio mute. Avoid the
audio mute by updating the condition to disable PAs.

CRs-Fixed: 694315
Change-Id: Ib7ab495485a321333c1b8b211559adc7c164735c
Signed-off-by: Yeleswarapu Nagaradhesh <nagaradh@codeaurora.org>
Merge "power: qpnp-charger: Add VCHG_LOOP_DBC_BYPASS property"
Merge "ASoC: wcd9306: Update condition to disable HPH PA after impedance detection"