msm: mdm: Changes to implement notifications from the mdm-driver

mdm-driver can now send notifications.

Change-Id: Idacf0a1d26a40ecd277407240f797ede72fb5b31
Signed-off-by: Ameya Thakur <ameyat@codeaurora.org>
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
msm: mdm: change where ssr_count is decremented

In fusion targets with more than one external modem, where
the modems are restarted together, ssr_count keeps track of
how many modems are still left to be completely restarted so
that any new SSR requests would be rejected until all modems
are restarted. Ssr_count should be decremented when the SSR
module sends the SUBSYS_AFTER_POWERUP notification instead of
during the powerup callback in order to be in sync with the
state of the SSR module.

Change-Id: I196f4937d929c54f475d251632f111404a2b3bf1
Signed-off-by: Joel King <joelking@codeaurora.org>
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
msm: mdm: Disable panic on external mdm boot timeout

We now have the ability to not panic when we see a external modem has
not booted up within the expected timeframe. This functionality is
required in order to debug early bootup issues on the mdm's and is
configured via a sysfs flag.

Change-Id: Iac3bf980b239fdbe2ffdc8a5a25b875d47f0384c
Signed-off-by: Ameya Thakur <ameyat@codeaurora.org>
msm: mdm: Ignore modem crashes during image upgrade.

When a modem image upgrade is in progress we now ignore any other
crash notifications that may come from other modems. These could
trigger an SSR and cause the upgrade to fail as well.

Change-Id: If96139c5106053ce6c8db05865f7d2fd9a503f23
Signed-off-by: Ameya Thakur <ameyat@codeaurora.org>
msm: mdm2: Decrease leakage before QSC power-up

Cleanup of IPC gpios for driver strength and toggle
AP2MDM_STATUS only after AP2MDM_KPD_PWR is toggled, this
will decrease the leakage from MSM to QSC before QSC
powering up.

CRs-Fixed: 460500
Change-Id: Iabfa34331b613dd66577e485572a809440cf5272
Signed-off-by: Taniya Das <tdas@codeaurora.org>
(cherry picked from commit aa068dcefa45ec83709da39ab63844a9b83e9fc8)

Conflicts:

	arch/arm/mach-msm/mdm2.c
	arch/arm/mach-msm/mdm_common.c

Signed-off-by: Akhila Musunuri <makhila@codeaurora.org>
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
Merge "mach-msm:bus_config:fix possible missing error check"
msm: scm: Add scm_call_noalloc and helper macros

Currently, scm_call internally calls kmalloc() to allocate a command
buffer structure. This prevents scm_call from working before kmalloc
structures are initialized or during atomic contexts. Allow clients
to pass in a pre-allocated buffer for scm_call to be used for internal
structures.

Change-Id: Id09500c8c696298228aefdcc2a61953e654677c9
CRs-Fixed: 498392
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: socinfo: Add new hw_platform for QRD

New hardware platform added for QRD targets.

Change-Id: I1a94218789dd8dc51bdd16969f081b2949887d5d
Signed-off-by: Taniya Das <tdas@codeaurora.org>
msm: SSR: Fix problems with concurrent SSRs

If one SSR call comes in and queues a work and the work item
starts running and then another SSR call comes in we will end up
with a running work item and a pending work item. The pending
work item will not run until the running work item completes.
With the current code the work item will run to completion and
then the pending work item will run and restart the subsystem
again.

This is wrong since we want to 'short-circuit' the code in this
case and do nothing if multiple SSR calls come in while the
subsystem is in the 'crashed' state.  Add state tracking logic so
that we know what part of the restart process a particular
subsystem is in and use it to fix this problem.

Conflicts:

	arch/arm/mach-msm/subsystem_restart.c

Change-Id: Iac8713951af1f290af1df7e94468d1843fc7980b
CRs-Fixed: 397848
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
msm: subsystem_restart: Don't use phase 3 SSR on the SGLTE2

This change has already been done for the SGLTE target.
See commit e4ae75ea79620e3b59859d82aa1809a256e48364. The
current patch extends the change to the SGLTE2 target.
The original commit text follows.

On the SGLTE2 platform, phase 2 SSR is required to address
the dependency between the internal and external modems. The
other subsystems (RIVA, LPASS etc) still need to do an
independent restart. In the absence of a matching restart
order, a request for a subsystem restart on a subsystem will
be treated as an  independent phase-3 like restart, even if
the current restart_level is phase 2. Therefore, don't allow
phase 3 on SGLTE platforms.

Change-Id: I99469883e85f87a3b49846699c4b9d84cd385285
Signed-off-by: Joel King <joelking@codeaurora.org>
msm: watchdog: Add reboot/shutdown notifications to watchdog

On shutdown or reboot path, callee CPU waits for one second
in order for other CPUs to respond. However, this coincides
with watchdog pet to bark timeout value, which sometimes
results in unnecessary watchdog barks.

Since we are either shutting down or rebooting the machine
anyways, we might as well wait a bit longer for bark timeout.
This gives a better chance to a graceful shutdown or reboot the
system because their call-sites are race prone.

Change-Id: Ie82f16dcc7671ddc05bf6c6ea20aa71981607273
Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>
 msm: mdm2: Decrease leakage before QSC power-up