summaryrefslogtreecommitdiff
path: root/sound
AgeCommit message (Collapse)Author
2019-10-01ASoC: sgtl5000: Use normal VAG ramp to reduce pop noiseKlaus Goger
The slow downed ramp causes a higher voltage level at the turn off time generating an audible pop noise. Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
2019-06-27ASoC: rk3308_codec: add support ADC grps and DAC endisable for testingXing Zheng
Some times, we need to enable/disable ADC grps or DAC directly to debug. Change-Id: I53b9fa94733d84f7101e299d3fcb6f9160e36112 Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2019-06-25ASoC: multicodecs&rk3308_codec: handle the request during no codec instance ↵Xing Zheng
and hp det If there is no codec instance or headphone jack, we should not request headphone jack from machine driver. Change-Id: If05ac2f4bbfd3fc495a75c0701a44a325e5010cd Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2019-06-25ASoC: rockchip: i2s_tdm: add support handle 'io-multiplex' propertyXing Zheng
Some i2s bus GPIOs maybe designed multiplex, the default is input, we need to configure IN/OUT dynamically. Change-Id: I2e0f0f972d6f9fa3fc8e8fc9f5dfd5d4e6deaee1 Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2019-06-24ASoC: rk3308_codec: add support reversed headphone jackXing Zheng
Change-Id: I4752c935684e3b745185cc43b826cad06ff429c5 Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2019-06-20ASoC: rockchip: multicodecs: update headphone jackXing Zheng
We need to specify a pin description to create a new soc jack kctl and report to userspace. Change-Id: I46f665bd4009c0779a5c9cc3f6b9d43123b54883 Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2019-06-20ASoC: rockchip: multicodecs: add rk_headset_set_jack_detectXing Zheng
For the legacy issues, we still need to call rk_headset on some linux platform. Change-Id: I395de2b8c1300b1cd7cb429dce852ef12bfe2f4c Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2019-06-10Merge branch 'android-4.4' of https://android.googlesource.com/kernel/commonTao Huang
* android-4.4: (3220 commits) ANDROID: Communicates LMK events to userland where they can be logged Linux 4.4.179 kernel/sysctl.c: fix out-of-bounds access when setting file-max Revert "locking/lockdep: Add debug_locks check in __lock_downgrade()" ALSA: info: Fix racy addition/deletion of nodes mm/vmstat.c: fix /proc/vmstat format for CONFIG_DEBUG_TLBFLUSH=y CONFIG_SMP=n device_cgroup: fix RCU imbalance in error case sched/fair: Limit sched_cfs_period_timer() loop to avoid hard lockup Revert "kbuild: use -Oz instead of -Os when using clang" mac80211: do not call driver wake_tx_queue op during reconfig kprobes: Fix error check when reusing optimized probes kprobes: Mark ftrace mcount handler functions nokprobe x86/kprobes: Verify stack frame on kretprobe arm64: futex: Restore oldval initialization to work around buggy compilers crypto: x86/poly1305 - fix overflow during partial reduction ALSA: core: Fix card races between register and disconnect staging: comedi: ni_usb6501: Fix possible double-free of ->usb_rx_buf staging: comedi: ni_usb6501: Fix use of uninitialized mutex staging: comedi: vmk80xx: Fix possible double-free of ->usb_rx_buf staging: comedi: vmk80xx: Fix use of uninitialized semaphore ... Conflicts: Documentation/arm64/silicon-errata.txt Documentation/kernel-parameters.txt Makefile arch/arm/Kconfig arch/arm/configs/ranchu_defconfig arch/arm64/Kconfig arch/arm64/Makefile arch/arm64/configs/cuttlefish_defconfig arch/arm64/configs/ranchu64_defconfig arch/arm64/include/asm/cacheflush.h arch/arm64/include/asm/cpufeature.h arch/arm64/include/asm/cputype.h arch/arm64/include/asm/hardirq.h arch/arm64/include/asm/kvm_host.h arch/arm64/include/asm/module.h arch/arm64/include/asm/pgtable.h arch/arm64/include/asm/smp.h arch/arm64/include/asm/spinlock.h arch/arm64/include/asm/suspend.h arch/arm64/include/asm/sysreg.h arch/arm64/kernel/Makefile arch/arm64/kernel/arm64ksyms.c arch/arm64/kernel/asm-offsets.c arch/arm64/kernel/cpufeature.c arch/arm64/kernel/efi-entry.S arch/arm64/kernel/efi.c arch/arm64/kernel/entry.S arch/arm64/kernel/head.S arch/arm64/kernel/image.h arch/arm64/kernel/module-plts.c arch/arm64/kernel/module.c arch/arm64/kernel/module.lds arch/arm64/kernel/process.c arch/arm64/kernel/stacktrace.c arch/arm64/kernel/suspend.c arch/arm64/kernel/traps.c arch/arm64/kernel/vmlinux.lds.S arch/arm64/kvm/hyp.S arch/arm64/kvm/hyp/fpsimd.S arch/arm64/mm/dma-mapping.c arch/arm64/mm/fault.c arch/arm64/mm/hugetlbpage.c arch/arm64/mm/init.c arch/arm64/mm/mmu.c arch/arm64/mm/pageattr.c arch/arm64/mm/proc.S arch/x86/configs/i386_ranchu_defconfig arch/x86/configs/x86_64_cuttlefish_defconfig arch/x86/configs/x86_64_ranchu_defconfig arch/x86/entry/vdso/Makefile arch/x86/include/asm/thread_info.h arch/x86/include/asm/uaccess.h arch/x86/include/asm/uaccess_32.h arch/x86/include/asm/uaccess_64.h build.config.cuttlefish.aarch64 build.config.cuttlefish.x86_64 drivers/Kconfig drivers/Makefile drivers/android/Kconfig drivers/android/binder.c drivers/block/loop.c drivers/cpufreq/cpufreq-dt.c drivers/cpufreq/cpufreq_interactive.c drivers/firmware/Kconfig drivers/firmware/efi/libstub/Makefile drivers/firmware/efi/libstub/arm64-stub.c drivers/firmware/psci.c drivers/gpu/drm/rockchip/rockchip_drm_drv.c drivers/hwtracing/coresight/coresight-etm4x.c drivers/hwtracing/coresight/coresight-funnel.c drivers/hwtracing/coresight/coresight-tmc.c drivers/hwtracing/coresight/coresight-tpiu.c drivers/hwtracing/stm/Kconfig drivers/hwtracing/stm/core.c drivers/irqchip/Kconfig drivers/md/Kconfig drivers/misc/Kconfig drivers/misc/Makefile drivers/misc/uid_sys_stats.c drivers/mmc/core/mmc.c drivers/net/ethernet/realtek/r8169.c drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c drivers/net/wireless/virt_wifi.c drivers/platform/goldfish/goldfish_pipe_v2.c drivers/staging/android/fiq_debugger/Kconfig drivers/switch/Kconfig drivers/switch/Makefile drivers/switch/switch_class.c drivers/tee/optee/rpc.c drivers/tee/optee/shm_pool.h drivers/usb/dwc3/gadget.c drivers/usb/gadget/function/f_audio_source.c drivers/usb/gadget/function/f_mtp.c drivers/usb/gadget/function/u_ether.c drivers/usb/host/xhci-ring.c fs/exec.c fs/pnode.c include/linux/cpufreq.h include/linux/dcache.h include/linux/memblock.h include/linux/power/bq25700-charge.h include/linux/uid_stat.h include/net/activity_stats.h include/uapi/linux/android/binder.h kernel/events/ring_buffer.c kernel/sched/fair.c kernel/time/timer.c mm/memblock.c mm/slab.c net/ipv4/tcp_ipv4.c net/socket.c scripts/dtc/checks.c scripts/dtc/dtc-lexer.lex.c_shipped scripts/dtc/dtc-parser.tab.c_shipped scripts/dtc/dtc.c scripts/dtc/dtc.h scripts/dtc/dtx_diff scripts/dtc/libfdt/fdt_wip.c scripts/dtc/libfdt/libfdt.h scripts/dtc/livetree.c scripts/dtc/srcpos.h scripts/dtc/util.h scripts/dtc/version_gen.h scripts/sortextable.c Change-Id: Ic327e4bbeb99e98724bb626fa9df2d31b0abc003
2019-05-24ASoC: rk3308_codec: increase some delays to be stabe enabling DACXing Zheng
From the suggest of IP vendor, we need more delays to adapt to the playing scene in different temperature environments. Change-Id: I95abe2bac43de19241092d6e785f28960760dacd Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2019-05-15ASoC: es8316: setting gpio only when it's availablebrian
The spk_ctl_gpio may not available and no need to set, or else there will be error message. Change-Id: I54b1775c4d2bd695f7a5373149b14bc2501ce136 Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2019-04-27ALSA: info: Fix racy addition/deletion of nodesTakashi Iwai
commit 8c2f870890fd28e023b0fcf49dcee333f2c8bad7 upstream. The ALSA proc helper manages the child nodes in a linked list, but its addition and deletion is done without any lock. This leads to a corruption if they are operated concurrently. Usually this isn't a problem because the proc entries are added sequentially in the driver probe procedure itself. But the card registrations are done often asynchronously, and the crash could be actually reproduced with syzkaller. This patch papers over it by protecting the link addition and deletion with the parent's mutex. There is "access" mutex that is used for the file access, and this can be reused for this purpose as well. Reported-by: syzbot+48df349490c36f9f54ab@syzkaller.appspotmail.com Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-27ALSA: core: Fix card races between register and disconnectTakashi Iwai
commit 2a3f7221acddfe1caa9ff09b3a8158c39b2fdeac upstream. There is a small race window in the card disconnection code that allows the registration of another card with the very same card id. This leads to a warning in procfs creation as caught by syzkaller. The problem is that we delete snd_cards and snd_cards_lock entries at the very beginning of the disconnection procedure. This makes the slot available to be assigned for another card object while the disconnection procedure is being processed. Then it becomes possible to issue a procfs registration with the existing file name although we check the conflict beforehand. The fix is simply to move the snd_cards and snd_cards_lock clearances at the end of the disconnection procedure. The references to these entries are merely either from the global proc files like /proc/asound/cards or from the card registration / disconnection, so it should be fine to shift at the very end. Reported-by: syzbot+48df349490c36f9f54ab@syzkaller.appspotmail.com Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-27ALSA: opl3: fix mismatch between snd_opl3_drum_switch definition and declarationColin Ian King
[ Upstream commit b4748e7ab731e436cf5db4786358ada5dd2db6dd ] The function snd_opl3_drum_switch declaration in the header file has the order of the two arguments on_off and vel swapped when compared to the definition arguments of vel and on_off. Fix this by swapping them around to match the definition. This error predates the git history, so no idea when this error was introduced. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-04-27ALSA: sb8: add a check for request_regionKangjie Lu
[ Upstream commit dcd0feac9bab901d5739de51b3f69840851f8919 ] In case request_region fails, the fix returns an error code to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-04-27ALSA: echoaudio: add a check for ioremap_nocacheKangjie Lu
[ Upstream commit 6ade657d6125ec3ec07f95fa51e28138aef6208f ] In case ioremap_nocache fails, the fix releases chip and returns an error code upstream to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-04-27ASoC: fsl_esai: fix channel swap issue when stream startsS.j. Wang
commit 0ff4e8c61b794a4bf6c854ab071a1abaaa80f358 upstream. There is very low possibility ( < 0.1% ) that channel swap happened in beginning when multi output/input pin is enabled. The issue is that hardware can't send data to correct pin in the beginning with the normal enable flow. This is hardware issue, but there is no errata, the workaround flow is that: Each time playback/recording, firstly clear the xSMA/xSMB, then enable TE/RE, then enable xSMB and xSMA (xSMB must be enabled before xSMA). Which is to use the xSMA as the trigger start register, previously the xCR_TE or xCR_RE is the bit for starting. Fixes commit 43d24e76b698 ("ASoC: fsl_esai: Add ESAI CPU DAI driver") Cc: <stable@vger.kernel.org> Reviewed-by: Fabio Estevam <festevam@gmail.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-27ALSA: seq: Fix OOB-reads from strlcpyZubin Mithra
commit 212ac181c158c09038c474ba68068be49caecebb upstream. When ioctl calls are made with non-null-terminated userspace strings, strlcpy causes an OOB-read from within strlen. Fix by changing to use strscpy instead. Signed-off-by: Zubin Mithra <zsm@chromium.org> Reviewed-by: Guenter Roeck <groeck@chromium.org> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-27ASoC: fsl-asoc-card: fix object reference leaks in fsl_asoc_card_probewen yang
[ Upstream commit 11907e9d3533648615db08140e3045b829d2c141 ] The of_find_device_by_node() takes a reference to the underlying device structure, we should release that reference. Signed-off-by: Wen Yang <yellowriver2010@hotmil.com> Cc: Timur Tabi <timur@kernel.org> Cc: Nicolin Chen <nicoleotsuka@gmail.com> Cc: Xiubo Li <Xiubo.Lee@gmail.com> Cc: Fabio Estevam <festevam@gmail.com> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Cc: alsa-devel@alsa-project.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-04-27ALSA: PCM: check if ops are defined before suspending PCMRanjani Sridharan
[ Upstream commit d9c0b2afe820fa3b3f8258a659daee2cc71ca3ef ] BE dai links only have internal PCM's and their substream ops may not be set. Suspending these PCM's will result in their ops->trigger() being invoked and cause a kernel oops. So skip suspending PCM's if their ops are NULL. [ NOTE: this change is required now for following the recent PCM core change to get rid of snd_pcm_suspend() call. Since DPCM BE takes the runtime carried from FE while keeping NULL ops, it can hit this bug. See details at: https://github.com/thesofproject/linux/pull/582 -- tiwai ] Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-04-27SoC: imx-sgtl5000: add missing put_device()Wen Yang
[ Upstream commit 8fa857da9744f513036df1c43ab57f338941ae7d ] The of_find_device_by_node() takes a reference to the underlying device structure, we should release that reference. Detected by coccinelle with the following warnings: ./sound/soc/fsl/imx-sgtl5000.c:169:1-7: ERROR: missing put_device; call of_find_device_by_node on line 105, but without a corresponding object release within this function. ./sound/soc/fsl/imx-sgtl5000.c:177:1-7: ERROR: missing put_device; call of_find_device_by_node on line 105, but without a corresponding object release within this function. Signed-off-by: Wen Yang <yellowriver2010@hotmail.com> Cc: Timur Tabi <timur@kernel.org> Cc: Nicolin Chen <nicoleotsuka@gmail.com> Cc: Xiubo Li <Xiubo.Lee@gmail.com> Cc: Fabio Estevam <festevam@gmail.com> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Cc: Shawn Guo <shawnguo@kernel.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Pengutronix Kernel Team <kernel@pengutronix.de> Cc: NXP Linux Team <linux-imx@nxp.com> Cc: alsa-devel@alsa-project.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-04-03ALSA: pcm: Don't suspend stream in unrecoverable PCM stateTakashi Iwai
commit 113ce08109f8e3b091399e7cc32486df1cff48e7 upstream. Currently PCM core sets each opened stream forcibly to SUSPENDED state via snd_pcm_suspend_all() call, and the user-space is responsible for re-triggering the resume manually either via snd_pcm_resume() or prepare call. The scheme works fine usually, but there are corner cases where the stream can't be resumed by that call: the streams still in OPEN state before finishing hw_params. When they are suspended, user-space cannot perform resume or prepare because they haven't been set up yet. The only possible recovery is to re-open the device, which isn't nice at all. Similarly, when a stream is in DISCONNECTED state, it makes no sense to change it to SUSPENDED state. Ditto for in SETUP state; which you can re-prepare directly. So, this patch addresses these issues by filtering the PCM streams to be suspended by checking the PCM state. When a stream is in either OPEN, SETUP or DISCONNECTED as well as already SUSPENDED, the suspend action is skipped. To be noted, this problem was originally reported for the PCM runtime PM on HD-audio. And, the runtime PM problem itself was already addressed (although not intended) by the code refactoring commits 3d21ef0b49f8 ("ALSA: pcm: Suspend streams globally via device type PM ops") and 17bc4815de58 ("ALSA: pci: Remove superfluous snd_pcm_suspend*() calls"). These commits eliminated the snd_pcm_suspend*() calls from the runtime PM suspend callback code path, hence the racy OPEN state won't appear while runtime PM. (FWIW, the race window is between snd_pcm_open_substream() and the first power up in azx_pcm_open().) Although the runtime PM issue was already "fixed", the same problem is still present for the system PM, hence this patch is still needed. And for stable trees, this patch alone should suffice for fixing the runtime PM problem, too. Reported-and-tested-by: Jon Hunter <jonathanh@nvidia.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03ALSA: pcm: Fix possible OOB access in PCM oss pluginsTakashi Iwai
commit ca0214ee2802dd47239a4e39fb21c5b00ef61b22 upstream. The PCM OSS emulation converts and transfers the data on the fly via "plugins". The data is converted over the dynamically allocated buffer for each plugin, and recently syzkaller caught OOB in this flow. Although the bisection by syzbot pointed out to the commit 65766ee0bf7f ("ALSA: oss: Use kvzalloc() for local buffer allocations"), this is merely a commit to replace vmalloc() with kvmalloc(), hence it can't be the cause. The further debug action revealed that this happens in the case where a slave PCM doesn't support only the stereo channels while the OSS stream is set up for a mono channel. Below is a brief explanation: At each OSS parameter change, the driver sets up the PCM hw_params again in snd_pcm_oss_change_params_lock(). This is also the place where plugins are created and local buffers are allocated. The problem is that the plugins are created before the final hw_params is determined. Namely, two snd_pcm_hw_param_near() calls for setting the period size and periods may influence on the final result of channels, rates, etc, too, while the current code has already created plugins beforehand with the premature values. So, the plugin believes that channels=1, while the actual I/O is with channels=2, which makes the driver reading/writing over the allocated buffer size. The fix is simply to move the plugin allocation code after the final hw_params call. Reported-by: syzbot+d4503ae45b65c5bc1194@syzkaller.appspotmail.com Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03ALSA: seq: oss: Fix Spectre v1 vulnerabilityGustavo A. R. Silva
commit c709f14f0616482b67f9fbcb965e1493a03ff30b upstream. dev is indirectly controlled by user-space, hence leading to a potential exploitation of the Spectre variant 1 vulnerability. This issue was detected with the help of Smatch: sound/core/seq/oss/seq_oss_synth.c:626 snd_seq_oss_synth_make_info() warn: potential spectre issue 'dp->synths' [w] (local cap) Fix this by sanitizing dev before using it to index dp->synths. Notice that given that speculation windows are large, the policy is to kill the speculation on the first load and not worry if it can be completed with a dependent load/store [1]. [1] https://lore.kernel.org/lkml/20180423164740.GY17484@dhcp22.suse.cz/ Cc: stable@vger.kernel.org Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03ALSA: rawmidi: Fix potential Spectre v1 vulnerabilityGustavo A. R. Silva
commit 2b1d9c8f87235f593826b9cf46ec10247741fff9 upstream. info->stream is indirectly controlled by user-space, hence leading to a potential exploitation of the Spectre variant 1 vulnerability. This issue was detected with the help of Smatch: sound/core/rawmidi.c:604 __snd_rawmidi_info_select() warn: potential spectre issue 'rmidi->streams' [r] (local cap) Fix this by sanitizing info->stream before using it to index rmidi->streams. Notice that given that speculation windows are large, the policy is to kill the speculation on the first load and not worry if it can be completed with a dependent load/store [1]. [1] https://lore.kernel.org/lkml/20180423164740.GY17484@dhcp22.suse.cz/ Cc: stable@vger.kernel.org Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03ALSA: compress: add support for 32bit calls in a 64bit kernelRavindra Lokhande
commit c10368897e104c008c610915a218f0fe5fa4ec96 upstream. Compress offload does not support ioctl calls from a 32bit userspace in a 64 bit kernel. This patch adds support for ioctls from a 32bit userspace in a 64bit kernel Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03ALSA: hda - Enforces runtime_resume after S3 and S4 for each codecHui Wang
commit b5a236c175b0d984552a5f7c9d35141024c2b261 upstream. Recently we found the audio jack detection stop working after suspend on many machines with Realtek codec. Sometimes the audio selection dialogue didn't show up after users plugged headhphone/headset into the headset jack, sometimes after uses plugged headphone/headset, then click the sound icon on the upper-right corner of gnome-desktop, it also showed the speaker rather than the headphone. The root cause is that before suspend, the codec already call the runtime_suspend since this codec is not used by any apps, then in resume, it will not call runtime_resume for this codec. But for some realtek codec (so far, alc236, alc255 and alc891) with the specific BIOS, if it doesn't run runtime_resume after suspend, all codec functions including jack detection stop working anymore. This problem existed for a long time, but it was not exposed, that is because when problem happens, if users play sound or open sound-setting to check audio device, this will trigger calling to runtime_resume (via snd_hda_power_up), then the codec starts working again before users notice this problem. Since we don't know how many codec and BIOS combinations have this problem, to fix it, let the driver call runtime_resume for all codecs in pm_resume, maybe for some codecs, this is not needed, but it is harmless. After a codec is runtime resumed, if it is not used by any apps, it will be runtime suspended soon and furthermore we don't run suspend frequently, this change will not add much power consumption. Fixes: cc72da7d4d06 ("ALSA: hda - Use standard runtime PM for codec power-save control") Signed-off-by: Hui Wang <hui.wang@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03ALSA: hda - Record the current power state before suspend/resume callsTakashi Iwai
commit 98081ca62cbac31fb0f7efaf90b2e7384ce22257 upstream. Currently we deal with single codec and suspend codec callbacks for all S3, S4 and runtime PM handling. But it turned out that we want distinguish the call patterns sometimes, e.g. for applying some init sequence only at probing and restoring from hibernate. This patch slightly modifies the common PM callbacks for HD-audio codec and stores the currently processed PM event in power_state of the codec's device.power field, which is currently unused. The codec callback can take a look at this event value and judges which purpose it's being called. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-01ASoC: rk3308_codec: add support checking external micbiasXing Zheng
Change-Id: I644faff116184ee3fb927cff6531f8d4ac497edc Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2019-04-01ASoC: rk3308_codec: add some delay to wait micbias is stableXing Zheng
To avoid bring some noise dues to unstable micbias. Change-Id: I0127505f0adeacda5d852ae3cefae2fb5f4ee9d2 Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2019-03-29ASoC: rockchip: i2s: fixed PCM DSP formatXiaotan Luo
DSP_A: PCM delay 1 bit mode,L data MSB after FRM LRC DSP_B: PCM no delay mode,L data MSB during FRM LRC Change-Id: I198519c431815de3ca1fc154da78773ca705f0e0 Signed-off-by: Xiaotan Luo <lxt@rock-chips.com>
2019-03-23ASoC: topology: free created components in tplg load errorBard liao
[ Upstream commit 304017d31df36fb61eb2ed3ebf65fb6870b3c731 ] Topology resources are no longer needed if any element failed to load. Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-03-23ASoC: fsl_esai: fix register setting issue in RIGHT_J modeS.j. Wang
commit cc29ea007347f39f4c5a4d27b0b555955a0277f9 upstream. The ESAI_xCR_xWA is xCR's bit, not the xCCR's bit, driver set it to wrong register, correct it. Fixes 43d24e76b698 ("ASoC: fsl_esai: Add ESAI CPU DAI driver") Cc: <stable@vger.kernel.org> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Fabio Estevam <festevam@gmail.com> Ackedy-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-23ALSA: bebob: use more identical mod_alias for Saffire Pro 10 I/O against ↵Takashi Sakamoto
Liquid Saffire 56 commit 7dc661bd8d3261053b69e4e2d0050cd1ee540fc1 upstream. ALSA bebob driver has an entry for Focusrite Saffire Pro 10 I/O. The entry matches vendor_id in root directory and model_id in unit directory of configuration ROM for IEEE 1394 bus. On the other hand, configuration ROM of Focusrite Liquid Saffire 56 has the same vendor_id and model_id. This device is an application of TCAT Dice (TCD2220 a.k.a Dice Jr.) however ALSA bebob driver can be bound to it randomly instead of ALSA dice driver. At present, drivers in ALSA firewire stack can not handle this situation appropriately. This commit uses more identical mod_alias for Focusrite Saffire Pro 10 I/O in ALSA bebob driver. $ python2 crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ----------------------------------------------------------------- 400 042a829d bus_info_length 4, crc_length 42, crc 33437 404 31333934 bus_name "1394" 408 f0649222 irmc 1, cmc 1, isc 1, bmc 1, pmc 0, cyc_clk_acc 100, max_rec 9 (1024), max_rom 2, gen 2, spd 2 (S400) 40c 00130e01 company_id 00130e | 410 000606e0 device_id 01000606e0 | EUI-64 00130e01000606e0 root directory ----------------------------------------------------------------- 414 0009d31c directory_length 9, crc 54044 418 04000014 hardware version 41c 0c0083c0 node capabilities per IEEE 1394 420 0300130e vendor 424 81000012 --> descriptor leaf at 46c 428 17000006 model 42c 81000016 --> descriptor leaf at 484 430 130120c2 version 434 d1000002 --> unit directory at 43c 438 d4000006 --> dependent info directory at 450 unit directory at 43c ----------------------------------------------------------------- 43c 0004707c directory_length 4, crc 28796 440 1200a02d specifier id: 1394 TA 444 13010001 version: AV/C 448 17000006 model 44c 81000013 --> descriptor leaf at 498 dependent info directory at 450 ----------------------------------------------------------------- 450 000637c7 directory_length 6, crc 14279 454 120007f5 specifier id 458 13000001 version 45c 3affffc7 (immediate value) 460 3b100000 (immediate value) 464 3cffffc7 (immediate value) 468 3d600000 (immediate value) descriptor leaf at 46c ----------------------------------------------------------------- 46c 00056f3b leaf_length 5, crc 28475 470 00000000 textual descriptor 474 00000000 minimal ASCII 478 466f6375 "Focu" 47c 73726974 "srit" 480 65000000 "e" descriptor leaf at 484 ----------------------------------------------------------------- 484 0004a165 leaf_length 4, crc 41317 488 00000000 textual descriptor 48c 00000000 minimal ASCII 490 50726f31 "Pro1" 494 30494f00 "0IO" descriptor leaf at 498 ----------------------------------------------------------------- 498 0004a165 leaf_length 4, crc 41317 49c 00000000 textual descriptor 4a0 00000000 minimal ASCII 4a4 50726f31 "Pro1" 4a8 30494f00 "0IO" $ python2 crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ----------------------------------------------------------------- 400 040442e4 bus_info_length 4, crc_length 4, crc 17124 404 31333934 bus_name "1394" 408 e0ff8112 irmc 1, cmc 1, isc 1, bmc 0, pmc 0, cyc_clk_acc 255, max_rec 8 (512), max_rom 1, gen 1, spd 2 (S400) 40c 00130e04 company_id 00130e | 410 018001e9 device_id 04018001e9 | EUI-64 00130e04018001e9 root directory ----------------------------------------------------------------- 414 00065612 directory_length 6, crc 22034 418 0300130e vendor 41c 8100000a --> descriptor leaf at 444 420 17000006 model 424 8100000e --> descriptor leaf at 45c 428 0c0087c0 node capabilities per IEEE 1394 42c d1000001 --> unit directory at 430 unit directory at 430 ----------------------------------------------------------------- 430 000418a0 directory_length 4, crc 6304 434 1200130e specifier id 438 13000001 version 43c 17000006 model 440 8100000f --> descriptor leaf at 47c descriptor leaf at 444 ----------------------------------------------------------------- 444 00056f3b leaf_length 5, crc 28475 448 00000000 textual descriptor 44c 00000000 minimal ASCII 450 466f6375 "Focu" 454 73726974 "srit" 458 65000000 "e" descriptor leaf at 45c ----------------------------------------------------------------- 45c 000762c6 leaf_length 7, crc 25286 460 00000000 textual descriptor 464 00000000 minimal ASCII 468 4c495155 "LIQU" 46c 49445f53 "ID_S" 470 41464649 "AFFI" 474 52455f35 "RE_5" 478 36000000 "6" descriptor leaf at 47c ----------------------------------------------------------------- 47c 000762c6 leaf_length 7, crc 25286 480 00000000 textual descriptor 484 00000000 minimal ASCII 488 4c495155 "LIQU" 48c 49445f53 "ID_S" 490 41464649 "AFFI" 494 52455f35 "RE_5" 498 36000000 "6" Cc: <stable@vger.kernel.org> # v3.16+ Fixes: 25784ec2d034 ("ALSA: bebob: Add support for Focusrite Saffire/SaffirePro series") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-23ASoC: imx-audmux: change snprintf to scnprintf for possible overflowSilvio Cesare
[ Upstream commit c407cd008fd039320d147088b52d0fa34ed3ddcb ] Change snprintf to scnprintf. There are generally two cases where using snprintf causes problems. 1) Uses of size += snprintf(buf, SIZE - size, fmt, ...) In this case, if snprintf would have written more characters than what the buffer size (SIZE) is, then size will end up larger than SIZE. In later uses of snprintf, SIZE - size will result in a negative number, leading to problems. Note that size might already be too large by using size = snprintf before the code reaches a case of size += snprintf. 2) If size is ultimately used as a length parameter for a copy back to user space, then it will potentially allow for a buffer overflow and information disclosure when size is greater than SIZE. When the size is used to index the buffer directly, we can have memory corruption. This also means when size = snprintf... is used, it may also cause problems since size may become large. Copying to userspace is mitigated by the HARDENED_USERCOPY kernel configuration. The solution to these issues is to use scnprintf which returns the number of characters actually written to the buffer, so the size variable will never exceed SIZE. Signed-off-by: Silvio Cesare <silvio.cesare@gmail.com> Cc: Timur Tabi <timur@kernel.org> Cc: Nicolin Chen <nicoleotsuka@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Xiubo Li <Xiubo.Lee@gmail.com> Cc: Fabio Estevam <fabio.estevam@nxp.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Kees Cook <keescook@chromium.org> Cc: Will Deacon <will.deacon@arm.com> Cc: Greg KH <greg@kroah.com> Signed-off-by: Willy Tarreau <w@1wt.eu> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-03-23ASoC: dapm: change snprintf to scnprintf for possible overflowSilvio Cesare
[ Upstream commit e581e151e965bf1f2815dd94620b638fec4d0a7e ] Change snprintf to scnprintf. There are generally two cases where using snprintf causes problems. 1) Uses of size += snprintf(buf, SIZE - size, fmt, ...) In this case, if snprintf would have written more characters than what the buffer size (SIZE) is, then size will end up larger than SIZE. In later uses of snprintf, SIZE - size will result in a negative number, leading to problems. Note that size might already be too large by using size = snprintf before the code reaches a case of size += snprintf. 2) If size is ultimately used as a length parameter for a copy back to user space, then it will potentially allow for a buffer overflow and information disclosure when size is greater than SIZE. When the size is used to index the buffer directly, we can have memory corruption. This also means when size = snprintf... is used, it may also cause problems since size may become large. Copying to userspace is mitigated by the HARDENED_USERCOPY kernel configuration. The solution to these issues is to use scnprintf which returns the number of characters actually written to the buffer, so the size variable will never exceed SIZE. Signed-off-by: Silvio Cesare <silvio.cesare@gmail.com> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Kees Cook <keescook@chromium.org> Cc: Will Deacon <will.deacon@arm.com> Cc: Greg KH <greg@kroah.com> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-03-23ALSA: compress: prevent potential divide by zero bugsDan Carpenter
[ Upstream commit 678e2b44c8e3fec3afc7202f1996a4500a50be93 ] The problem is seen in the q6asm_dai_compr_set_params() function: ret = q6asm_map_memory_regions(dir, prtd->audio_client, prtd->phys, (prtd->pcm_size / prtd->periods), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ prtd->periods); In this code prtd->pcm_size is the buffer_size and prtd->periods comes from params->buffer.fragments. If we allow the number of fragments to be zero then it results in a divide by zero bug. One possible fix would be to use prtd->pcm_count directly instead of using the division to re-calculate it. But I decided that it doesn't really make sense to allow zero fragments. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-03-23ASoC: Intel: Haswell/Broadwell: fix setting for .dynamic fieldRander Wang
[ Upstream commit 906a9abc5de73c383af518f5a806f4be2993a0c7 ] For some reason this field was set to zero when all other drivers use .dynamic = 1 for front-ends. This change was tested on Dell XPS13 and has no impact with the existing legacy driver. The SOF driver also works with this change which enables it to override the fixed topology. Signed-off-by: Rander Wang <rander.wang@linux.intel.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-03-19ASoC: codec: dummy-codec: add setting mclkXiaotan Luo
Many devices require MCLK to work, So add mclk Change-Id: I666e46c8968330afd81506d0c64769b59ad0837d Signed-off-by: Xiaotan Luo <lxt@rock-chips.com>
2019-03-12ASoC: core: Fix panic when two cards register using the same daiSugar Zhang
This issue was caused by two cards using the same dai(cpu_dai/codec_dai). the second one will fail to register as a card, then will release the same dai resource, leading to the first card crash. [ 79.032274] Unable to handle kernel paging request at virtual address ffffffffffffffe0 [ 79.035543] Hardware name: Rockchip RK3399 Excavator Board edp (Android) (DT) [ 79.036171] task: ffffffc0dd126c00 task.stack: ffffffc0d109c000 [ 79.036717] PC is at dapm_widget_invalidate_output_paths+0x98/0xe0 [ 79.037268] LR is at soc_dapm_dai_stream_event+0x60/0x9c [ 79.184613] Call trace: [ 79.192401] [<ffffff80088e9028>] dapm_widget_invalidate_output_paths+0x98/0xe0 [ 79.193044] [<ffffff80088ea0d0>] soc_dapm_dai_stream_event+0x60/0x9c [ 79.193611] [<ffffff80088eeb9c>] snd_soc_dapm_stream_event+0x44/0x94 [ 79.194175] [<ffffff80088e515c>] snd_soc_suspend+0x23c/0x2fc [ 79.194686] [<ffffff800852d1f0>] platform_pm_suspend+0x38/0x54 [ 79.195208] [<ffffff8008536e88>] dpm_run_callback+0x110/0x1bc [ 79.195726] [<ffffff8008537578>] __device_suspend+0x164/0x2a4 [ 79.196242] [<ffffff80085392b0>] dpm_suspend+0x70/0x338 [ 79.196713] [<ffffff8008539ab0>] dpm_suspend_start+0x64/0x68 [ 79.197226] [<ffffff80080f0b9c>] suspend_devices_and_enter+0x74/0x2d8 [ 79.197800] [<ffffff80080f140c>] pm_suspend+0x60c/0x668 [ 79.198272] [<ffffff80080ef7b4>] state_store+0x50/0x84 [ 79.198734] [<ffffff800839d128>] kobj_attr_store+0x14/0x24 [ 79.199234] [<ffffff8008232fd8>] sysfs_kf_write+0x38/0x50 [ 79.199718] [<ffffff8008232208>] kernfs_fop_write+0x124/0x180 [ 79.200237] [<ffffff80081bf76c>] __vfs_write+0x38/0xfc [ 79.200695] [<ffffff80081bffd4>] vfs_write+0x9c/0x170 [ 79.201153] [<ffffff80081c0a18>] SyS_write+0x5c/0xbc [ 79.201604] [<ffffff80080832f0>] el0_svc_naked+0x24/0x28 [ 79.202079] Code: 54000081 f9408000 d1040000 17ffffef (39406025) [ 79.202693] ---[ end trace dec5980253348a7f ]--- Change-Id: I6bbbeefaa68a7d5dfccc1bba57d61216b4be1035 Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2019-03-05ASoC: rockchip: vad: compatible with rk1808es/rk1808Sugar Zhang
Change-Id: I54c968f8fcf37cc4d7a52137ac0aac57d4367dc7 Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2019-02-25ASoC: rockchip: rk817-codec: solve sound L/R channel conversion problemBinyuan Lan
There is playback's sound L/R channel conversion problem when recording is opened Change-Id: Iae7160e25bdd834df9904fbd34fe964449c93560 Signed-off-by: Binyuan Lan <lby@rock-chips.com>
2019-02-20ALSA: usb-audio: Fix implicit fb endpoint setup by quirkManuel Reinhardt
commit 2bc16b9f3223d049b57202ee702fcb5b9b507019 upstream. The commit a60945fd08e4 ("ALSA: usb-audio: move implicit fb quirks to separate function") introduced an error in the handling of quirks for implicit feedback endpoints. This commit fixes this. If a quirk successfully sets up an implicit feedback endpoint, usb-audio no longer tries to find the implicit fb endpoint itself. Fixes: a60945fd08e4 ("ALSA: usb-audio: move implicit fb quirks to separate function") Signed-off-by: Manuel Reinhardt <manuel.rhdt@gmail.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-20ALSA: hda - Add quirk for HP EliteBook 840 G5Jurica Vukadin
commit 4cd3016ce996494f78fdfd87ea35c8ca5d0b413e upstream. This enables mute LED support and fixes switching jacks when the laptop is docked. Signed-off-by: Jurica Vukadin <jurica.vukadin@rt-rk.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-20ALSA: hda - Serialize codec registrationsTakashi Iwai
commit 305a0ade180981686eec1f92aa6252a7c6ebb1cf upstream. In the current code, the codec registration may happen both at the codec bind time and the end of the controller probe time. In a rare occasion, they race with each other, leading to Oops due to the still uninitialized card device. This patch introduces a simple flag to prevent the codec registration at the codec bind time as long as the controller probe is going on. The controller probe invokes snd_card_register() that does the whole registration task, and we don't need to register each piece beforehand. Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-20ASoC: fsl: Fix SND_SOC_EUKREA_TLV320 build error on i.MX8MFabio Estevam
[ Upstream commit add6883619a9e3bf9658eaff1a547354131bbcd9 ] eukrea-tlv320.c machine driver runs on non-DT platforms and include <asm/mach-types.h> header file in order to be able to use some machine_is_eukrea_xxx() macros. Building it for ARM64 causes the following build error: sound/soc/fsl/eukrea-tlv320.c:28:10: fatal error: asm/mach-types.h: No such file or directory Avoid this error by not allowing to build the SND_SOC_EUKREA_TLV320 driver when ARM64 is selected. This is needed in preparation for the i.MX8M support. Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Fabio Estevam <festevam@gmail.com> Acked-by: Shawn Guo <shawnguo@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-02-20ASoC: Intel: mrfld: fix uninitialized variable accessArnd Bergmann
[ Upstream commit 1539c7f23f256120f89f8b9ec53160790bce9ed2 ] Randconfig testing revealed a very old bug, with gcc-8: sound/soc/intel/atom/sst/sst_loader.c: In function 'sst_load_fw': sound/soc/intel/atom/sst/sst_loader.c:357:5: error: 'fw' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (fw == NULL) { ^ sound/soc/intel/atom/sst/sst_loader.c:354:25: note: 'fw' was declared here const struct firmware *fw; We must check the return code of request_firmware() before we look at the pointer result that may be uninitialized when the function fails. Fixes: 9012c9544eea ("ASoC: Intel: mrfld - Add DSP load and management") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-02-06ASoC: atom: fix a missing check of snd_pcm_lib_malloc_pagesKangjie Lu
commit 44fabd8cdaaa3acb80ad2bb3b5c61ae2136af661 upstream. snd_pcm_lib_malloc_pages() may fail, so let's check its status and return its error code upstream. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-01ASoC: rk3308_codec: Add the range of MICBIAS voltagesXing Zheng
Change-Id: Ie9d1d4fc8854cc4111cbb1a324525f849c5c470a Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2019-02-01ASoC: rk3308_codec: Add controls for main MICBIAS switchXing Zheng
Change-Id: I8a2a113df7fd427634e1a1f81632725d7d4ecdc0 Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2019-02-01ASoC: rk3308_codec: Add controls for MICBIAS1 and MICBIAS2 SwitchXing Zheng
Change-Id: I64dcc55a993e00eee91a6fdf9ec6cd18ef40d3e1 Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>