ASoC: wcd9xxx: Correct wrong check conditions

1) For targets where micbias is shared, we do not
use vddio to identify special headset. We want
micbias to be enabled always with any headset
inserted for such targets. Currently, if headset is
inserted during recording, we check for this vddio
flag as well. Since, it is null for the above mentioned
targets, we never touch the code to enable micbias
always for any type of headset.

2) Again for the above mentioned targets, if micbias
is enabled by voice call, and we insert the headset.
Now if headset is removed, we try force diable of
micbias. This results in Tx mute. The count to disable
micbias needs to be corrected.

Change-Id: I022a54578c47485ebf7eef27c405e31ea6395ecf
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
net: ipv6: Don't purge default router if accept_ra=2

Setting net.ipv6.conf.<interface>.accept_ra=2 causes the kernel
to accept RAs even when forwarding is enabled. However, enabling
forwarding purges all default routes on the system, breaking
connectivity until the next RA is received. Fix this by not
purging default routes on interfaces that have accept_ra=2.

Change-Id: Icda010467c030b11f2cc91fac8d1331b6e9fc370
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
CRs-Fixed: 646636
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
cpufreq: interactive: Initialize spinlocks

These were missing in commit 8fbac318173082918312d6a4ceacf63376797c52,
"cpufreq: interactive: Use frequency dependent per cpu timings".
qcom-cpufreq: Fix frequency table registration

CPUfreq device is the provider of CPU frequency table, and
it should always keep track of freq tables for every CPU itself.
cpufreq_frequency_get_table() is an API for frequency table user.
qcom-cpufreq should not use this API to obtain CPU freq table in
the init function. Otherwise, the following sequence will lead to init
failure.

Assume CPU 0 and 1 are under control of same policy and online. Say
policy->cpu is CPU 0.

1) Hot unplug CPU0
   update_policy_cpu() will transfer ownership of policy to CPU1
   cpufreq_frequency_table_update_policy_cpu() is called during
   the process to set CPU1's freq table to be the same as CPU0's freq
   table. CPU0's freq table is now NULL.
2) Hot unplug CPU1
   All CPUs in policy are now offline.
3) Hot plug in CPU0
   cpufreq_driver->init() is called for initialization. If this init
   function calls cpufreq_frequency_get_table() on CPU0, the result
   will be NULL.

Current qcom-cpufreq checks return value of cpufreq_frequency_get_table()
and returns an error in init.

Remove the usage of cpufreq_frequency_get_table() and fill in frequency
table for policy->cpu in msm_cpufreq_init().

Change-Id: I2d41af776938c31b4444c9f280a341dd1bed1548
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
msm: mdss: Remove additional clk refcnts in dual-dsi

When dual-dsi panel is attached to a device, both DSI controllers
are registered to mdss. But only one registration done notification
needs to be sent. Currently two notifications are sent and it leads
to an additional refcnt on mdp clocks which in turn prevents proper
suspend. Fix this by sending notification only once.

Change-Id: I29e3c92e9ab0cccd9314cc5428b4accc31b0d0d9
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
msm: mdss: Notify userspace of idle screen case

Expose two new sysfs nodes - idle_time and idle_notify - that
are used to notify userspace whenever the display is idle with
no screen updates. The idle_time node needs to be configured
with the duration in milliseconds to detect no screen updates.
The userspace app can poll on the idle_notify node to get
notifications of the idle state.

Change-Id: I7435a084ad2c928d952c5d106ff9ef92aaa385b9
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
msm: mdss: Add data check before pipes are programmed

Move the mdss_mdp_data_check call to image_setup instead
of src_addr_setup. Return a failure in image setup so
that the new parameters won't be programmed

Change-Id: Ib35b41eadf4cb50225866b7056670323cc8e8eac
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
msm: mdss: Program unpack pattern for pipes with solidfill

When a pipe is staged with a solidfill color, we need to also
program the correct unpack pattern for the color format. If the
unpack pattern is not specified, the corresponding color layer may
not be display correctly.

Change-Id: Ic52fe29235813faa788745dd72f82edaca2635f1
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
msm: mdss: Fix BWC width alignment

BWC src width is segmented into 16 aligned RAUs. The segmentation
into 16 RAUs needs to be rounded up for corner cases.

Change-Id: Idbf675d7adfb45cb28e6c456dd4fd7c7f41ea280
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: Edit MDP sysfs node text layout

Display kernel driver uses a sysfs node for outputting MDP capabilities.
This data needs to be written in a proper format. Editing the
current format to have a single keyword instead of spaces. Also,
using an "equal to" sign instead of colon.

Change-Id: I2d2b71f27194cc50bfe1b7395cc0910896f499f4
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
msm: mdss: Parse max bandwidth property from device tree

Maximum bandwidth on the AXI bus supported by MDSS is a hardware
capability that needs to be exposed to userspace process via
sysfs node for MDP composition decisions.

Change-Id: I60e74e96666ca97f21a9880f49a95c3264d01870
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: MISR based CRC validation

MISR allows a CRC to be generated from contents of a
particular hw block which can be used for validation.
Enable setup of misr and APIs to obtain CRC from hw blocks.

Change-Id: Ib07e31cba45d242922bd28b6b306220efece7b8d
Acked-by: Sachin Bhayare <sbhayare@qti.qualcomm.com>
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: mdss: Increase commit count for first kickoff

During panel unblank a kickoff is done to turn on the panel so that the
first update is not delayed. It is also used to give buffer to command
mode panel prior to enabling backlight prevent junk data from appearing.
In order to prevent release fence timeline from being signaled too
early we will increase the commit count. This allow next sync point
to be added to the appropriate point on timeline, instead of relying
on frame done being called before sync/commit calls.

Change-Id: I566f90b3013b59dedbe42bbb9fdf6fa37d65e779
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
msm: mdss: fb: null check mfd data

Add appropriate null check for mfd data structure
before accessing it's members. This prevents null
pointer accesses in the driver.

Change-Id: Id301d4a90c9a52049944c7e3b31aa1a34ad292d7
CRs-Fixed: 526286
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
qup_i2c: Handle scenario if runtime PM is disable

If  runtime PM is not supported, make sure
the I2C clock and GPIOs enabled at the start
of the transfer(RD/WR)
This is done by i2c_qup_pm_resume_runtime()

CRs-Fixed: 492194
Change-Id: Iaa901a0f0d0cd58318e3f6dd64e1db73c73b630f
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Signed-off-by: Sana Venkat Raju <c_vsana@codeaurora.org>
i2c_qup: Improve implementation of PM callbacks

Refactor PM callbacks and remove redundant variable.
Add support for configuration of clockcontrol event.
Now the clock's state may be set by pm calls (as before)
or by a transfer's begining and ending.
Runtime-PM is still used in autosuspend configuration for
expensive NoC voting/unvoting since that may go to remote
processor.

CRs-Fixed: 592435
Change-Id: I54f7c67f768336f66765a04006b4c8e4734ac277
Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Sana Venkat Raju <c_vsana@codeaurora.org>
i2c_qup: Fix for unhandled IRQ

I2C qup driver handle scenario where runtime
PM is not enabled and enables clocks explicitly.
But it checks runtime PM suspended state in ISR
routine before processing further which can lead to issue
of unhandled valid IRQ sometimes because I2C client
can initiate transaction very early after system
resume and runtime PM is not enabled.

Add atomic flag to synchronize between active transaction
request when clocks are enabled and ISR.

CRs-Fixed: 670480
Change-Id: I175bc29a7b5b6e713ab6ec28deb34b2b0d23fa8a
Signed-off-by: Sana Venkat Raju <c_vsana@codeaurora.org>
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
USB: android: Add support for USB UICC mass storage

USB UICC cards can support multiple partitions which can be
exposed to the host via USB mass storage function. The number
of partitions of UICC card may vary for each target. Hence
create a device tree property to accept the required luns.

CRs-Fixed: 639635
Change-Id: I5bf5e9acd9fed72adffe469b602ab2d431ccfa3e
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
USB: android: release spinlock before queuing work in android_setup

In android_setup we release spinlock after scheduling the work but there
is no need for holding the spinlock during the schedule_work call
is executed this can lead to spinlock timeouts in case where schedule
work takes more time.

So before scheduling work in android_setup we release spinlock to avoid
potential spinlock lockup or timeout.

CRs-Fixed: 661220
Change-Id: Ibf8ff7f07caf20edf9e646fdcef540fbc6441aec
Signed-off-by: Tarun Gupta <tarung@codeaurora.org>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: ChandanaKishori Chiluveru <cchilu@codeaurora.org>
usb: android: Skip the work when set_config arrives with same value twice

Some USB hosts may send SET_CONFIGURATION with same value twice.
The current code implementation processing the 2nd set_config and
schedules the work. The android_work() issues disconnect event to
userspace if SetConfiguration with non-zero value is sent twice.
The userspace applications may disconnect the USB and the device
doesn't connect to the host.

Fix this by avoiding the android_work for the second time SET_CONFIGURATION
request when it receives SetConfiguration request with same configuration
value twice from the host.

CRs-Fixed: 661220
Change-Id: Ic450315a9067b9b679b4936480d125e4e4b7cdf7
Signed-off-by: ChandanaKishori Chiluveru <cchilu@codeaurora.org>