Commit graph

30 commits

Author SHA1 Message Date
Laxminath Kasam
87a0712ca2 soc: swr-wcd: Apply div2 setting on slave side before bank switch
In soundwire controller, bank switch happen twice
for a playback session with stereo speakers. Ensure
the setting of div2 applied to inactive bank before
bank switch occurs to avoid impact based on bank chosen.

Change-Id: I033b19e78309485ca9da85ec67b54409e6fe22cc
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2018-12-05 23:30:07 -08:00
Laxminath Kasam
b010c547d7 soc: soundwire: Fix wsa mute issue for stereo playback
When stereo playback start and temperature read
initiated at same time, one of speaker PA bits are
not set in particular race scenario. Handle the
broadcast check in soundwire framework to ensure
broadcast is disabled only when respective gr_sid
slave calls swr_remove_from_group.

CRs-Fixed: 2282230
Change-Id: I6f82a8c3c0f39dc20c1def09c1728ce4c26c2f5d
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2018-10-02 22:35:33 -07:00
Laxminath Kasam
791c9f35a7 soc: swr-wcd-ctrl: Fix wsa mute issue for stereo playback
When temperature on a single wsa881x device is being read,
then soundwire master wakes up both wsa881x devices but
regcache_sync is happening only for one wsa881x device on
which the temperature is being read. This results in
audio playback mute after temperature read. Fix the
regcache sync during temperature read and playback usecase.

CRs-Fixed: 2282230
Change-Id: I856b96517c629ac685bbc25caabee841037106c8
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2018-10-02 22:34:45 -07:00
Karthikeyan Mani
657e8556b7 drivers: swr-wcd-ctrl: Fix wsa mute at boot
Replace pm resume and suspend inside interrupt
with clk enable and disable. Add clk ref count
to not have the clk disabled when in use.

CRs-Fixed: 2079739
Change-Id: I8f7f6e8e3c7cf8fd176a708ba5171a98546db929
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
2017-08-31 05:31:21 -07:00
Linux Build Service Account
99f2bf04ab Merge "soundwire: Fix swr device count logic in registration" 2017-06-15 08:36:28 -07:00
Linux Build Service Account
dd704b7258 Merge "soundwire: Remove startup from swr_driver structure" 2017-06-15 08:36:26 -07:00
Karthikeyan Mani
09789b865c soundwire: Fix swr device count logic in registration
Increment swr device count before registration to
enable proper device detection in probe call, Decrement
the same count if the registration fails.

CRs-fixed: 2050725
Change-Id: If0133cbf751195542d9e1f16679cc63547b56778
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
2017-06-07 00:29:25 -07:00
Karthikeyan Mani
db56317667 soundwire: Move device init functionality from master
Move from master probe to the slave probe, the
device init functionality of swr slave. Provide
device remove functionality to remove a given
device from the master's list.

CRs-fixed: 2050710
Change-Id: Iee95c146d8b148e15dca5a8c10de65368cf3b55a
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
2017-06-07 00:15:42 -07:00
Prasad Sodagudi
0958ceaaf4 drivers: Warning fixes to disable CC_OPTIMIZE_FOR_SIZE
These are all driver changes needed for disablement of
CONFIG_CC_OPTIMIZE_FOR_SIZE. CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
is enabled by default once CONFIG_CC_OPTIMIZE_FOR_SIZE is disabled.

Change-Id: Ia46a1f24e8a082a29ea6151e41e6d3a85a05fd4f
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
Signed-off-by: Sridhar Parasuram <sridhar@codeaurora.org>
2017-05-31 16:51:47 -07:00
Laxminath Kasam
bd01dc59f2 ASoC: swr-wcd: Reduce latency for cold start on speaker
In SDM660 WSA speaker using MSM over soundwire version,
observe high cold start latency. As interrupt is disabled,
broadcast ack is not received which results in 200ms higher
latency. Reduce latency impact by blocking only for 10ms
for MSM over soundwire version.

Change-Id: Ic0e659d7c443c1462aba4da2f8bf9471031d02d2
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2017-03-22 00:51:02 -07:00
Sudheer Papothi
b5085c2b59 soundwire: Add support to disable smart boost data port
Soundwire does not have usecase with smart boost disabled. This
results in data port collisions when smart boost port is disabled
from mixer control which results in noise during audio playback.
Add usecase and port configurations with smart boost disabled.

Change-Id: I014e438b3e5810508f8b52716684cbb9608822ac
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2017-02-01 04:25:14 +05:30
Laxminath Kasam
180be8b7db soundwire: Add support for usecases without compander
Some of the usecases without compander and with
smart boost, VI sense are added in soundwire controller
driver.

Change-Id: Ia380ee6ad4584c29feb80fdc3b9247dd11e64a3e
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2016-09-21 02:49:13 -07:00
Linux Build Service Account
9dbc6e0357 Merge "ASoC: soundwire: fix out of boundary access issues" 2016-08-16 16:34:46 -07:00
Vidyakumar Athota
fba97387be ASoC: soundwire: fix out of boundary access issues
In soundwire read/write commands, register value is defined
as 8 bit but it is accessed through 32 bit pointer which
may cause out of boundary memory access. Fix this issue by
typecast appropriately.

BUG: KASan: out of bounds access in swrm_read+0x1dc/0x30c at
addr ffffffc089871880
Write of size 4 by task kworker/u8:5/236
==addr ffffffc089871880
[<ffffffc00081d174>] swrm_read+0x1d8/0x30c
[<ffffffc000819808>] swr_read+0x5c/0x74
[<ffffffc000741e58>] regmap_swr_read+0xd8/0x11c
[<ffffffc00073a350>] _regmap_raw_read+0x210/0x314
[<ffffffc00073a4b0>] _regmap_bus_read+0x5c/0xb4
[<ffffffc000739548>] _regmap_read+0xe0/0x1ec
[<ffffffc0007396b8>] regmap_read+0x64/0xa8
[<ffffffc000dc9dd4>] snd_soc_component_read+0x34/0x70
[<ffffffc000dc9f44>] snd_soc_read+0x6c/0x94
Memory state around the buggy address:
 ffffffc089871780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffffffc089871800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc

Change-Id: I3c56dffb4ca197e8fc23d54a44282a60254dd001
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
2016-08-14 23:06:47 -07:00
Meng Wang
45ffbb1fba swr-wcd-ctrl: set pointer to null after kfree
In soundwire control drivers, some pointers are not
set as NULL after the memory is freed, which will
leave many dangling pointers. Set them to NULL
explicitly to avoid potential risk.

CRs-Fixed: 997062
Change-Id: I18bd73397173187f87af28c78564835eed6d6a10
Signed-off-by: Meng Wang <mwang@codeaurora.org>
2016-08-10 23:22:30 -07:00
Phani Kumar Uppalapati
48fb96241b soundwire: Fix NULL pointer dereference
Fix NULL pointer dereference in soundwire master controller
driver.

CRs-fixed: 1018329
Change-Id: I716401adda144ac0c03520f747694eaa50ea8e51
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
2016-06-13 16:17:41 -07:00
Phani Kumar Uppalapati
404fd13773 swr-wcd-ctrl: Ensure soundwire banks are always in sync
Copy speaker configuration from active to inactive bank
and perform bank switch operation while speaker channels
are getting enabled or disabled. This will make sure that
soundwire banks are always in sync and allow independent
control of speaker channels.

CRs-fixed: 1007465
Change-Id: Ic1653194c22fa5669b1c04fd9630158633fb00a5
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
2016-05-20 13:34:30 -07:00
Phani Kumar Uppalapati
a8f8e620e7 swr-wcd-ctrl: Handle soundwire slave device ungroup
Handle soundwire slave devices ungroup in master controller.
Set the group device id to 0 when soundwire slave devices
request ungroup for independent control.

CRs-fixed: 1007465
Change-Id: I4f1b39dac949aa3f6aa3abb12ff0310fb0e98d1c
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
2016-05-20 13:34:05 -07:00
Phani Kumar Uppalapati
ae4cedcf33 soundwire: Add API to ungroup soundwire slave devices
Add soundwire API to remove the soundwire slave devices
from group so that the devices can be controlled
independently as required.

CRs-fixed: 1007465
Change-Id: Ibca3e33c0e85629ae5ce121e75526f4786d6408a
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
2016-05-20 13:33:55 -07:00
Phani Kumar Uppalapati
c04712dc8f soundwire: Add support for 48x2 frame structure
Add support for 48x2 frame structure in soundwire
so that when slave device data path is not enabled,
all control messaging will happen with 48x2 frame.
Soundwire slave devices send an explicit request to
enable data path which in turn change the frame
structure to 48x16.

CRs-fixed: 996586
Change-Id: Ia4329ac982eb2a29a2b925897cd87ca9711c30e3
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
2016-05-20 13:33:44 -07:00
Phani Kumar Uppalapati
22ba2185da soundwire: Add API to control slave device data path
Add soundwire API to control slave device data path
enable or disable. This gives slave device drivers
more flexibility for data path control during device
path enablement.

CRs-fixed: 996586
Change-Id: Ic0ab015098035418458a5ba7c2ffad9df20f933c
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
2016-05-06 12:06:19 -07:00
Sudheer Papothi
7f5348933a soundwire: Avoid runtime suspend after device path bringup
There is a possible race condition that runtime suspend is being
called after device path bringup. To avoid this race condition,
add a mutex lock during device path bringup to serialize runtime
suspend and resume.

CRs-Fixed: 967442
Change-Id: I268a25b05799c66fc019e19e46939286e54fb514
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2016-03-23 21:20:44 -07:00
Sudheer Papothi
f1b365a43b soundwire: set the group id based on number of channels
Set the group id to default when number of channels are less
than or equal to one. This change will configure the group
id correctly during device switch scenarios.

CRs-Fixed: 961023
Change-Id: I2cb4447b36fef111ed1f9b8991b3882b8d57f6a7
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2016-03-23 21:19:50 -07:00
Sudheer Papothi
db36660f6c soundwire: Fix NULL pointer check while setting group ID
Fix NULL pointer check while setting group ID to avoid
dereferening of the pointer.

CRs-Fixed: 971240
Change-Id: Ic5aae901244e7b2b96a894d265a6cc5c119f0367
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2016-03-23 21:19:28 -07:00
Sudheer Papothi
b12c7d2cd1 soundwire: Add slave synchronization configuration
Slave synchronization is needed to sync frame shape consisting
of different ports with different sample rates. Change sets
the slave synchronization based on the frame shape.

Change-Id: Iae726555b3c158394662c590d1ebc781ff7f54f5
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2016-03-23 21:15:09 -07:00
Sudheer Papothi
fa92c7f037 soundwire: Use broadcast command for device configuration
Use soundwire broadcast command for configuration of all slave
devices simultaneously. This change improves latency during
slave devices configuration.

Change-Id: Ie2985e444e4aa1128856dc6ae372f8f4cca943de
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2016-03-23 21:13:11 -07:00
Sudheer Papothi
7b9c5205f5 soundwire: Add support to use group id for slave devices
Devices with the same group id or broadcast command can be
configured simultaneously. This will help improve the latency
during device configuration. Add support to use group id
for slave device configuration.

Change-Id: I5e86e61a0b5223de6c6471f3f342fe1f387d81ef
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2016-03-23 21:13:10 -07:00
Sudheer Papothi
4bf1c7f330 soundwire: Disable ports in both banks after playback usecase
Soundwire hardware has two banks for configuring soundwire
slave ports. After playback is stopped, disable soundwire slave
ports in both banks to avoid any port collisions during the start
of next playback on other slave device.

Change-Id: I5cfd1d985a1ca5fd7b4020d7e14697642f207501
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2016-03-23 21:12:01 -07:00
Sudheer Papothi
8dc812f2d4 ASoC: Audio codec driver changes for kernel 4.4
Audio codec driver changes for kernel 4.4.

Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2016-03-23 20:11:29 -07:00
Sudheer Papothi
03f5d7efe2 ASoC: wcd: Add Audio codec drivers for MSM targets
Add snapshot of audio codec drivers for MSM targets. The
code is migrated from msm-3.18 kernel at the below commit/AU level-

AU_LINUX_ANDROID_LA.HB.1.3.1.06.00.00.187.056
(e70ad0cd5efdd9dc91a77dcdac31d6132e1315c1)
(Promotion of kernel.lnx.3.18-151201.)

Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2016-03-23 20:11:28 -07:00