leds: At disable, set the trigger to default instead of wiping it

Change-Id: Ifb4a3b3034c441d29fd1d9f209ed829adfc76a72
msm: bam_dmux: delay shutdown until DL polling is complete

Bam_dmux assumes that a shutdown event will not occur while downlink (DL)
polling is active. If this assumption does not hold, bam_dmux stops
polling, but does not cleanly switch back to interrupt mode until the next
power-on event. This is a problem because the next power-on event could
occur in the distant future and until that time some resources may be
incorrectly accessed or not released. Instead, if a shutdown event occurs
while DL polling is active, delay processing of that event until polling
completes.

CRs-Fixed: 503046
Change-Id: I67e4216b4820942e6070944557cd13f59600a2aa
Signed-off-by: Brent Hronik <bhronik@codeaurora.org>
msm: bam_dmux: Update UL wakeup timeout to two seconds

The current uplink (UL) wakeup timeout of one second does not allow the
remote side enough time to trigger a watchdog and recover from some serious
problems. Increase the UL wakeup timeout to two seconds to provide the
remote side enough time to trigger the watchdog, if necessary, without
significantly impacting user experience due to an overly long data stall.

Change-Id: Ia9f85bb9822ce500c3d41b894a945fc6ecc75fc7
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
msm: bam_dmux: prevent duplicate subsystem restart

If a subsystem restart is triggered while BAM DMUX is waiting for a
power control response, then BAM DMUX will timeout and trigger another
subsystem restart which will cause a kernel panic.

Check if an SSR is already in progress before triggering another
subsystem restart.

CRs-Fixed: 515398
Change-Id: I9e8e5513f6568da9c0090fd97c671a9bc824c43b
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
msm: bam_dmux: add downlink processing state logging

State transitions of the downlink packet processing task are not directly
logged.  This leads to information gaps when debugging downlink issues.

Add explict logging of the state transitions to provide complete
information on what the downlink processing task has done.

Change-Id: Ie253c9739447da6ed236e865b7f1ed318e13cb6e
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
msm: pil-q6v5-mss: Set the force stop bit and wait for ack when necessary

The force stop bit can be used to indicate to the modem to dump its memory
and stop execution. The dumped memory can then be used for debugging
purposes.

This should be done under the following circumstances:

1. When the application processor panics, we need the modem image to stop
execution and dump its memory for future analysis. Setting the force stop
bit achieves this. But in this scenario use a timeout and do not wait for
the acknowledgement from the modem because all interrupts would be disabled
in the application processor.

2. When an SSR is being performed on the modem as part of a group of
subsystems where the SSR is not a direct result of the modem crashing but
because of any other subsystem in the group. In this case, dumping the
modem memory can help debug if there were any interdependencies between
the subsystems in the group which led to the SSR.

3. When an independent SSR is being performed where the modem doesn't
detect an error (and hence doesn't flush its buffer on its own) but a
client running on the application processor detects an error. The memory
dump then could lead to finding the cause of the error.

In cases 2 and 3, wait for the force stop acknowledgement from the modem
before proceeding further.

Change-Id: I816b53fb961adf93943893793e38254cb8bfcde1
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
wcnss: Add API to expose the IRIS XO mode set

IRIS XO mode can be configured thru module parameter; and it can also
be auto detected. Add an API to expose the IRIS XO mode set. WLAN driver
can use this API for it's XO specific operation.

Change-Id: If40ae715f5e400e13a6fc9588d2bd144958ee8c2
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
msm: pil: Proxy unvote after pil_shutdown() when using IRQs

Subsystems might use an IRQ for removal of proxy votes via the
power/clock ready interrupt. So, if a peripheral shutdown is triggered
before the power/clock ready interrupt is received, remove the proxy
votes and bypass the unvoting in the power/clock ready interrupt handler.
Conversely, if the power/clock interrupt is received before shutdown is
triggered, bypass the unvoting during pil shutdown.

Also, remove the hack to proxy unvote directly from the pil-q6v5-mss
driver.

Change-Id: I254ab5a1595ceb27a2cfcac99c4c1d2f2443b7c7
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
msm: pil-q6v5-mss: Factor out PIL code into a separate library.

pil-q6v5-mss.c contains code for both the PIL and subsystem
implementations. Factor out the PIL specific code into a
pil-msa.c library so it can be reused by other subsystems
which use the same/similar self-authentication mechanisms.

Change-Id: I7e27eafbd2c89c2747482f1162e7b28d9e5f7bca
Acked-by: Jennifer Zenner <jzenner@qti.qualcomm.com>
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
msm: pil-q6v5-mss: Do not generate redundant smem ramdump

When the device crashes, smem ramdump is already generated by the smem
driver. Therefore, the smem ramdump generated by pil-q6v5-mss is redundant
and the code responsible for it can be taken out.

CRs-fixed: 485208
Change-Id: I8b67ff9f54663b68268b7b87e9cb1f3930219afa
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
msm: pil-q6v5-mss: Initialize the stop ack completion variable

In case of targets that don't use the PIL framework to boot the modem,
the stop_ack completion variable might remain in uninitialized state as
the initialization is currently being done only within PIL callbacks.
So, fix this my initializing the completion variable outside of PIL
by callbacks.

Change-Id: I204b0fbf461b1e1f1d4576dc43e33c7442eaf0e0
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
wcnss: pil-pronto: Add register dump to bite handler

Log a number of WCNSS registers when there is a bite from it; these
register dumps will help for root causing the bite at WCNSS. The
register dump will not be taken when common_ss is power collapsed, that
protection is already added to the dump routine.

Change-Id: I9cc6c539b0efe9d0dc3d51949f9c9557c746bd61
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
msm: pil-q6v5-mss: Perform proxy voting/unvoting at mba bootup

Currently, both mba and q6 devices perform voting and unvoting during
bootup via pil. This is done because earlier the clock ready interrupt was
not provided by the modem booting up. But now that we have the clock ready
interrupt being sent by the modem, we can make the proxy votes for the PBL
while booting up. Later when the modem has finished booting up it would
send the clock ready interrupt and at that time we would remove the proxy
votes made for the PBL. So remove the PBL proxy votes after receiving the
clock ready interrupt from the modem.

Also, having IRQF_SHARED in the proxy unvote IRQ registration is
unnecessary because the the power/clock ready interrupt is not shared
among subsystems. So remove that as well.

Change-Id: Ie6ec27f6842c42c4240a9f09f8f49a190ab3c2f9
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
msm: scm-pas: Flush the metadata buffer

In the near future, scm_call will no longer flush
the entire cache in order to ensure that the secure
world doesn't see stale data. Therefore, flush the
metadata buffer from the cache before invoking
scm_call.

Change-Id: I0896d1bac074b6a4b004edfc1cb0a9a8de57999b
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
msm: socinfo: Add support for MSM8974PRO AA/AB/AC

Update the SoC ID mapping table and create cpu_is functions
to support the MSM8974PRO AA/AB/AC targets.

Change-Id: I0e9dfdb22462c68c7bc18edd5ef025f42760be06
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
msm: scm-pas: Remove cpu_is_* checks

The soc type check is included in scm_pas_init in order to assign
different source port IDs to the bus bandwidth voting vectors.
The check is removed by making scm_pas_init a function to which
the source port ID is passed in as a parameter. This change assumes
that the destination port remains the same across all SOCs. The
scm_pas_init function is invoked from individual pil drivers.

Change-Id: I7472d07ae560a16d2fd03b184e340e56a62985d2
Signed-off-by: Deepak Katragadda <dkatraga@codeaurora.org>
msm: subsystem_restart: Move device tree parsing code into the framework

Every driver has to repeat the code for parsing device tree nodes for the
SMP2P gpios. So, move this parsing code into the framework level to avoid
this duplication of code.

Change-Id: Ie27a5f37ce2b9718a5cc0ccf11c7abda1c6cb1df
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
msm: pil: Move device tree parsing code into the framework

Every driver has to repeat the code for parsing device tree nodes for the
proxy unvote IRQ. So, move this parsing code into the framework level to
avoid this duplication of code.

Change-Id: I8739af63f6f3bc95aaded74d60359256e5bd7a66
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
msm: pil-q6v5-mss: Correct kzalloc return path checking

devm_kzalloc returns NULL on failure, not an error code.
Fix the check done on mba_data after the allocation.

Change-Id: Ie7a75d8864889f0426a7f3fb54908e4869a719a8
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
msm: pil-venus: Move the GDSC control out of PIL driver

The PIL driver has full control of the Venus GDSC. It turns
on the GDSC when booting up venus and leaves it on until
venus is shutdown.

In order to save more power during video playback, interframe
power collapse can be used. This requires that the GDSC can be
turned on/off during video playback.

In order to allow the Venus driver to turn on/off the GDSC, the
PIL driver should no longer hold the GDSC on throughout the time
Venus is booted up. It is safe to do so since the Venus driver
has already added GDSC control.

Note that the proxy voting of GDSC is still present solely for
the purpose of allowing standalone testing of the Venus PIL
driver.

Change-Id: I49b7331d4ec40c08b1eba0a72942564899ca4b8f
Signed-off-by: Tianyi Gou <tgou@codeaurora.org>