Commit graph

12 commits

Author SHA1 Message Date
Karthikeyan Mani
ba3c2fde98 ASoC: wcd-dsp-mgr: Add range check before getting component
Add range check for wdsp_cmpnt_type to be within max
and greater than 0 before accessing the array to get
the component.

CRs-fixed: 2068865
Change-Id: Ibc3128297a024f7d6d548c946a035e604f573b64
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
2017-09-18 14:25:47 -07:00
Bhalchandra Gajare
159d8f2870 ASoC: wcd-dsp-mgr: fix race during subsystem restart
Whenever subsystem restart or DSP boot occurs, the manager driver
parses the dsp image and stores the segments in list. During
certain back to back regression tests, it is observed that SSR
is failing due to race between SSR handling and DSP enablement.
Fix this by acquiring the ssr_mutex during enabling DSP and
sequence to list operations such that there is no race conditions.

Change-Id: I15c55bf96737e4ffd7e0faf571a1109ba6c38163
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2017-08-14 11:49:22 -07:00
Bhalchandra Gajare
b121d52808 ASoC: wcd-dsp-mgr: force crash upon collecting ramdumps
In case of WDSP fatal errors, subsystem restart is done to reset the
WDSP. Currently, the driver performs subsystem restart silently and
does not cause devie crash. Add debugfs property 'panic_on_error'
to indicate the driver to induce BUG_ON to aid debugging. The BUG_ON
is done only when the debugfs property is explicity set through
debugfs. If not set, the driver will continue without crashing. The
below command can be used to set the debugfs property.

echo Y > /sys/kernel/debug/wdsp_mgr/panic_on_error

CRs-fixed: 2029058
Change-Id: I1442cc59e1819c3b0abd4c4776f4b32ba63d59e2
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2017-04-18 14:47:43 -07:00
Bhalchandra Gajare
896e0b12ac ASoC: wcd-dsp-mgr: add suspend and resume functionality
Currently, the suspend and resume routines for the wcd dsp manager
driver are not implemented, which causes race conditions when the
components suspend or resume out of order. Implement the suspend/
resume functionality and route the events to the components in
the expected sequence.

CRs-Fixed: 1111863
Change-Id: Ie84cdef5ed7ffd61610cd83e5f627427f85bc125
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2017-01-30 18:00:06 -08:00
Bhalchandra Gajare
06f5b93af0 ASoC: wcd-dsp-mgr: fix restart logic when codec comes back online
During subsystem restart, when restart of the codec DSP is attempted,
the status is already moved to codec up whereas driver is checking
for codec down. This causes the initialization of components to be
skipped and codec dsp does not come back online. Change fixes the
condition check to make sure the correct sequence is followed.

CRs-Fixed: 1080392
Change-Id: I05345b8f5d108e59863ee4e37ed75fd32a284ee5
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2016-10-25 18:05:07 -07:00
Bhalchandra Gajare
f5c0c7a00b ASoC: wcd-dsp-mgr: handle codec down and up events
It is possible that codec hardware can be reset in case of subsystem
restart scenarios. It is required to reset the codec DSP as well in
such cases to make sure the DSP is in usable state after the codec
hardware is reset. Change adds support to handle codec down and up
events and perform the necessary reset on codec DSP.

Change-Id: I79502c043f5e16947c895aab7cd584d72ad1a7dc
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2016-10-11 15:38:32 -07:00
Bhalchandra Gajare
d0b17cbf01 ASoC: wcd-dsp-mgr: rename wdsp_intr_handler to wdsp_signal_handler
The wdsp_intr_handler is not really processing interrupts in interrupt
context, rather assumes that the caller is not in interrupt context and
performs calls that may sleep. Rename the function in order to avoid
confusion. Interrupt handlers can still call this function as long as
they are in threaded interrupt context and are okay to sleep.

Change-Id: Ia2803d6ca021d505ed2e711e676cbd701b11c492
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2016-10-11 15:35:40 -07:00
Bhalchandra Gajare
f37c2edcc6 ASoC: wcd-dsp-mgr: set status before broadcasting post events
During image download, the status is set after post download events
are broadcasted. This could possibly lead to race condition if other
drivers requested to boot the dsp before the status was set. Change
makes sure the wdsp status is set prior to broadcasting post download
events to avoid possible race conditions.

CRs-fixed: 1071949
Change-Id: If3ec6202b4729b24ee839c3a8aa4edf2482d6e59
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2016-10-04 18:04:46 -07:00
Bhalchandra Gajare
d728aa9031 ASoC: wcd-dsp-mgr: add support for subsystem restart
It is possible that wcd codec DSP can crash or become unresponsive.
During such case, an error interrupt is generated by the codec. Add
support in manager driver to handle this interrupt and perform
subsystem restart to shutdown and reboot the DSP so that the DSP
can be recovered from the crash.

CRs-fixed: 1071949
Change-Id: I4662b5120bf7f731e399a27d8a613e2f3b648b00
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2016-10-04 12:42:44 -07:00
Bhalchandra Gajare
aaa95b0cb5 ASoC: wcd-dsp-mgr: add support for collecting memory dumps
The codec driver is notified through interrupt whenever the
DSP in codec is unresponsive/crashed. In such cases, collecting
dumps of the codec memory is useful in debugging the issues.
Change adds support in the wcd dsp manager driver to collect
the memory dumps upon notification of error interrupt.

Change-Id: Ib91cd4fc1476ee1a9ec448cde1a083070443f726
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2016-10-04 11:06:42 -07:00
Bhalchandra Gajare
1e2d8b2132 ASoC: wcd-dsp-mgr: add argument to the interrupt handler callback
Currently, when manager driver interrupt handler callback is called,
there is no way for the caller to provide any data information along
with the type of interrupt. Change adds argument to the interrupt
handler so that callers can use this to pass agreed data when an
interrupt occurs.

Change-Id: I1c049227875a802491e21998c13c0bcd8eab7de6
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2016-10-04 10:49:57 -07:00
Bhalchandra Gajare
643173993d wcd_dsp_mgr: Add the WCD DSP manager driver
WCD audio codecs have DSP embedded to perform signal processing on
audio data. The codec driver has control over the DSP clock, power etc,
whereas the DSP memory can be accessed through an different bus slave
interface. In such cases, it is required to make sure the hardware
expected sequences are met for the DSP to function properly. The
wcd-dsp manager driver registers as master to component framework
and provides the ability to sequence the operations between the child
drivers. Upon registration of all children, the wcd-dsp manager driver
parses the wcd dsp image, downloads the image and boots up the DSP.
It invokes the component children to perform the tasks in sequence.

CRs-Fixed: 1049012
Change-Id: I059e1b111c607e49a7cc9a7940cf458e701c73d3
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2016-08-02 20:31:31 -07:00