power: pm8921-bms: fix the units of batt_temp for rbatt

The scaling factor tables has temperature in units of degree celcius.
The temperature passed to the get_rbatt function is in deci degree
celcius.

Convert the temperature to degree celcius before passing it to the
functions that read the scaling factor tables.

Change-Id: Iffb6a7c8d39ba7ececddadeb52913c3a19ee67bd
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
power: pm8921-bms: Add connector resistance

The current software does not take in to account the resistance
introduced because of the battery connectors and rsense. This
needs to be accounted for when the battery resistance is
calculated.

Change-Id: I0f2b440bae8168868b26f35c8ec59a21d4906f0f
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
power: pm8921-bms: account for capacitive drop

As the battery discharges, we need to account for the voltage drop across
capacitance in the battery. This voltage drop can be simulated using
a resistance in series with the battery such that it increases as state of
charge of the battery decreases.

Add parameter to account for this resistance in the profile tables.

Change-Id: Ic67b798ae8f480d8f42d9321e3847c4294bf7db3
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
msm_fb: display: Enable 32bpp framebuffer format.

Enable 32bpp framebuffer format for 7x27a and 8x25.

Change-Id: I38deabca45ea849710bd2edb2b6847c5309a0c9e
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
msm: clock-debug: Don't fail if measure clock is not found

We shouldn't return an error if the measurement clock cannot be
found because we don't support measurement on all targets. Just
return success all the time.

Change-Id: Ifb64b1edfd13627c8b756b2c2ec87f0898b1a248
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diag: Edit mask update algorithm

DIAG sends mask updates to peripherals over SMD control channel.
Such updates are sent when a peripehral boots up or any mask change
request is sent to target. Several automation failures were seen
with this mechanism. This change edits the mechanism in following
way:

1) Sometimes during automation, such updates are sent at a very high
 speed and hence SMD layer cannot process them at the same time. This
 change adds a delay in case of SMD write failure and re-tries. Such
 re-tries cannot be done indefinitley, as it risks QPST timeout.

2) The SMD channel is written to when any mask update is received and
 also if a peripheral comes up. Thus, there could be a race condition.
 Adding a spinlock to avoid corruption due to race conditions.

3) Changes the way F3 mask updates are stored in apps table. Earlier these
 masks were recorded as they are received. Now QXDM sends masks in an
 orderly fashion and thus the masks were recorded in a pre-determined
 manner. However, automation sends them in a random manner. This throws
 off mask table parsing logic on applications processor. This change
 creates the mask table at initialization time and updates them on
 receiving further updates. Thus, the mask table is always parsed in
 a known manner.

4) Some updates were done on a work queue earlier to avoid QPST timeouts.
 This has been re-written to prevent potential race conditions. It has
 been tested that QPST still does not timeout. Hence, this change safely
 cleans up the work functions as well.

5) Added some debug statements to enable faster debugs in future.

Change-Id: I516e4e30a5a12757615887f5dfedad600245c9a1
CRs-Fixed: 349347
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
gpu: ion: Add check for addr out of bounds

Add check for out of bounds condition when clients perform cache
operations on the System ION heap. Return error if client
tries to do a cache operation outside the valid range.

Also add check to make sure we don't dereference a null-pointer
when converting a page to its physical address.

Change-Id: Idacff0f36a9d872485e7e74ee1a355ec1e33fb2c
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
msm: 8064: Enable IRQF_ONESHOT for atmel touch driver

Disable interrupt while executing threaded IRQ handler.

Change-Id: I5089bcd4974dca34128f0de57bcff7555e5058f0
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
ASoC: WCD9310: remove dependency between DMIC's and Decimators.

The source of input signal(ADC or DMIC) needs to configured correctly
in CDC_TXn_MUX_CTL registers for correct operation of Decimators.
Currently for DMIC's, this configuration is done in DMIC DAPM widget
power up/down call back creating  dependency between DMIC number and
Decimator number (with current code, DMIC1 can send signal to only
DEC1, DMIC2 can send signal to only DEC2). Remove this dependency by
setting type of input signal when Decimator MUX input is set.

Change-Id: Ic084bb892d663dea51ca5a5a95c6bdba30453744
Signed-off-by: Kiran Kandi <kkandi@codeaurora.org>
mmc: msm_sdcc: adapt sdcc driver to new clock apis

Turning on/off a clock involves a lot of steps. Depending on the clock and
its state, the steps to turn it on/off might involve sending the request
to RPM, changing voltages, enabling the source PLLs, register writes, etc.
Some of these steps take a lot of time and the some of them are really
fast.

The current APIs (clk_enable/disable()) have the requirement that they be
callable from atomic context to allow clocks to be turned on in any
situation (IRQ handlers, inside spinlocks, etc).

While this allows for a very simple API for users of clocks, it has the
negative impact of forcing the clock driver to do the slow steps of
turning on/off a clock with spinlocks held and busy waiting for
them to finish.

By splitting, these steps into the 4 new APIs
(clk_prepare/clk_enable & clk_disable/clk_unprepare)
instead of the 2 current APIs, it allows the clock driver to perform
the slow steps with a mutex lock held and removes the need to busy
wait for the slow steps to finish.

clk_prepare - might sleep
clk_enable - can be called from atomic context
clk_unprepare - might sleep
clk_disable - can be called from atomic context
clk_set_rate - might sleep

This change ensures:
	1. The older clock APIs are replaced by the new
	   clock APIs.
	   clk_enable replaced by
		clk_prepare_enable
	   clk_disable replaced by
		clk_disable_unprepare
	2. No clock APIs are invoked in atomic context.

CRs-Fixed: 349546
Change-Id: Ibfa63e46809d64bfa8ea470aa1103d784619b1c7
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
mach: msm: move mpm.h under proper include path

Currently "mpm.h" file is located under arch/arm/mach-msm/ directory
and source code files using mpm functionality are also location under
same directory. But if any source code files located out side
arch/arm/mach-msm/ directory won't be able to add "mpm.h" file.

So this patch moves the "mpm.h" from arch/arm/mach-msm/ directory to
arch/arm/mach-msm/include/mach/ directory.

Change-Id: Ic9247a9fa9303cf5a653399458602cd316fdf9d9
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
mach: msm: fix stub definition of msm_mpm_* APIs

If CONFIG_MSM_MPM is not enabled, stub definition of msm_mpm_*
public APIs must be defined as "static inline" in mpm.h header
file.

Change-Id: Ia5066b798eeeb8116323fe9fb907aba4a9a4ff4e
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
USB: OTG: msm: Fix bug in wall charger disconnect detection

PHY retention and HV interrupts are not enabled while entering into low
power mode with wall charger connected.  But PHY is put into suspend mode.
If PMIC notifications are unavailable, enable asynchronous interrupt to
detect wall charger disconnection. If it is not enabled, no further
interrupts are triggered by PHY.

CRs-fixed: 352210
Change-Id: I107e1c91a29d65594a603a5651cd0bfe5b792bcc
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
msm: ipc_logging: Add IPC event logger module

Add a logging module to log any high frequency IPC events. This will
enable any IPC drivers like message routers, multiplexers etc. to log
debug and performance data.

Change-Id: Iaed7079d4402a18b241b9957301f69a45cefa77f
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Merge "ASoC: WCD9310: remove dependency between DMIC's and Decimators." into msm-3.0
Merge "mach: msm: fix stub definition of msm_mpm_* APIs" into msm-3.0
Merge changes Ic67b798a,I0f2b440b,Iffb6a7c8 into msm-3.0

* changes:
  power: pm8921-bms: account for capacitive drop
  power: pm8921-bms: Add connector resistance
  power: pm8921-bms: fix the units of batt_temp for rbatt
msm_fb: hdmi: Disable 1.1_FEATURE

Some displays support Enhanced Link Verfications(1.1_FEATURE)
which makes HDMI Tx to verify Pj on every 16th frame. Three
consecutive Pj mismatch will result in HDCP authentication
failure. If 1.1_FEATURE is supported(this can be detected by
reading BCAPS), it needs to be enabled by writing into AInfo
of display. Default is disbaled.
This change sets HDMI Tx core to disable 1.1_FEATURE by
default so that we don't see Pj mismatch error unless the
feature is enabled.

CRs-fixed: 348752
Change-Id: I996f60b852a7e867e8e13e700beecbac8190a59e
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
msm: ipc: Add SMD link to interface with Q6

This new SMD link will enable QMI/IPC Router communication between
APPs and Q6

Change-Id: I75fe2d17bcd01c6677698fc752a17d19be62cd8f
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
net: usb: Handle Zero length packet

RMNET control driver does not handle zero length packet and
passes it on as QMI command response received from mdm device
to userspace. mdm device is erroneously sending zero length
packet to the RMNET control driver which userspace treats as
an error. Hence add a check for zero length packet and do not
pass it on to userspace.

Change-Id: Id18e2f6ffca1692243a3d89a25bb3ccafd7d5b89
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>