Commit graph

19682 commits

Author SHA1 Message Date
Laxminath Kasam 7e17b8ec9b ASoC: msm: pass clk_div2 value when enable and disable
If clk_div2 is not set, it remains enabled even
when no session is running. Set the clk_div2 param
properly if mode is BOTH_VALID.

Change-Id: I26a6f6d2121a8f93410be4a128106ee0fc4212a2
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2016-05-04 11:11:30 -07:00
Laxminath Kasam 0517f5ae6f ASoC: dapm: Fix race condition with dapm mutex lock
In headset usecase, observe race condition for
dapm mutex lock. snd_soc_dapm_put_pin_switch,
snd_soc_dapm_force_enable_pin, snd_soc_dapm_set_pin
APIs are updated to handle the lock correctly.

Change-Id: I6910d28869dc172f80232f8fd6b11db10f52f59b
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2016-05-03 06:09:52 -07:00
Phani Kumar Uppalapati 4a6320a4c5 ASoC: wsa881x: Request device ungroup for speaker disable
Request device ungroup of speaker channels for independent
disable. It is possible that stereo speaker channels can be
disabled one after other, so remove them from group otherwise
speaker can be left in enabled state.

CRs-fixed: 1007465
Change-Id: I358ab4edcb85ec65b064ca28368ad744f2d36870
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
2016-05-03 04:51:21 -07:00
Ashish Jain 4aecfab390 ASoC: msm: qdsp6v2: DAP: Fix buffer overflow
Add check to avoid out of bound access.
Check return value of get_user api.

CRs-Fixed: 997025
Change-Id: Ibbace116ac206007fa1928555838285304737737
Signed-off-by: Ashish Jain <ashishj@codeaurora.org>
2016-04-29 03:21:36 -07:00
Santosh Mardi 39326a27dd ASoC: msm: critical tasha fixes for 48x2 frames
pulled in the changes from the below commits.

Ia4329ac982eb2a29a2b925897cd87ca9711c30e3
Ic0ab015098035418458a5ba7c2ffad9df20f933c
Ia091228b5a6e6d3dced2bee6cd5fecf5632a62a0

Change-Id: Ie89d37060a73a190f752eebf226c630a903f0c1b
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
2016-04-26 03:11:39 -07:00
Linux Build Service Account 29dd47b53a Merge "ASoC: WCD9335: important changes on tasha codec" 2016-04-18 09:47:50 -07:00
Santosh Mardi 6c21d6ca04 ASoC: WCD9335: important changes on tasha codec
Following commit ID's are propagated with this gerrit.

I3e3980e48ce19955b4230876887adfde5b44e8ea
I48b24d81e2047d4d4c299ca60cdbd299e172393e
Iae361cabf7b5194e12f5ddc8e32d60cf94bf28c3
I8b3271ee9af91b9e921957998e0fb074ffdebe86
I562f17363d7d38caece358a50d1e3f654d87491f

Change-Id: I1b8610f8333b91be5e2bf9ecacf916d4b25d3f54
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
2016-04-13 05:26:48 -07:00
Linux Build Service Account 7386fee655 Merge "ASoC: msm: donot set thresholds for moisture detection" 2016-04-13 04:27:41 -07:00
Linux Build Service Account a1ec19d175 Merge "ASoC: msm: critical tasha fixes" 2016-04-12 08:14:33 -07:00
Laxminath Kasam 86b7482e23 ASoC: msm8x16-wcd: Fix SSR mute issue on speaker
restore the cache values back of last state applied
in SSR recovery using snd_soc_cache_sync API. So
hardware codec configuration will be in sync with
userspace settings. And avoid any race condition
between the userspace updating dapm widgets and
SSR recovery updating any register value.

Change-Id: Ie2a986b5c6827b02aa3d5919cc69e7363155c45e
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2016-04-11 05:42:49 -07:00
Santosh Mardi 6203e5d262 ASoC: msm: critical tasha fixes
tasha fixes pulled in by the below change id.

I4ca4a554c0a83d4053301ca5dd2afb8b09fa5194
I2cb4447b36fef111ed1f9b8991b3882b8d57f6a7
I80ee0dedac8fa81ce54a0e61c839a97b9b45d36b

Change-Id: I258d5bb48a25f13e0c0f348a8f6a7bf1b38922d0
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
2016-03-22 13:04:44 +05:30
Yeleswarapu Nagaradhesh e1da4961c9 ASoC: msm: donot set thresholds for moisture detection
After enabling moisture detection and updating thresholds,
could see increase in codec power numbers during sleep.
So donot enable moisture detection.

CRs-Fixed: 991946
Change-Id: Iede49e4608a325c47ac2cd27cdb080730d822310
Signed-off-by: Yeleswarapu Nagaradhesh <nagaradh@codeaurora.org>
2016-03-18 18:39:32 +05:30
Takashi Iwai 86ac250ac1 ASoC: wm8958: Fix enum ctl accesses in a wrong type
commit d0784829ae3b0beeb69b476f017d5c8a2eb95198 upstream.

"MBC Mode", "VSS Mode", "VSS HPF Mode" and "Enhanced EQ Mode" ctls in
wm8958 codec driver are enum, while the current driver accesses
wrongly via value.integer.value[].  They have to be via
value.enumerated.item[] instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-16 08:41:36 -07:00
Takashi Iwai 2f2ba1da9c ASoC: wm8994: Fix enum ctl accesses in a wrong type
commit 8019c0b37cd5a87107808300a496388b777225bf upstream.

The DRC Mode like "AIF1DRC1 Mode" and EQ Mode like "AIF1.1 EQ Mode" in
wm8994 codec driver are enum ctls, while the current driver accesses
wrongly via value.integer.value[].  They have to be via
value.enumerated.item[] instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-16 08:41:36 -07:00
Linux Build Service Account 186fb6e30c Merge "ASoC: msm: critical tasha fixes" 2016-03-10 19:53:30 -08:00
Linux Build Service Account 386f581369 Merge "ASoC: msm8x16: update boost config register" 2016-03-10 08:38:59 -08:00
Santosh Mardi 1adeaee336 ASoC: msm: critical tasha fixes
tasha fixes pulled in by the below change id.

I7d7c3243c63cd3b9242a15344ecdae89ec9ee977
I30ed6a337c3bb08f6197f7ee575b323f0b0acfac
I585a81e6c01b4ddd249f76614fb933beea3755fc
I744bafb78560f39806d656c98582d8162fa10dfd
I256d183b830c9addf1bd07264c2ed9b069762a36

Change-Id: Iaec182b20f5db96b09d26ae0b1e8cdf964abc272
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
2016-03-10 16:09:45 +05:30
Takashi Iwai f196347faf ALSA: timer: Fix broken compat timer user status ioctl
commit 3a72494ac2a3bd229db941d51e7efe2f6ccd947b upstream.

The timer user status compat ioctl returned the bogus struct used for
64bit architectures instead of the 32bit one.  This patch addresses
it to return the proper struct.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-09 15:31:55 -08:00
Takashi Iwai 080c4a4464 ALSA: hdspm: Fix zero-division
commit c1099c3294c2344110085a38c50e478a5992b368 upstream.

HDSPM driver contains a code issuing zero-division potentially in
system sample rate ctl code.  This patch fixes it by not processing
a zero or invalid rate value as a divisor, as well as excluding the
invalid value to be passed via the given ctl element.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-09 15:31:55 -08:00
Takashi Iwai e3d2f69800 ALSA: hdsp: Fix wrong boolean ctl value accesses
commit eab3c4db193f5fcccf70e884de9a922ca2c63d80 upstream.

snd-hdsp driver accesses enum item values (int) instead of boolean
values (long) wrongly for some ctl elements.  This patch fixes them.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-09 15:31:55 -08:00
Takashi Iwai b8834e4fe7 ALSA: hdspm: Fix wrong boolean ctl value accesses
commit 537e48136295c5860a92138c5ea3959b9542868b upstream.

snd-hdspm driver accesses enum item values (int) instead of boolean
values (long) wrongly for some ctl elements.  This patch fixes them.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-09 15:31:55 -08:00
Takashi Iwai e21cf1926a ALSA: seq: oss: Don't drain at closing a client
commit 197b958c1e76a575d77038cc98b4bebc2134279f upstream.

The OSS sequencer client tries to drain the pending events at
releasing.  Unfortunately, as spotted by syzkaller fuzzer, this may
lead to an unkillable process state when the event has been queued at
the far future.  Since the process being released can't be signaled
any longer, it remains and waits for the echo-back event in that far
future.

Back to history, the draining feature was implemented at the time we
misinterpreted POSIX definition for blocking file operation.
Actually, such a behavior is superfluous at release, and we should
just release the device as is instead of keeping it up forever.

This patch just removes the draining call that may block the release
for too long time unexpectedly.

BugLink: http://lkml.kernel.org/r/CACT4Y+Y4kD-aBGj37rf-xBw9bH3GMU6P+MYg4W1e-s-paVD2pg@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-09 15:31:55 -08:00
Takashi Iwai 3d0c02d2c0 ALSA: timer: Fix ioctls for X32 ABI
commit b24e7ad1fdc22177eb3e51584e1cfcb45d818488 upstream.

X32 ABI takes the 64bit timespec, thus the timer user status ioctl becomes
incompatible with IA32.  This results in NOTTY error when the ioctl is
issued.

Meanwhile, this struct in X32 is essentially identical with the one in
X86-64, so we can just bypassing to the existing code for this
specific compat ioctl.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-09 15:31:55 -08:00
Takashi Iwai f6e8594354 ALSA: rawmidi: Fix ioctls X32 ABI
commit 2251fbbc1539f05b0b206b37a602d5776be37252 upstream.

Like the previous fixes for ctl and PCM, we need a fix for
incompatible X32 ABI regarding the rawmidi: namely, struct
snd_rawmidi_status has the timespec, and the size and the alignment on
X32 differ from IA32.

This patch fixes the incompatible ioctl for X32.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-09 15:31:55 -08:00
Takashi Iwai 6146f38b33 ALSA: ctl: Fix ioctls for X32 ABI
commit 6236d8bb2afcfe71b88ecea554e0dc638090a45f upstream.

The X32 ABI takes the same alignment like x86-64, and this may result
in the incompatible struct size from ia32.  Unfortunately, we hit this
in some control ABI: struct snd_ctl_elem_value differs between them
due to the position of 64bit variable array.  This ends up with the
unknown ioctl (ENOTTY) error.

The fix is to add the compat entries for the new aligned struct.

Reported-and-tested-by: Steven Newbury <steve@snewbury.org.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-09 15:31:55 -08:00
Santosh Mardi 960f83a1a9 ASoC: msm8x16: update boost config register
For the targets not using boost and boost pin is kept
floating there will be high change that VDD_A53 will be
grounded and MSM will not be responsive

After discussing with PMIC systems team SBL team came up
with the work around to configure the boost register to some
pre defined values so that the issue is not reproduced.

As part of the codec init sequence the codec driver will
reset the analog part of the codec and as part of this sequence
the cofiguration done by the SBL will be defaulted.

This change will restore the 0x1C6 register if it has been configured
by SBL

Change-Id: I1a58b665b01e70bbb21b06665a8fb422d77a5ee7
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
2016-03-07 21:24:40 -08:00
Phani Kumar Uppalapati 632b5da9b4 ASoC: wcd9335: Update TX gain correctly after decimator enable
Gain for TX decimator block needs to be set after the
corresponding decimator is enabled. Otherwise, gain will
not take affect. Apply the gain by reading from regmap cache
to the codec decimator hardware after decimator is enabled.

CRs-fixed: 982473
Change-Id: Ib2d189b56e58b038a343fc974e6e3b8ef29f982d
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
2016-02-29 22:04:04 -08:00
Takashi Iwai 549584e9e1 ALSA: seq: Fix double port list deletion
commit 13d5e5d4725c64ec06040d636832e78453f477b7 upstream.

The commit [7f0973e973cd: ALSA: seq: Fix lockdep warnings due to
double mutex locks] split the management of two linked lists (source
and destination) into two individual calls for avoiding the AB/BA
deadlock.  However, this may leave the possible double deletion of one
of two lists when the counterpart is being deleted concurrently.
It ends up with a list corruption, as revealed by syzkaller fuzzer.

This patch fixes it by checking the list emptiness and skipping the
deletion and the following process.

BugLink: http://lkml.kernel.org/r/CACT4Y+bay9qsrz6dQu31EcGaH9XwfW7o3oBzSQUG9fMszoh=Sg@mail.gmail.com
Fixes: 7f0973e973cd ('ALSA: seq: Fix lockdep warnings due to 'double mutex locks)
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 11:57:46 -08:00
Takashi Iwai 49911dcd76 ALSA: timer: Fix race between stop and interrupt
commit ed8b1d6d2c741ab26d60d499d7fbb7ac801f0f51 upstream.

A slave timer element also unlinks at snd_timer_stop() but it takes
only slave_active_lock.  When a slave is assigned to a master,
however, this may become a race against the master's interrupt
handling, eventually resulting in a list corruption.  The actual bug
could be seen with a syzkaller fuzzer test case in BugLink below.

As a fix, we need to take timeri->timer->lock when timer isn't NULL,
i.e. assigned to a master, while the assignment to a master itself is
protected by slave_active_lock.

BugLink: http://lkml.kernel.org/r/CACT4Y+Y_Bm+7epAb=8Wi=AaWd+DYS7qawX52qxdCfOfY49vozQ@mail.gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:40 -08:00
Takashi Iwai e063b1a0b8 ALSA: dummy: Implement timer backend switching more safely
commit ddce57a6f0a2d8d1bfacfa77f06043bc760403c2 upstream.

Currently the selected timer backend is referred at any moment from
the running PCM callbacks.  When the backend is switched, it's
possible to lead to inconsistency from the running backend.  This was
pointed by syzkaller fuzzer, and the commit [7ee96216c31a: ALSA:
dummy: Disable switching timer backend via sysfs] disabled the dynamic
switching for avoiding the crash.

This patch improves the handling of timer backend switching.  It keeps
the reference to the selected backend during the whole operation of an
opened stream so that it won't be changed by other streams.

Together with this change, the hrtimer parameter is reenabled as
writable now.

NOTE: this patch also turned out to fix the still remaining race.
Namely, ops was still replaced dynamically at dummy_pcm_open:

  static int dummy_pcm_open(struct snd_pcm_substream *substream)
  {
  ....
          dummy->timer_ops = &dummy_systimer_ops;
          if (hrtimer)
                  dummy->timer_ops = &dummy_hrtimer_ops;

Since dummy->timer_ops is common among all streams, and when the
replacement happens during accesses of other streams, it may lead to a
crash.  This was actually triggered by syzkaller fuzzer and KASAN.

This patch rewrites the code not to use the ops shared by all streams
any longer, too.

BugLink: http://lkml.kernel.org/r/CACT4Y+aZ+xisrpuM6cOXbL21DuM0yVxPYXf4cD4Md9uw0C3dBQ@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:40 -08:00
Takashi Iwai c5929da4dd ALSA: hda - Fix speaker output from VAIO AiO machines
commit c44d9b1181cf34e0860c72cc8a00e0c47417aac0 upstream.

Some Sony VAIO AiO models (VGC-JS4EF and VGC-JS25G, both with PCI SSID
104d:9044) need the same quirk to make the speaker working properly.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=112031
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:40 -08:00
Takashi Iwai 538d254bc8 ALSA: timer: Fix wrong instance passed to slave callbacks
commit 117159f0b9d392fb433a7871426fad50317f06f7 upstream.

In snd_timer_notify1(), the wrong timer instance was passed for slave
ccallback function.  This leads to the access to the wrong data when
an incompatible master is handled (e.g. the master is the sequencer
timer and the slave is a user timer), as spotted by syzkaller fuzzer.

This patch fixes that wrong assignment.

BugLink: http://lkml.kernel.org/r/CACT4Y+Y_Bm+7epAb=8Wi=AaWd+DYS7qawX52qxdCfOfY49vozQ@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:40 -08:00
Takashi Iwai 8a778712b2 ALSA: timer: Fix link corruption due to double start or stop
commit f784beb75ce82f4136f8a0960d3ee872f7109e09 upstream.

Although ALSA timer code got hardening for races, it still causes
use-after-free error.  This is however rather a corrupted linked list,
not actually the concurrent accesses.  Namely, when timer start is
triggered twice, list_add_tail() is called twice, too.  This ends
up with the link corruption and triggers KASAN error.

The simplest fix would be replacing list_add_tail() with
list_move_tail(), but fundamentally it's the problem that we don't
check the double start/stop correctly.  So, the right fix here is to
add the proper checks to snd_timer_start() and snd_timer_stop() (and
their variants).

BugLink: http://lkml.kernel.org/r/CACT4Y+ZyPRoMQjmawbvmCEDrkBD2BQuH7R09=eOkf5ESK8kJAw@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:40 -08:00
Takashi Iwai 732bc470a1 ALSA: timer: Fix leftover link at closing
commit 094fd3be87b0f102589e2d5c3fa5d06b7e20496d upstream.

In ALSA timer core, the active timer instance is managed in
active_list linked list.  Each element is added / removed dynamically
at timer start, stop and in timer interrupt.  The problem is that
snd_timer_interrupt() has a thinko and leaves the element in
active_list when it's the last opened element.  This eventually leads
to list corruption or use-after-free error.

This hasn't been revealed because we used to delete the list forcibly
in snd_timer_stop() in the past.  However, the recent fix avoids the
double-stop behavior (in commit [f784beb75ce8: ALSA: timer: Fix link
corruption due to double start or stop]), and this leak hits reality.

This patch fixes the link management in snd_timer_interrupt().  Now it
simply unlinks no matter which stream is.

BugLink: http://lkml.kernel.org/r/CACT4Y+Yy2aukHP-EDp8-ziNqNNmb-NTf=jDWXMP7jB8HDa2vng@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:40 -08:00
Takashi Iwai 51e9bd72a0 ALSA: timer: Code cleanup
commit c3b1681375dc6e71d89a3ae00cc3ce9e775a8917 upstream.

This is a minor code cleanup without any functional changes:
- Kill keep_flag argument from _snd_timer_stop(), as all callers pass
  only it false.
- Remove redundant NULL check in _snd_timer_stop().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:40 -08:00
Takashi Iwai e53ec49239 ALSA: seq: Fix lockdep warnings due to double mutex locks
commit 7f0973e973cd74aa40747c9d38844560cd184ee8 upstream.

The port subscription code uses double mutex locks for source and
destination ports, and this may become racy once when wrongly set up.
It leads to lockdep warning splat, typically triggered by fuzzer like
syzkaller, although the actual deadlock hasn't been seen, so far.

This patch simplifies the handling by reducing to two single locks, so
that no lockdep warning will be trigger any longer.

By splitting to two actions, a still-in-progress element shall be
added in one list while handling another.  For ignoring this element,
a new check is added in deliver_to_subscribers().

Along with it, the code to add/remove the subscribers list element was
cleaned up and refactored.

BugLink: http://lkml.kernel.org/r/CACT4Y+aKQXV7xkBW9hpQbzaDO7LrUvohxWh-UwMxXjDy-yBD=A@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:39 -08:00
Takashi Iwai 14bdca3fa4 ALSA: seq: Fix race at closing in virmidi driver
commit 2d1b5c08366acd46c35a2e9aba5d650cb5bf5c19 upstream.

The virmidi driver has an open race at closing its assigned rawmidi
device, and this may lead to use-after-free in
snd_seq_deliver_single_event().

Plug the hole by properly protecting the linked list deletion and
calling in the right order in snd_virmidi_input_close().

BugLink: http://lkml.kernel.org/r/CACT4Y+Zd66+w12fNN85-425cVQT=K23kWbhnCEcMB8s3us-Frw@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:39 -08:00
Takashi Iwai 4df6314c22 ALSA: seq: Fix yet another races among ALSA timer accesses
commit 2cdc7b636d55cbcf42e1e6c8accd85e62d3e9ae8 upstream.

ALSA sequencer may open/close and control ALSA timer instance
dynamically either via sequencer events or direct ioctls.  These are
done mostly asynchronously, and it may call still some timer action
like snd_timer_start() while another is calling snd_timer_close().
Since the instance gets removed by snd_timer_close(), it may lead to
a use-after-free.

This patch tries to address such a race by protecting each
snd_timer_*() call via the existing spinlock and also by avoiding the
access to timer during close call.

BugLink: http://lkml.kernel.org/r/CACT4Y+Z6RzW5MBr-HUdV-8zwg71WQfKTdPpYGvOeS7v4cyurNQ@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:39 -08:00
Vinod Koul f042b75af1 ASoC: dpcm: fix the BE state on hw_free
commit 5e82d2be6ee53275c72e964507518d7964c82753 upstream.

While performing hw_free, DPCM checks the BE state but leaves out
the suspend state. The suspend state needs to be checked as well,
as we might be suspended and then usermode closes rather than
resuming the audio stream.

This was found by a stress testing of system with playback in
loop and killed after few seconds running in background and second
script running suspend-resume test in loop

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:39 -08:00
Takashi Iwai aae80d6591 ALSA: pcm: Fix potential deadlock in OSS emulation
commit b248371628aad599a48540962f6b85a21a8a0c3f upstream.

There are potential deadlocks in PCM OSS emulation code while
accessing read/write and mmap concurrently.  This comes from the
infamous mmap_sem usage in copy_from/to_user().  Namely,

   snd_pcm_oss_write() ->
     &runtime->oss.params_lock ->
        copy_to_user() ->
          &mm->mmap_sem
  mmap() ->
    &mm->mmap_sem ->
      snd_pcm_oss_mmap() ->
        &runtime->oss.params_lock

Since we can't avoid taking params_lock from mmap code path, use
trylock variant and aborts with -EAGAIN as a workaround of this AB/BA
deadlock.

BugLink: http://lkml.kernel.org/r/CACT4Y+bVrBKDG0G2_AcUgUQa+X91VKTeS4v+wN7BSHwHtqn3kQ@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:39 -08:00
Takashi Iwai 264df9ec4e ALSA: rawmidi: Fix race at copying & updating the position
commit 81f577542af15640cbcb6ef68baa4caa610cbbfc upstream.

The rawmidi read and write functions manage runtime stream status
such as runtime->appl_ptr and runtime->avail.  These point where to
copy the new data and how many bytes have been copied (or to be
read).  The problem is that rawmidi read/write call copy_from_user()
or copy_to_user(), and the runtime spinlock is temporarily unlocked
and relocked while copying user-space.  Since the current code
advances and updates the runtime status after the spin unlock/relock,
the copy and the update may be asynchronous, and eventually
runtime->avail might go to a negative value when many concurrent
accesses are done.  This may lead to memory corruption in the end.

For fixing this race, in this patch, the status update code is
performed in the same lock before the temporary unlock.  Also, the
spinlock is now taken more widely in snd_rawmidi_kernel_read1() for
protecting more properly during the whole operation.

BugLink: http://lkml.kernel.org/r/CACT4Y+b-dCmNf1GpgPKfDO0ih+uZCL2JV4__j-r1kdhPLSgQCQ@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:39 -08:00
Takashi Iwai f6cbda794b ALSA: rawmidi: Remove kernel WARNING for NULL user-space buffer check
commit cc85f7a634cfaf9f0713c6aa06d08817424db37a upstream.

NULL user-space buffer can be passed even in a normal path, thus it's
not good to spew a kernel warning with stack trace at each time.
Just drop snd_BUG_ON() macro usage there.

BugLink: http://lkml.kernel.org/r/CACT4Y+YfVJ3L+q0i-4vyQVyyPD7V=OMX0PWPi29x9Bo3QaBLdw@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:39 -08:00
Takashi Iwai a04cbfbf93 ALSA: seq: Fix incorrect sanity check at snd_seq_oss_synth_cleanup()
commit 599151336638d57b98d92338aa59c048e3a3e97d upstream.

ALSA sequencer OSS emulation code has a sanity check for currently
opened devices, but there is a thinko there, eventually it spews
warnings and skips the operation wrongly like:
  WARNING: CPU: 1 PID: 7573 at sound/core/seq/oss/seq_oss_synth.c:311

Fix this off-by-one error.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:39 -08:00
Takashi Iwai 3e24e598a4 ALSA: dummy: Disable switching timer backend via sysfs
commit 7ee96216c31aabe1eb42fb91ff50dae9fcd014b2 upstream.

ALSA dummy driver can switch the timer backend between system timer
and hrtimer via its hrtimer module option.  This can be also switched
dynamically via sysfs, but it may lead to a memory corruption when
switching is done while a PCM stream is running; the stream instance
for the newly switched timer method tries to access the memory that
was allocated by another timer method although the sizes differ.

As the simplest fix, this patch just disables the switch via sysfs by
dropping the writable bit.

BugLink: http://lkml.kernel.org/r/CACT4Y+ZGEeEBntHW5WHn2GoeE0G_kRrCmUh6=dWyy-wfzvuJLg@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:39 -08:00
Takashi Iwai 074e46b6e2 ALSA: compress: Disable GET_CODEC_CAPS ioctl for some architectures
commit 462b3f161beb62eeb290f4ec52f5ead29a2f8ac7 upstream.

Some architectures like PowerPC can handle the maximum struct size in
an ioctl only up to 13 bits, and struct snd_compr_codec_caps used by
SNDRV_COMPRESS_GET_CODEC_CAPS ioctl overflows this limit.  This
problem was revealed recently by a powerpc change, as it's now treated
as a fatal build error.

This patch is a stop-gap for that: for architectures with less than 14
bit ioctl struct size, get rid of the handling of the relevant ioctl.
We should provide an alternative equivalent ioctl code later, but for
now just paper over it.  Luckily, the compress API hasn't been used on
such architectures, so the impact must be effectively zero.

Reviewed-by: Mark Brown <broonie@kernel.org>
Acked-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:39 -08:00
Andrey Konovalov 482c4c1a74 ALSA: usb-audio: avoid freeing umidi object twice
commit 07d86ca93db7e5cdf4743564d98292042ec21af7 upstream.

The 'umidi' object will be free'd on the error path by snd_usbmidi_free()
when tearing down the rawmidi interface. So we shouldn't try to free it
in snd_usbmidi_create() after having registered the rawmidi interface.

Found by KASAN.

Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:39 -08:00
Guillaume Fougnies fc34588578 ALSA: usb-audio: Fix TEAC UD-501/UD-503/NT-503 usb delay
commit 5a4ff9ec8d6edd2ab1cfe8ce6a080d6e57cbea9a upstream.

TEAC UD-501/UD-503/NT-503 fail to switch properly between different
rate/format. Similar to 'Playback Design', this patch corrects the
invalid clock source error for TEAC products and avoids complete
freeze of the usb interface of 503 series.

Signed-off-by: Guillaume Fougnies <guillaume@eulerian.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-19 14:22:39 -08:00
Linux Build Service Account ac29f66c3b Merge "ASoC: wcd-mbhc: Add pointer validation checks in wcd-mbhc-v2.c" 2016-02-09 02:52:10 -08:00
Karthik Reddy Katta bfc2d94474 ASoC: wcd-mbhc: Add pointer validation checks in wcd-mbhc-v2.c
Check if 'mbhc_cb' is NULL in wcd_mbhc_stop() before
dereferrencing.

CRs-Fixed: 972101
Change-Id: I3b2348bddb071e5bf7bc2e5d6885bb3c1ba2c195
Signed-off-by: Karthik Reddy Katta <a_katta@codeaurora.org>
2016-02-07 07:17:26 +05:30
Santosh Mardi c0836c8365 ASoC: wcd9335: fix pop during CLS-AB mode
Pop is observed during starting of the playback in
CLS-AB mode. Fix the pop issue by updating register
sequence properly.

Change-Id: Iff17245e8a2b14354cc99150a57394ce81ec29b8
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
2016-02-01 22:58:47 +05:30
Santosh Mardi ced48f7a4a ASoC: wcd9335: update codec driver according to QCRG 22
Update codec driver in compliance with the codec device bring up
and tear down,

Also include the critical fixes in codec driver fixed.

Change-Id: I7a468a40f18315fe8a065f13b05e7410a8d54b4c
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
2016-02-01 22:52:44 +05:30
Bhalchandra Gajare 0f2881a424 ASoC: wcd_cpe: Fix message queue list corruption
When clients are trying to send message while the worker thread is
processing existing messages, there is possibility that the message
queue can get corrupted. This can result into kernel crash. Fix to make
sure the message queue does not get corrupted.

CRs-fixed: 951194
Change-Id: I1eb5232d9d079ecc9d28b95737333c1198a8b20c
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2016-01-31 21:10:04 -08:00
Vinod Koul 9a76e683b6 ASoC: compress: Fix compress device direction check
commit a1068045883ed4a18363a4ebad0c3d55e473b716 upstream.

The detection of direction for compress was only taking into account codec
capabilities and not CPU ones. Fix this by checking the CPU side capabilities
as well

Tested-by: Ashish Panwar <ashish.panwar@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:31 -08:00
Nikesh Oswal 1702ac2fae ASoC: arizona: Fix bclk for sample rates that are multiple of 4kHz
commit e73694d871867cae8471d2350ce89acb38bc2b63 upstream.

For a sample rate of 12kHz the bclk was taken from the 44.1kHz table as
we test for a multiple of 8kHz. This patch fixes this issue by testing
for multiples of 4kHz instead.

Signed-off-by: Nikesh Oswal <Nikesh.Oswal@cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:31 -08:00
Sachin Pandhare 48436c8169 ASoC: wm8962: correct addresses for HPF_C_0/1
commit e9f96bc53c1b959859599cb30ce6fd4fbb4448c2 upstream.

From datasheet:
R17408 (4400h) HPF_C_1
R17409 (4401h) HPF_C_0
17048 -> 17408 (0x4400)
17049 -> 17409 (0x4401)

Signed-off-by: Sachin Pandhare <sachinpandhare@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:31 -08:00
Takashi Iwai 2f659690fc ALSA: control: Avoid kernel warnings from tlv ioctl with numid 0
commit c0bcdbdff3ff73a54161fca3cb8b6cdbd0bb8762 upstream.

When a TLV ioctl with numid zero is handled, the driver may spew a
kernel warning with a stack trace at each call.  The check was
intended obviously only for a kernel driver, but not for a user
interaction.  Let's fix it.

This was spotted by syzkaller fuzzer.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:30 -08:00
Takashi Iwai d24455ed4c ALSA: hrtimer: Fix stall by hrtimer_cancel()
commit 2ba1fe7a06d3624f9a7586d672b55f08f7c670f3 upstream.

hrtimer_cancel() waits for the completion from the callback, thus it
must not be called inside the callback itself.  This was already a
problem in the past with ALSA hrtimer driver, and the early commit
[fcfdebe70759: ALSA: hrtimer - Fix lock-up] tried to address it.

However, the previous fix is still insufficient: it may still cause a
lockup when the ALSA timer instance reprograms itself in its callback.
Then it invokes the start function even in snd_timer_interrupt() that
is called in hrtimer callback itself, results in a CPU stall.  This is
no hypothetical problem but actually triggered by syzkaller fuzzer.

This patch tries to fix the issue again.  Now we call
hrtimer_try_to_cancel() at both start and stop functions so that it
won't fall into a deadlock, yet giving some chance to cancel the queue
if the functions have been called outside the callback.  The proper
hrtimer_cancel() is called in anyway at closing, so this should be
enough.

Reported-and-tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:30 -08:00
Nicolas Boichat 425b1bc0dd ALSA: pcm: Fix snd_pcm_hw_params struct copy in compat mode
commit 43c54b8c7cfe22f868a751ba8a59abf1724160b1 upstream.

This reverts one hunk of
commit ef44a1ec6e ("ALSA: sound/core: use memdup_user()"), which
replaced a number of kmalloc followed by memcpy with memdup calls.

In this case, we are copying from a struct snd_pcm_hw_params32 to
a struct snd_pcm_hw_params, but the latter is 4 bytes longer than
the 32-bit version, so we need to separate kmalloc and copy calls.

This actually leads to an out-of-bounds memory access later on
in sound/soc/soc-pcm.c:soc_pcm_hw_params() (detected using KASan).

Fixes: ef44a1ec6e ('ALSA: sound/core: use memdup_user()')
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:30 -08:00
Nicolas Boichat 870566bafc ALSA: seq: Fix snd_seq_call_port_info_ioctl in compat mode
commit 9586495dc3011a80602329094e746dbce16cb1f1 upstream.

This reverts one hunk of
commit ef44a1ec6e ("ALSA: sound/core: use memdup_user()"), which
replaced a number of kmalloc followed by memcpy with memdup calls.

In this case, we are copying from a struct snd_seq_port_info32 to a
struct snd_seq_port_info, but the latter is 4 bytes longer than the
32-bit version, so we need to separate kmalloc and copy calls.

Fixes: ef44a1ec6e ('ALSA: sound/core: use memdup_user()')
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:30 -08:00
Takashi Iwai fd6788c0ba ALSA: timer: Fix double unlink of active_list
commit ee8413b01045c74340aa13ad5bdf905de32be736 upstream.

ALSA timer instance object has a couple of linked lists and they are
unlinked unconditionally at snd_timer_stop().  Meanwhile
snd_timer_interrupt() unlinks it, but it calls list_del() which leaves
the element list itself unchanged.  This ends up with unlinking twice,
and it was caught by syzkaller fuzzer.

The fix is to use list_del_init() variant properly there, too.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:30 -08:00
Takashi Iwai a49bdee155 ALSA: timer: Fix race among timer ioctls
commit af368027a49a751d6ff4ee9e3f9961f35bb4fede upstream.

ALSA timer ioctls have an open race and this may lead to a
use-after-free of timer instance object.  A simplistic fix is to make
each ioctl exclusive.  We have already tread_sem for controlling the
tread, and extend this as a global mutex to be applied to each ioctl.

The downside is, of course, the worse concurrency.  But these ioctls
aren't to be parallel accessible, in anyway, so it should be fine to
serialize there.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:30 -08:00
Takashi Iwai ea83c96e84 ALSA: timer: Harden slave timer list handling
commit b5a663aa426f4884c71cd8580adae73f33570f0d upstream.

A slave timer instance might be still accessible in a racy way while
operating the master instance as it lacks of locking.  Since the
master operation is mostly protected with timer->lock, we should cope
with it while changing the slave instance, too.  Also, some linked
lists (active_list and ack_list) of slave instances aren't unlinked
immediately at stopping or closing, and this may lead to unexpected
accesses.

This patch tries to address these issues.  It adds spin lock of
timer->lock (either from master or slave, which is equivalent) in a
few places.  For avoiding a deadlock, we ensure that the global
slave_active_lock is always locked at first before each timer lock.

Also, ack and active_list of slave instances are properly unlinked at
snd_timer_stop() and snd_timer_close().

Last but not least, remove the superfluous call of _snd_timer_stop()
at removing slave links.  This is a noop, and calling it may confuse
readers wrt locking.  Further cleanup will follow in a later patch.

Actually we've got reports of use-after-free by syzkaller fuzzer, and
this hopefully fixes these issues.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:30 -08:00
Takashi Iwai 6e29b1cc30 ALSA: seq: Fix race at timer setup and close
commit 3567eb6af614dac436c4b16a8d426f9faed639b3 upstream.

ALSA sequencer code has an open race between the timer setup ioctl and
the close of the client.  This was triggered by syzkaller fuzzer, and
a use-after-free was caught there as a result.

This patch papers over it by adding a proper queue->timer_mutex lock
around the timer-related calls in the relevant code path.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:30 -08:00
Takashi Iwai b85a6198e2 ALSA: seq: Fix missing NULL check at remove_events ioctl
commit 030e2c78d3a91dd0d27fef37e91950dde333eba1 upstream.

snd_seq_ioctl_remove_events() calls snd_seq_fifo_clear()
unconditionally even if there is no FIFO assigned, and this leads to
an Oops due to NULL dereference.  The fix is just to add a proper NULL
check.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:29 -08:00
Mario Kleiner 9cb16b5349 ALSA: hda/realtek - Fix silent headphone output on MacPro 4,1 (v2)
commit 9f660a1c43890c2cdd1f423fd73654e7ca08fe56 upstream.

Without this patch, internal speaker and line-out work,
but front headphone output jack stays silent on the
Mac Pro 4,1.

This code path also gets executed on the MacPro 5,1 due
to identical codec SSID, but i don't know if it has any
positive or adverse effects there or not.

(v2) Implement feedback from Takashi Iwai: Reuse
     alc889_fixup_mbp_vref and just add a new nid
     0x19 for the MacPro 4,1.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:29 -08:00
Xiong Zhang 4b98be841c ALSA: hda - Set SKL+ hda controller power at freeze() and thaw()
commit 3e6db33aaf1d42a30339f831ec4850570d6cc7a3 upstream.

It takes three minutes to enter into hibernation on some OEM SKL
machines and we see many codec spurious response after thaw() opertion.
This is because HDA is still in D0 state after freeze() call and
pci_pm_freeze/pci_pm_freeze_noirq() don't set D3 hot in pci_bus driver.
It seems bios still access HDA when system enter into freeze state,
HDA will receive codec response interrupt immediately after thaw() call.
Because of this unexpected interrupt, HDA enter into a abnormal
state and slow down the system enter into hibernation.

In this patch, we put HDA into D3 hot state in azx_freeze_noirq() and
put HDA into D0 state in azx_thaw_noirq().

V2: Only apply this fix to SKL+
    Fix compile error when CONFIG_PM_SLEEP isn't defined

[Yet another fix for CONFIG_PM_SLEEP ifdef and the additional comment
 by tiwai]

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:29 -08:00
David Henningsson ae8ca6a019 ALSA: hda - Add inverted dmic for Packard Bell DOTS
commit 02f6ff90400d055f08b0ba0b5f0707630b6faed7 upstream.

On the internal mic of the Packard Bell DOTS, one channel
has an inverted signal. Add a quirk to fix this up.

BugLink: https://bugs.launchpad.net/bugs/1523232
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:29 -08:00
Takashi Iwai 43702b71b4 ALSA: rme96: Fix unexpected volume reset after rate changes
commit a74a821624c0c75388a193337babd17a8c02c740 upstream.

rme96 driver needs to reset DAC depending on the sample rate, and this
results in resetting to the max volume suddenly.  It's because of the
missing call of snd_rme96_apply_dac_volume().

However, calling this function right after the DAC reset still may not
work, and we need some delay before this call.  Since the DAC reset
and the procedure after that are performed in the spinlock, we delay
the DAC volume restore at the end after the spinlock.

Reported-and-tested-by: Sylvain LABOISNE <maeda1@free.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:29 -08:00
Takashi Iwai b768cd78b5 ALSA: hda - Apply pin fixup for HP ProBook 6550b
commit c932b98c1e47312822d911c1bb76e81ef50e389c upstream.

HP ProBook 6550b needs the same pin fixup applied to other HP B-series
laptops with docks for making its headphone and dock headphone jacks
working properly.  We just need to add the codec SSID to the list.

Bugzilla: https://bugzilla.kernel.org/attachment.cgi?id=191971
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:29 -08:00
Alexandra Yates 6e14ea99a6 ALSA: hda - Add Intel Lewisburg device IDs Audio
commit 5cf92c8b3dc5da59e05dc81bdc069cedf6f38313 upstream.

Adding Intel codename Lewisburg platform device IDs for audio.

[rearranged the position by tiwai]

Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:29 -08:00
Banajit Goswami 6dc16be24f ASoC: wcd_cpe_core: fix minor version for CPE commands
Minor version for some of the CPE commands should be
of value "1". Update the minor versions appropriately
for some of the CPE commands.

Change-Id: I034bbe156aab57410aa629f531b9c1eec3489b4f
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
2016-01-12 21:24:06 -08:00
Linux Build Service Account 439728d4bc Merge "ASoC: wcd9335: fix mute issue on headphone during concurrency" 2016-01-12 09:40:05 -08:00
Vidyakumar Athota 8cb35f09d0 ASoC: wcd9335: fix mute issue on headphone during concurrency
Currently class-H controller is not enabled when lineout is enabled
first and then headphone is enabled.  Because of this mute is observed
on headphone during lineout and headphone concurrent scenarios. Fix
mute on headphone by enabling class H block during concurrency also.

Change-Id: Ibed962eaacf87c3eb55c569d2ae9c6363a63cace
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
2016-01-11 01:13:54 -08:00
Bhalchandra Gajare 7a75d9ed2a ASoC: msm-cpe: Fix sequence for data channel teardown
The data channel for buffering has two endpoints, one on the MSM and
another on the codec. When codec endpoint is torn down, it waits for an
interrupt for channel teardown from hardware. But, since MSM endpoint is
still connected, the interrupt is never receieved and the codec wait
gets timed out. This adds delay in data channel teardown. Fix this issue
by making sure the MSM endpoint is torn down first and then the codec
endpoint gets torn down.

CRs-fixed: 940132
Change-Id: Ie6529e9269aa29fb3d312b816c3d83e9e3e6e10e
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2016-01-10 21:47:39 -08:00
Bhalchandra Gajare 93bf48e2f8 ASoC: msm-cpe-lsm: Improve handling of errors during buffering
The channel setup errors are not handled in some cases, add fix to
handle the errors gracefully for look ahead buffering.

CRs-fixed: 943741
Change-Id: Ifbaf8a05e0e1f4c7e099a1664e914d430345ee37
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2016-01-07 03:36:52 -08:00
Bhalchandra Gajare 135b4bfbbd ASoC: wcd_cpe_core: Fix race conditions during message transfer
Currently, it is possible there could be race condition when there are
multiple messages to be sent to CPE. Add changes to fix the possible
race conditions.

CRs-fixed: 946375
Change-Id: I6a290c00b08fa3afc64acf40cd339a0203f73d96
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2015-12-28 15:35:59 +05:30
Linux Build Service Account 3d614e166e Merge "ASoC: msm-lsm-client: free lsm client data in msm_lsm_close" 2015-12-25 00:36:24 -08:00
Linux Build Service Account 331b4090c5 Merge "ASoC: wcd_cpe_core: Perform irq cleanup once the bus is up" 2015-12-25 00:36:23 -08:00
Linux Build Service Account c0b938d67e Merge "ASoC: wcd9335: Fix internal clock enable during SSR" 2015-12-24 18:09:23 -08:00
Vidyakumar Athota 546f362e97 ASoC: msm-lsm-client: free lsm client data in msm_lsm_close
Currently lsm client data is deallocated when q6lsm_open() fails
which can cause memory corruption if lsm client data is accessed
after freed. Fix this issue by deallocating the client data only
in msm_lsm_close().

Change-Id: If048c26a0ffd8a346a28622183cbf2ba1e7e5ff3
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
2015-12-24 01:53:33 -08:00
Bhalchandra Gajare cf46be12f9 ASoC: wcd_cpe_core: Perform irq cleanup once the bus is up
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>
2015-12-24 01:51:30 -08:00
Bhalchandra Gajare 68136bf124 ASoC: wcd9335: Fix internal clock enable during SSR
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>
2015-12-24 01:50:21 -08:00
Bhalchandra Gajare 7db6403fbb ASoC: wcd_cpe_services: Clear internal state before notifying clients
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>
2015-12-23 02:35:18 -08:00
Linux Build Service Account 7b296b52d9 Merge "ASoC: wcd_cpe_services: delete the redundant worker thread" 2015-12-22 04:47:05 -08:00
Linux Build Service Account d23b7aeec2 Merge "ASoC: wcd_cpe_services: Fix DRAM size for WCD9335" 2015-12-22 04:47:01 -08:00
Linux Build Service Account 6495302484 Merge "ASoC: wcd_cpe_core: Fix address and size for ramdumps" 2015-12-22 04:47:00 -08:00
Linux Build Service Account 2dba80e36f Merge "ASoC: msm-cpe-lsm: Fix out of memory on buffer allocation" 2015-12-22 04:46:59 -08:00
Linux Build Service Account fd175ae6f5 Merge "ASoC: wcd-mbhc: reduce insert and remove debounce on wcd9335" 2015-12-22 04:46:58 -08:00
Sudheer Papothi e26b6ab560 ASoC: wcd-mbhc: reduce insert and remove debounce on wcd9335
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>
2015-12-17 02:16:20 -08:00
Bhalchandra Gajare 488973e30e ASoC: msm-cpe-lsm: Fix out of memory on buffer allocation
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>
2015-12-17 00:45:24 -08:00
Linux Build Service Account 5499e3b5c7 Merge "ASoC: msm: Add support for HW MAD bypass feature for listen" 2015-12-16 23:09:22 -08:00
Walter Yang aec82b54fc ASoC: wcd_cpe_services: delete the redundant worker thread
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>
2015-12-16 22:22:24 -08:00
Linux Build Service Account dc13208569 Merge "ASoC: wcd9335: Clear TX HOLD for ANC input MUX'es" 2015-12-16 13:17:19 -08:00
Venkata Narendra Kumar Gutta 053e755ca8 ASoC: msm: Add support for HW MAD bypass feature for listen
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>
2015-12-15 20:03:55 -08:00
Phani Kumar Uppalapati a651e3c85f ASoC: wcd9335: Clear TX HOLD for ANC input MUX'es
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>
2015-12-14 09:11:51 -08:00
Phani Kumar Uppalapati 1a968d5fc2 ASoC: wcd9335: Change RX disconnect port sequence
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>
2015-12-14 05:58:18 -08:00
Bhalchandra Gajare f01927ebcd ASoC: wcd_cpe_core: Fix address and size for ramdumps
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>
2015-12-12 00:52:40 -08:00
Linux Build Service Account f04aae3c62 Merge "ASoC: msm: fix indefinite wait in compress drain" 2015-12-11 18:49:17 -08:00
Bhalchandra Gajare ac9b9130b2 ASoC: wcd_cpe_services: Fix DRAM size for WCD9335
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>
2015-12-10 23:58:27 -08:00
Clemens Ladisch 82dbfa50b0 ALSA: usb-audio: work around CH345 input SysEx corruption
commit a91e627e3f0ed820b11d86cdc04df38f65f33a70 upstream.

One of the many faults of the QinHeng CH345 USB MIDI interface chip is
that it does not handle received SysEx messages correctly -- every second
event packet has a wrong code index number, which is the one from the last
seen message, instead of 4.  For example, the two messages "FE F0 01 02 03
04 05 06 07 08 09 0A 0B 0C 0D 0E F7" result in the following event
packets:

correct:       CH345:
0F FE 00 00    0F FE 00 00
04 F0 01 02    04 F0 01 02
04 03 04 05    0F 03 04 05
04 06 07 08    04 06 07 08
04 09 0A 0B    0F 09 0A 0B
04 0C 0D 0E    04 0C 0D 0E
05 F7 00 00    05 F7 00 00

A class-compliant driver must interpret an event packet with CIN 15 as
having a single data byte, so the other two bytes would be ignored.  The
message received by the host would then be missing two bytes out of six;
in this example, "F0 01 02 03 06 07 08 09 0C 0D 0E F7".

These corrupted SysEx event packages contain only data bytes, while the
CH345 uses event packets with a correct CIN value only for messages with
a status byte, so it is possible to distinguish between these two cases by
checking for the presence of this status byte.

(Other bugs in the CH345's input handling, such as the corruption resulting
from running status, cannot be worked around.)

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-09 13:40:11 -05:00
Clemens Ladisch 88ab732087 ALSA: usb-audio: prevent CH345 multiport output SysEx corruption
commit 1ca8b201309d842642f221db7f02f71c0af5be2d upstream.

The CH345 USB MIDI chip has two output ports.  However, they are
multiplexed through one pin, and the number of ports cannot be reduced
even for hardware that implements only one connector, so for those
devices, data sent to either port ends up on the same hardware output.
This becomes a problem when both ports are used at the same time, as
longer MIDI commands (such as SysEx messages) are likely to be
interrupted by messages from the other port, and thus to get lost.

It would not be possible for the driver to detect how many ports the
device actually has, except that in practice, _all_ devices built with
the CH345 have only one port.  So we can just ignore the device's
descriptors, and hardcode one output port.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-09 13:40:10 -05:00
Clemens Ladisch 5d39c9b60c ALSA: usb-audio: add packet size quirk for the Medeli DD305
commit 98d362becb6621bebdda7ed0eac7ad7ec6c37898 upstream.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-09 13:40:10 -05:00
Linux Build Service Account 5a42580d46 Merge "ARM: dts: msm: correct stereo wsa speaker setting for 8976 devices" 2015-12-04 12:44:22 -08:00
Linux Build Service Account b5154c4552 Merge "ASoC: msm8x16-wcd: Fix hph pop in switching usecase" 2015-12-04 12:44:22 -08:00
Linux Build Service Account 182099f21d Merge "ASoC: wcd9335: re-set micb_ref to zero post SSR" 2015-12-04 12:44:20 -08:00
Linux Build Service Account 0fb91456df Merge "ASoC: wcd9335: add fixes for TX pop and spkr gain updates" 2015-12-04 12:43:59 -08:00
Linux Build Service Account 953d2255a4 Merge "ASoC: msm: increase slimbus channel FIFO watermark value" 2015-12-04 12:43:28 -08:00
Linux Build Service Account 75b4505e08 Merge "ASoC: msm-cpe-lsm: Queue 2 buffers with slimbus before afe start" 2015-12-04 12:43:27 -08:00
Linux Build Service Account 36a98dc86c Merge "ASoC: msm: add support for faster CPE data transfer rate" 2015-12-04 12:43:26 -08:00
Yeleswarapu Nagaradhesh 676c042483 ARM: dts: msm: correct stereo wsa speaker setting for 8976 devices
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>
2015-12-03 03:51:57 -08:00
Laxminath Kasam 984910d8e0 ASoC: wcd9335: add fixes for TX pop and spkr gain updates
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>
2015-12-01 02:38:44 -08:00
Laxminath Kasam 4469042b92 ASoC: msm8x16-wcd: Fix hph pop in switching usecase
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>
2015-11-26 21:37:29 -08:00
Yeleswarapu Nagaradhesh a93236328e ASoC: wcd9335: re-set micb_ref to zero post SSR
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>
2015-11-26 21:31:26 -08:00
Vidyakumar Athota a54b5908ff ASoC: wcd9335: reset CPE TX PP buffer memory
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>
2015-11-19 03:01:43 -08:00
Vidyakumar Athota 8222a86039 ASoC: msm: increase slimbus channel FIFO watermark value
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>
2015-11-19 02:58:46 -08:00
Vidyakumar Athota 8d96120d13 ASoC: msm-cpe-lsm: Queue 2 buffers with slimbus before afe start
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>
2015-11-19 02:52:41 -08:00
Vidyakumar Athota a9e07835aa ASoC: msm: add support for faster CPE data transfer rate
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>
2015-11-19 02:49:28 -08:00
Vidyakumar Athota 68f2f0ccea ASoC: wcd9335: add support for CPE PP buffer
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>
2015-11-19 02:46:30 -08:00
Vidyakumar Athota dd2229b265 ASoC: wcd_cpe_core: add support to select CPE AFE port
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>
2015-11-19 02:42:34 -08:00
Vidyakumar Athota d9aab49235 ALSA: pcm: add support for 384KHz sample rate
Currenlty HW params fails to set 384KHz sample rate
due to unsupported sample rate. Change to add 384KHz
sample rate support to ALSA.

Change-Id: I381f7cdcc69e6cf9339cec53aab3fa295760c17c
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
2015-11-19 02:39:29 -08:00
Dhananjay Kumar 04eb413627 ASoC: msm: fix indefinite wait in compress drain
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>
2015-11-18 20:01:25 +05:30
Linux Build Service Account 80016ec41c Merge "soundwire: Remove pm runtime sync during soundwire read and write" 2015-11-05 16:09:26 -08:00
Linux Build Service Account 481186059b Merge "ASoC: wcd9330: Update slim RX port disconnect sequence" 2015-11-05 16:09:26 -08:00
Laxminath Kasam 2ded4ce4ef ASoC: wcd9330: Update slim RX port disconnect sequence
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>
2015-11-04 20:11:23 -08:00
Banajit Goswami e4980fc41a ASoC: wcd9335: ensure MCLK is enabled before efuse sensing
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>
2015-11-04 13:59:08 +05:30
Laxminath Kasam a065f3dfe0 ASoC: wsa881x: cancel delayed work queue during device down
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>
2015-11-04 13:58:40 +05:30
Laxminath Kasam 17434fcd1e ASoC: msm8x16-wcd: Fix SSR mute on speaker for internal codec
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>
2015-11-03 21:16:43 -08:00
Laxminath Kasam ccb2c52eb5 ASoC: wcd9335: Fix digital power collapse when XO shutdown
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>
2015-11-02 21:16:08 -08:00
Linux Build Service Account 8bda7b05b5 Merge "ASoC: wcd_cpe: Add CPE FTM feature" 2015-10-30 16:36:11 -07:00
Linux Build Service Account 4415c6210b Merge "ASoC: wcd9335: Changes to avoid click and pop on ANC headphones" 2015-10-29 23:33:08 -07:00
Linux Build Service Account c4f288bb48 Merge "ASoC: wcd-mbhc: update mbhc register correctly" 2015-10-29 23:33:06 -07:00
Linux Build Service Account a5b11ea515 Merge "ASoC: lsm-client: Fix null pointer access when no LSM session" 2015-10-29 23:33:03 -07:00
Sudheer Papothi b7a774f5c3 ASoC: wcd9335: Changes to avoid click and pop on ANC headphones
Re-align ANC(Active Noise Cancellation) coefficients per ANC block
to avoid click and pop during ANC headset device path bringup.
Change enables ANC re-alignment based on codec path.

Change-Id: I7af75942fc714a96e478f862b4c8ecacb3f20fdc
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2015-10-27 22:55:21 -07:00
Phani Kumar Uppalapati 0c343cfa79 ASoC: wcd-mbhc: update mbhc register correctly
Update mbhc register table entry for moisture detection
to be zero for the targets which do not support moisture
detection. This prevents any impact due to moisture
detection.

Change-Id: I3e026e288788700ea2328ccbd12f79f5c40642ac
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
2015-10-27 05:02:13 -07:00
Simmi Pateriya 4580bb3250 ASoC: msm8x16-wcd: update impedance detection
Update impedance detection sequence for cajon as per
the new method provided by hardware team.

Change-Id: Iab021752cb5e56bb64776c41bec6825cb4a0d0db
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
2015-10-26 23:58:04 -07:00
Linux Build Service Account 7c5e0dd8b9 Merge "ASoC: wsa881x: Changes to reduce cold start latency" 2015-10-26 10:09:32 -07:00
Linux Build Service Account e642844b8e Merge "ASoC: msm: handle null pointer access issue at audio client" 2015-10-26 10:09:29 -07:00
Linux Build Service Account 31706b089d Merge "ASoC: wcd9330: fix SSR mute issue after few iterations" 2015-10-26 10:09:29 -07:00
Walter Yang b70d4e9137 ASoC: wcd_cpe: Add CPE FTM feature
Add debugfs nodes for CPE FTM.
The callback will load the instruction and execute it.
CPE status will be retrieved and be read by userspace.
New CPE service command validation is added to guarantee
the concurrency of CPE FTM and normal CPE SVA detection.

Change-Id: I0748e357a21d873af5a85bbb80e982db0323beb7
Signed-off-by: Walter Yang <yandongy@codeaurora.org>
2015-10-26 00:10:36 -07:00
Sujeev Dias d3f0055754 ASoC: msm8952: Add support for external audio switch
Add support to control external audio switch thru
machine driver.  This is to support msm8952 Polaris
devices.

Change-Id: I42e0779b1f18e4883006fdfa71d99da0d2519784
Signed-off-by: Sujeev Dias <sdias@codeaurora.org>
2015-10-23 10:23:11 -07:00
Linux Build Service Account 843cf5205c Merge "ASoC: wsa881x: update register defaults in cache" 2015-10-22 16:44:59 -07:00
Yitian Bu b7ab3afe20 ASoC: dwc: correct irq clear method
commit 4873867e5f2bd90faad861dd94865099fc3140f3 upstream.

from Designware I2S datasheet, tx/rx XRUN irq is cleared by
reading register TOR/ROR, rather than by writing into them.

Signed-off-by: Yitian Bu <yitian.bu@tangramtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-22 14:37:50 -07:00
Robert Jarzmik 9f6425cad8 ASoC: fix broken pxa SoC support
commit 3c8f7710c1c44fb650bc29b6ef78ed8b60cfaa28 upstream.

The previous fix of pxa library support, which was introduced to fix the
library dependency, broke the previous SoC behavior, where a machine
code binding pxa2xx-ac97 with a coded relied on :
 - sound/soc/pxa/pxa2xx-ac97.c
 - sound/soc/codecs/XXX.c

For example, the mioa701_wm9713.c machine code is currently broken. The
"select ARM" statement wrongly selects the soc/arm/pxa2xx-ac97 for
compilation, as per an unfortunate fate SND_PXA2XX_AC97 is both declared
in sound/arm/Kconfig and sound/soc/pxa/Kconfig.

Fix this by ensuring that SND_PXA2XX_SOC correctly triggers the correct
pxa2xx-ac97 compilation.

Fixes: 846172dfe3 ("ASoC: fix SND_PXA2XX_LIB Kconfig warning")
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-22 14:37:50 -07:00
Takashi Iwai c47197f134 ALSA: synth: Fix conflicting OSS device registration on AWE32
commit 225db5762dc1a35b26850477ffa06e5cd0097243 upstream.

When OSS emulation is loaded on ISA SB AWE32 chip, we get now kernel
warnings like:
  WARNING: CPU: 0 PID: 2791 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x51/0x80()
  sysfs: cannot create duplicate filename '/devices/isa/sbawe.0/sound/card0/seq-oss-0-0'

It's because both emux synth and opl3 drivers try to register their
OSS device object with the same static index number 0.  This hasn't
been a big problem until the recent rewrite of device management code
(that exposes sysfs at the same time), but it's been an obvious bug.

This patch works around it just by using a different index number of
emux synth object.  There can be a more elegant way to fix, but it's
enough for now, as this code won't be touched so often, in anyway.

Reported-and-tested-by: Michael Shell <list1@michaelshell.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-22 14:37:50 -07:00
Sudheer Papothi 517171857f ASoC: wsa881x: Changes to reduce cold start latency
changes to optimize wsa881x register writes that will help in
reducing cold start output latency during audio playback
usecase.

Change-Id: I5b316f77bfbd74ca01da491f263a9e9ae80ec63b
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
2015-10-21 10:43:24 +05:30
Laxminath Kasam f3e2e32ba6 ASoC: msm: handle null pointer access issue at audio client
During playback close, ioctl call to prepare for same
session is triggered resulting in access to null pointer
access. Add null pointer check before access audio
client and private data in prepare functions.

Change-Id: I88dee5526b4308a710535d966aa7aeceee668e18
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2015-10-20 17:56:36 -07:00
Laxminath Kasam 9d48a90f82 ASoC: wcd9330: fix SSR mute issue after few iterations
Mark few registers non-cache as they are supposed to be
volatile. This will avoid audio mute after SSR.

Change-Id: I44a99c2b609fbfbd6c9ce7fd2e4b1354ed03bc20
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2015-10-20 17:56:11 -07:00
Laxminath Kasam 1daf7f0e38 ASoC: lsm-client: Fix null pointer access when no LSM session
When no LSM session is active, return from msm_lsm_close
and avoid null pointer dereference.

Change-Id: I9f57c08e080497765eaefef0c031bbf956c02914
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2015-10-20 17:55:43 -07:00
Linux Build Service Account ca9a1c781f Merge "ASoC: msm: On set FB spkr prot check new mode." 2015-10-20 04:37:39 -07:00
Linux Build Service Account 8a43954209 Merge "ASoC: wcd9335: add support for rock bottom sleep current" 2015-10-20 04:37:35 -07:00