During subsystem restart, it is possible that while the underlying bus
is down, the irq driver has already performed its cleanup. In such case,
when CPE driver requests to cleanup its own irq, the irq driver attempts
to hold an lock that is already freed. Fix this issue by performing the
CPE driver irq cleanup after bus is up rather than when bus is down.
CRs-fixed: 948899
Change-Id: I2772e89bbdc855baa9fcf7a34a9c16f2f5c05c32
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
After subsystem restart is completed, driver will try to restore the
internal clock state to state before subsystem restart. In some cases,
it is possible that the internal clock state is not restored properly.
This causes the internal clock to be off when it is expected to be
turned on. Fix this issue by making sure the clock states are restored
correctly post subsystem restart.
CRs-fixed: 948899
Change-Id: I0084287b2d3b62c7498bae423952e64dd0d6e0f4
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
When CPE services notifies the client that response to any message is
received, it is possible that the client may send another message even
before the CPE services cleared the current message response as these
both are run in different thread contexts, this will cause the command
queue to be corrupted. Fix this issue by clearing internal state of CPE
services command queue before notifying clients the clients the result
of message transfer completion.
CRs-fixed: 946375
Change-Id: I4b31201747edd7fdee57294ff559ccb21e582608
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
Reduce insert and remove debounce value on wcd9335 to 96msec
to improve device switch latency during audio playback usecase.
Change sets the insert and remove debounce to 96msec.
Change-Id: I62a4e29af050da3b6be4afc1267b1b03f786c63e
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
The buffer used for look-ahead-buffering is allocated during IOCTL from
userspace. It is possible that userspace can invoke this IOCTL multiple
times without invoking the IOCTL to de-allocate the buffer. This results
in out of memory issue for buffer allocation during stress testing. Fix
this issue by avoiding multiple buffer allocations.
CRs-fixed: 942452
Change-Id: Id9eb99dc2c8527fbbe1fe79fca1cdcea232c33da
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
Currently worker thread in cpe service is created twice.
The second thread handler overwrites the first one. The first
thread is not freed when the service is cleaned up. The fix
prevents creation of the redundant thread.
CRs-Fixed: 949165
Change-Id: Idd76b76d4f7f25d2592ca7c336dbee77b6efc7eb
Signed-off-by: Walter Yang <yandongy@codeaurora.org>
HW MAD bypass feature is to facilitate input to CPE by avoiding
MAD in codec. This is done by routing DEC1 data to CPE. Add the
required changes to support this feature.
CRs-fixed: 938514
Change-Id: I7788b1475cd22bdea291bcae47f048131b220ce3
Signed-off-by: Venkata Narendra Kumar Gutta <vgutta@codeaurora.org>
Clear TX HOLD when ANC is enabled and decimator
10 to 13 are selected.
Change-Id: I18c1ddeacc59c1ae7d88daf371c84140c0459693
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Change RX disconnect port sequence so as to avoid
slimbus underflow and audio mute issues during
playback.
Change-Id: I0260e61b78e3bcfe422896dc60b15af84be424a4
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Since the underlying codec can have different memory map, it is possible
the starting offset and size for DRAM can be different as well. This
causes the collected dumps to be incorrect on some platforms. Fix the
ramdump collection to obtain DRAM offset and size from CPE services
which is aware of the codec being used.
CRs-fixed: 929517
Change-Id: I6a592d8f97da117d1e58154460cd0b8f3cbf62c7
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
The DRAM size used for codec WCD9335 is incorrect, this is causing the
dumps to be wrong. Update the DRAM size for WCD9335 as per the memory
map.
CRs-fixed: 929517
Change-Id: Ie4815b4cedf429b0d7045b84381d945bde62d5ce
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
When BUSID pin is connected to ground, wsa speaker should be
set as left. When it is connected to VDD, wsa speaker should
be set as right. Current setting is inversed.
Correct stereo wsa speaker left/right setting for 8976.
Change-Id: If2b44be202f084d76cd9e58307d36c3fce802e3f
Signed-off-by: Yeleswarapu Nagaradhesh <nagaradh@codeaurora.org>
Port fixes for TX pop and spkr gain updates for tasha.
Also add fix in WSA for retry when device re-enumeration.
Change-Id: I6573517a101a4e5b0c34ef07a78c7dd0a4f127e5
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
In device switch from bongo speaker to HPH, observe
pop in headset. Since the PA select bit is changed
to HPH before DAC disable when tearing down bongo
speaker, this can result in pop in headset. Move
the PA selection bit to be changed to HPH after
PA and DAC disable.
Change-Id: Idb4f96f03880563e4bb81b98f623b6b05f27da8e
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
After SSR, MICBIAS is not enabled as micb_ref is not correct.
So set micb_ref to zero post SSR.
Change-Id: Iaffa7a29799a9b3ed7a46da3cb11a2d4c47e45e9
Signed-off-by: Yeleswarapu Nagaradhesh <nagaradh@codeaurora.org>
From second detection onwards, buffered data has one extra
stale sample before the actual data even though CPE TX PP
(PingPong) buffer is properly disabled. Avoid this extra data
by clearing TX PP buffer memory after reading the complete buffer.
Change-Id: Id3183f64136e827641ab4d00450dbdb7806f00ab
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
Default FIFO watermark value is set as 8 bytes. Observed data skipping
randomly at higher sample rates with default watermark value. Increase
the watermark value to 16 bytes to avoid data loss.
Change-Id: Ic595f62f243b6087ceb2dc61089f957b6a6f8121
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
When userspace requests small duration of buffer then it is possible
that the buffer can overflow if only one buffer is queued at a time.
This is because of more channel setup time than buffer size duration.
Queue two buffers with slimbus before starting AFE port to avoid
data loss.
Change-Id: Iabb6f6b1d0e3ee8227ed8be26a64e7eb025e7018
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
Currently 16KHz is the maximum supported CPE data transfer
rate. Add support to transfer LAB(Look Ahead buffer) data
from CPE at maximum rate of 384KHz/32bit.
Change-Id: Ic4475d91ca2962c90f424816ef03df0a68ccdf92
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
CPE PP(ping-pong) buffer hardware block is added to support
higher data transfers from CPE in WCD9335 V2. Update codec
driver to enable CPE PP buffer path.
Change-Id: I030cef25d6eddc72a02859f6ee78f201efc3dd43
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
Currently only one CPE AFE output port is supported. Add
an API to get CPE AFE port ID from codec driver. Use that
port ID for LAB buffering.
Change-Id: I74fdeb1800a64ed775608967e4d315f28d48e9ef
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
In compressed driver streams might get stopped while
ioctl drain is started but not completed, since buffers
are drained in multiple stages when gapless mode is
enabled.
Check stream state before issuing wait commands to
prevent waiting for drain ack on stopped streams.
Change-Id: I606639c103a7aed90dd9a4561fa6dffc3d4c3822
Signed-off-by: Dhananjay Kumar <dhakumar@codeaurora.org>
Issue slim slave port disconnect command to tear
down the audio playback path and then wait for
the channel removal interrupt from the slimbus slave.
This is required because of the slim protocol (pull
mode) being used for 44.1KHz native audio playback.
If MSM side slimbus channels are closed first followed
by slim slave ports, it will lead to underflow errors
at the end of audio playback with 44.1KHz sample rate.
To avoid underflow errors, slim slave port disconnect
command is issued explicitly.
Change-Id: Ib7ae6f7c5301073f7a9cf51ec3536504b9cdd7c7
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
MCLK needs to be turned on for efuse sensing to be successful.
During post SSR codec bring up, make sure MCLK is restored
before efuse sensing, if audio use cases were running when
SSR happened.
Change-Id: I3a04775ebd88ca81804e472ffa20cb91a66ecaee
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
When device down is called, the work queue for temparature
reading should be cancelled. Without this, there might be
read/write happening while WSA881x device is still in
down (no clock) state.
Change-Id: Ib0a6a9e5f8b45c3952e6a7fe5889901971bf0f08
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
When SSR triggered on speaker in internal codec,
sometimes dapm fails to mark dapm widget dirty after SSR
for specific clips and speaker codec widgets fail
to powerup. As this widget associated with SPK DAC register
which is also changed in driver when SSR power down and
powerup, resulting in timing issue when this register
being read by DAPM. Change the routing to tie up the
speaker codec widgets path with virtual mux switch
and DAC widgets.
Change-Id: I691fed56818a099dc3893eedad6fcd7f9bc61107
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
When XO shutdown happens, workqueue scheduled for digital
power collapse is not triggered. In tasha suspend, put
digital core in power collapse if workqueue is pending.
Change-Id: I4ae9bad6b18dd54217fcad5ad60673ee726f4700
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>