Commit Graph

197 Commits

Author SHA1 Message Date
Aditya Bavanari
9f599b4a78 soc: Fix out of bounds access in register show function
In register show function, when snprintf returns a negative value
out of bounds access occurs while copying the data to user.
Add return value check on snprintf before copy_to_user
to fix this.

Change-Id: I96bfa64b1603c966852c1d4d4a12651664f17aed
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
2019-08-27 22:18:41 +05:30
qctecmdr
ab0a45b0db Merge "soc: swr: avoid SSR state when switching between 44.1 and 48k family" 2019-08-20 00:02:12 -07:00
Karthikeyan Mani
5d52dd8613 soc: swr-mstr: Reduce swr register write sleep timings
Reduce swr bulk write and swr command fifo write sleeps
to reach coldstart latency numbers.

Change-Id: I52f2868a488e167b0a0f617b6af3e79cbf6f7eea
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
2019-08-15 17:11:34 -07:00
Ramprasad Katkam
2e85a54634 soc: swr: avoid SSR state when switching between 44.1 and 48k family
Avoid SSR state, and do only clock-stop-resume to reset master  when
switching between 44.1 and 48k to avoid redundant re-enumeration.

Change-Id: Iaa955c4ceb75f30c68106468676ddb2551537de4
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
2019-08-12 01:31:48 -07:00
Vatsal Bucha
63b193fcd0 soc: swr-mstr: Fix headset detection after pdr
Sometimes, headset is not detected after pdr during music playback.
This is because enable_irq does not get called as master remains
in suspend state. Decrease auto suspend timer to 1 to fix the issue.

Change-Id: I8cea3e74487977af801dccac7e4f873831c26264
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
2019-08-12 13:22:45 +05:30
Sudheer Papothi
72ee264c0c SoC: soundwire: Add support to register for event listener
Add support to register/deregister for event listener to listen to
headset interrupt events during low power island mode.

Change-Id: I9d05261003ef9e4783e03b3acb529c864c07cbec
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2019-08-08 05:22:06 +05:30
qctecmdr
863ab8865a Merge "soc: soundwire: Avoid wakeup after clock pause" 2019-07-29 02:33:32 -07:00
Sudheer Papothi
06f43418bf soc: soundwire: Avoid wakeup after clock pause
Unlock mutex for soundwire bank switch to process the
interrupt before clock pause and request for clock switch
to switch the soundwire clock source.

Change-Id: Idea4306a0e326864431e7cf956044383bf1790db
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2019-07-24 02:43:30 +05:30
Sudheer Papothi
07d5afc4cb soc: soundwire: Enable soundwire slave host irq
soundwire slave devices gets reset resulting in setting
host irq to default state. Enable soundwire slave host irq
to process slave interrupts.

Change-Id: I49c3482a22b89fe2a28768edcf7d1e19ba0b978f
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2019-07-17 06:25:45 +05:30
Meng Wang
8c60bb5664 soc: soundwire: update log type for soundwire
Update pr_err to dev_err to indicate which device has
clock mismatch.

Change-Id: Icf842ed63aa0a01ace0ff461f8c05194a0e25f92
Signed-off-by: Meng Wang <mengw@codeaurora.org>
2019-06-29 09:20:50 -07:00
Sudheer Papothi
384addde09 soc: soundwire: request lpass core and audio votes
Soundwire requires lpass core and lpass audio core to be enabled
to receive interrupts and soundwire register read/writes. Change
enables lpass core and lpass audio core in interrrupt service
routine and during register read/writes.

Change-Id: I56da2fc6efe7dfb1a7d59937b123b3972f633448
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2019-06-21 15:24:16 -07:00
qctecmdr
45d02bcf0b Merge "soc: soundwire: reduce the auto suspend delay to one second" 2019-06-21 03:39:03 -07:00
Sudheer Papothi
0016db19a7 soc: soundwire: Add support to dump bulk register writes
Add support to dump soundwire bulk register writes to
analyze port configuration on both soundwire master and
soundwire slave devices.

Change-Id: Ie02b2a0ba40aa5a0b4243022e439e1b545688143
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2019-06-18 00:44:30 -07:00
qctecmdr
e7afbdeeb6 Merge "soundwire: exit from pm function for LPASS HW Core fails" 2019-06-17 20:30:33 -07:00
qctecmdr
295db4585f Merge "soc: swr-mstr: skip port disable when master is down" 2019-06-10 05:57:59 -07:00
Sudheer Papothi
3590b312ba soc: soundwire: reduce the auto suspend delay to one second
Existing delay for soundwire to auto suspend is 3 secs. Reduce
the delay to 1 sec to improve the power numbers.

Change-Id: I0c13439567eb73b80897f4cf1bbcfb1eded94a9c
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2019-06-04 23:51:30 +05:30
Karthikeyan Mani
4e7401aff9 soundwire: exit from pm function for LPASS HW Core fails
Before proceeding with handling soundwire pm functions
check return value of vote for LPASS HW core and handle
error scenarios.

Change-Id: I4f48c93919a75ebbb072123a12306137118699d0
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
2019-06-03 10:52:46 -07:00
Karthikeyan Mani
f68219039a soc: swr: Release resource lock when not needed
Resource lock should not be held while doing bank
switch as bank switch requires interrupt handling
which needs access to the resource lock.

Change-Id: Ic17178c7e6f16a7db91da6577ed2ce70c9c9f084
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
2019-05-28 14:15:12 -07:00
Ramprasad Katkam
979b7c9814 soc: swr-mstr: skip port disable when master is down
skip port disable when master is already down to avoid
queuing commands to master which is already down due to ssr/pdr.

Change-Id: I7fadc479784feb0fd8afa229599eb217bb579ea2
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
2019-05-28 21:43:05 +05:30
qctecmdr
34b7d3b2fd Merge "ASoC: hide bind/unbind in sysfs" 2019-05-21 20:33:23 -07:00
qctecmdr
4a0cf5086c Merge "asoc: Ratelimit error logs" 2019-05-18 03:03:10 -07:00
qctecmdr
8105363ccb Merge "soundwire: return error if vote for LPASS HW Core fails" 2019-05-18 02:55:52 -07:00
Xiaojun Sang
53cd13a1ab ASoC: hide bind/unbind in sysfs
Exposure of driver bind/unbind to userspace via sysfs may
lead to unexpected behavior.
Hide bind and unbind by driver attribute.

Change-Id: I20d6ee653bcc16af15d6368664aaf240c6645cd0
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
2019-05-17 15:00:33 +08:00
Ramprasad Katkam
14efed6eb7 asoc: Ratelimit error logs
Ratelimit error logs to avoid excessive logging during
ssr/pdr.

Change-Id: Icdc9823cef5b070ed70cdd002bb3cd00d482a869
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
2019-05-14 17:42:22 +08:00
qctecmdr
e7072b0ae4 Merge "asoc: codecs: Bail out from clock enable routine during SSR" 2019-05-07 22:35:09 -07:00
Karthikeyan Mani
035c50b0bd soundwire: return error if vote for LPASS HW Core fails
Before proceeding with handling soundwire interrupt check
return value of vote for LPASS HW core and handle
error scenarios.

Change-Id: I0f19a5ddb0af82f33a8d004d008eda9baa40c036
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
2019-05-02 14:09:35 -07:00
Sudheer Papothi
79c9075948 soundwire: Suppress errors due to unsupported slave functions
Suppress the errors from the soundwire master runtime suspend
and runtime resume, if the soundwire slave devices does not
implement the functionality, that avoids pm runtime calling
the runtime functions.

Change-Id: I513a37f37e349a0c435295056df8625f284e13e6
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2019-05-01 05:48:39 +05:30
Aditya Bavanari
f4a471de1a asoc: codecs: Bail out from clock enable routine during SSR
When SSR happens, use dev_up flag in codec
to bail out from clock enablement routine.
During interrupt processing if clock enable fails during
SSR, exit isr routine without disabling clock.

Change-Id: Ie2b56521daa70790d6ef53a06c7becc2ee8010a4
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
2019-04-26 14:13:26 +08:00
Ramprasad Katkam
2586a4b195 soc: swr-mstr: reset slave pending irq flag before every call
Before every slave interrupt handler call, reset slave pending
irq flag, so that if irq is halted it does not retain the old
value.

Change-Id: Ibde5dacf38e78ab19afb6f0e91ffac81f6c22813
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
2019-04-15 02:52:17 -07:00
qctecmdr
553c49490a Merge "soundwire: Vote for LPASS HW Core before soundwire register access" 2019-04-14 23:16:15 -07:00
Sudheer Papothi
66d6fd1364 soundwire: Vote for LPASS HW Core before soundwire register access
Vote for LPASS HW core before soundwire register access to avoid
register access violations.

Change-Id: Ie7ff73bbab64825bf07736f11ef9685e732fc8ae
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2019-04-05 19:16:37 +05:30
Vatsal Bucha
df38c3eb18 soc: swr: Add wakeup source for swr device
Voice call over headset does not disconnect on button press
while device is in suspend state. This is because inband interrupt
is not made wakeup capable. Make inband interrupt for swr tx as
wakeup capable. Also add wakeup source for swr device.

Change-Id: I5f2751672675bc8d62c4d2bfbbd651e640723d52
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
2019-04-02 12:29:20 +05:30
Ramprasad Katkam
1e90620030 soc: swr-mstr: Avoid redunant delay for wcd934x
For codecs like tavil/tasha where the soundwire register access
is through codec bridge, the soundwire bus latency is absorbed
in slimbus io operations, hence do not require extra delay in
soundwire driver for io operations.

Change-Id: If77aa02f0c3c1755916b7a57776115d12e4f08bd
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
2019-03-12 22:06:36 -07:00
Sudheer Papothi
d19d0c5636 soc: soundwire: Handle interrupts based on soundwire version
Some of the interrupt status bits of soundwire interrupt registers
are different in different versions of soundwire. Change is to
handle the interrupts based on soundwire version.

Change-Id: Icac65c9986a3d5724da6343b4202931f04f57f25
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2019-02-27 07:28:26 +05:30
Laxminath Kasam
a60239e354 soc: soundwire: Add support for GPIO interrupt path
In trinket target, interrupt for wakeup is provided via
chip TLMM. Add required support to handle wakeup
interrupt on SWR data line triggered over this TLMM line.

Change-Id: I7fb6d7009a6271d54d0f11f99930b0d039f57129
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2019-01-22 12:53:56 +08:00
Linux Build Service Account
82c45cde0a Merge "soc: swr-mstr: Change timeout for clk disable during ssr" 2019-01-08 05:32:01 -08:00
Linux Build Service Account
a43f819ec7 Merge "soc: swr-mstr: Fix headset detection issue" 2019-01-06 06:31:59 -08:00
Ramprasad Katkam
c87efeb82b soc: swr-mstr: Change timeout for clk disable during ssr
MBHC operations may take around 200ms to get stopped
during ssr. Match timeout for clock voting to be zero
to allow any pending mbhc operation to exited.

Change-Id: I82162e96595fb337f19192f58f1aa7792e8b0e90
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
2019-01-03 18:39:22 -08:00
Ramprasad Katkam
44b7a9602b soc: swr-mstr: Hold suspend during hw wakeup interrupt
Hold system suspend when hardware wakeup interrupt is
received to resume soundwire master.

Change-Id: I99a58aa7d28cfa514d72bacc8c6fc6e95fbe038a
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
2019-01-02 01:34:02 -08:00
Ramprasad Katkam
b4c7c680ef soc: swr-mstr: switch to bank 0 before ssr/pdr
Do bank switch to default bank during ssr/pdr as master
is reset to default state. This avoids wrong state of
swr master during pdr.

Change-Id: I86a7bd53d471e9d864d25dcb84ad8fe12151cc0d
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
2019-01-02 01:32:29 -08:00
Aditya Bavanari
3517b1102a soc: swr-mstr: Fix headset detection issue
Do not disable wake irq during registration of
wake up interrupt as it leads to multiple disable
calls of wake irq during boot up and headset detection
fails sometimes.

CRs-Fixed: 2356299
Change-Id: I79aa0ab46d26dc0e352d399e0d4381a11ed936f4
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
2019-01-02 16:00:39 +08:00
Sudheer Papothi
63f4815535 soc: swr-mstr: Support to execute commands on command ignore
If the optional commands/registers in soundwire slave(s) are not
implemented, then soundwire bus will ignore the corresponding
commands and executes the next commands in queue.

Change-Id: I24dd929975218a150717f03f5c17c2be173a5005
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2018-12-26 00:51:09 -08:00
Sudheer Papothi
4c322b1c80 Soundwire: Fix soundwire master port configuration
Existing soundwire master controller driver uses static tables
directly for soundwire port configuration. But, this is not
scalable to add support for new targets. So, define platform
specific soundwire master port configuration from machine driver.

Change-Id: I37d499c77914b413e6e16ab2689dbaae8fcd194c
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2018-12-17 15:25:48 -08:00
Sudheer Papothi
3d1596e2c6 soc: swr-mstr: Add support for platform specific port configuration
Different platforms have different configuration for soundwire
ports. Add support to get the port configuration information
from the machine driver.

Change-Id: If2c006c4d4a43e2a8dc67c076f6d1c0f36eae16b
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2018-12-17 12:16:26 -08:00
Linux Build Service Account
d0dd6a6284 Merge "Soundwire: Check complete soundwire slave device ID" 2018-12-12 17:51:57 -08:00
Ramprasad Katkam
7e35478bf6 soc: swr-mstr: Store enabled interrupts information in master data
Store interrupt mask variable in master private data to
indicate the interrupts which are currently enabled. This
is to avoid reading interrupt enable register, which varies
on hardware version, for knowing the interrupt enabled info.

Change-Id: Ic990decd1b1112a1ad2a6af0d9b42269fe4e1b4c
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
2018-12-11 17:32:21 +08:00
Ramprasad Katkam
5734987f61 soc: swr-mstr: Add wake lock support to prevent suspend
Add lock and unlock sleep functions to master to prevent
system suspend during interrupts or slave wakeup
requests.

Change-Id: Icb4ea354ec6e2925f83c2380f30ea8e37aca7449
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
2018-12-10 21:43:39 -08:00
Sudheer Papothi
6abd2debae SoC: swr-mstr: Add support for device wakeup
Add support for soundwire device wakeup through bus driver.
These APIs will be used by slave driver through bus driver
to vote and unvote for master wakeup, when it requires
master for register access operations. Master will be
aware of the slave usage with the vote for device wakeup.

Change-Id: I24f0ec0344f05926dc866edb04294cb31348e1ce
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
2018-12-10 18:58:12 -08:00
Meng Wang
43bbb87652 asoc: Update file header to GPL-2.0-only
Update file header to GPL-2.0-only.

Change-Id: Ic1542a3209a5fe73c937a5b36491ede4a451936d
Signed-off-by: Meng Wang <mengw@codeaurora.org>
2018-12-10 14:49:34 +08:00
Meng Wang
61af6849e9 ASoC: switch audio drivers to SPDX identifier
Switch audio drivers to SPDX identifier on msm-4.19.

Change-Id: Ic3f0230a516db251b8d81e8a7e73dbc04d66fe1b
Signed-off-by: Meng Wang <mengw@codeaurora.org>
2018-12-07 15:47:32 +08:00