platform/kernel/linux-rpi.git
3 years agoALSA: hda/realtek: fix mute/micmute LEDs for HP ProBook 445 G8
Andy Chi [Thu, 1 Jul 2021 09:14:14 +0000 (17:14 +0800)]
ALSA: hda/realtek: fix mute/micmute LEDs for HP ProBook 445 G8

The HP ProBook 445 G8 using ALC236 codec.
COEF index 0x34 bit 5 is used to control the playback mute LED, but the
microphone mute LED is controlled using pin VREF instead of a COEF index.
Therefore, add a quirk to make it works.

Signed-off-by: Andy Chi <andy.chi@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210701091417.9696-2-andy.chi@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: hda/realtek: fix mute/micmute LEDs for HP ProBook 450 G8
Andy Chi [Thu, 1 Jul 2021 09:14:13 +0000 (17:14 +0800)]
ALSA: hda/realtek: fix mute/micmute LEDs for HP ProBook 450 G8

The HP ProBook 450 G8 using ALC236 codec which using 0x02 to
control mute LED and 0x01 to control micmute LED.
Therefore, add a quirk to make it works.

Signed-off-by: Andy Chi <andy.chi@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210701091417.9696-1-andy.chi@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: hda/realtek - Add ALC285 HP init procedure
Kailang Yang [Thu, 1 Jul 2021 01:33:33 +0000 (09:33 +0800)]
ALSA: hda/realtek - Add ALC285 HP init procedure

ALC285 headphone initial procedure.
It also could suitable for ALC215/ALC289/ALC225/ALC295/ALC299.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Link: https://lore.kernel.org/r/2b7539c3e96f41a4ab458d53ea5f5784@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: hda/realtek - Add type for ALC287
Kailang Yang [Thu, 1 Jul 2021 01:09:37 +0000 (09:09 +0800)]
ALSA: hda/realtek - Add type for ALC287

Add independent type for ALC287.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Link: https://lore.kernel.org/r/2b7539c3e96f41a4ab458d53ea5f5784@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoMerge tag 'asoc-v5.14' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Takashi Iwai [Thu, 1 Jul 2021 06:36:12 +0000 (08:36 +0200)]
Merge tag 'asoc-v5.14' of https://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Updates for v5.14

This release sees a nice new feature in the core from Morimoto-san,
support for automatic negotiation of DAI formats between the components
on the link.  Otherwise the big highlight was the merging of the Tegra
machine drivers into a single driver avoiding a bunch of duplication.

 - Support for automatic negotiation of DAI formats.
 - Accessory detection support for several Qualcomm parts.
 - Support for IEC958 control with hdmi-codec.
 - Merging of Tegra machine drivers into a single driver.
 - Support for AmLogic SM1 TOACODEC, Intel AlderLake-M, several NXP
   i.MX8 variants, NXP TFA1 and TDF9897, Rockchip RK817, Qualcomm
   Quinary MI2S, Texas Instruments TAS2505

3 years agoALSA: scarlett2: Fix scarlett2_*_ctl_put() return values again
Geoffrey D. Bennett [Sun, 27 Jun 2021 13:22:56 +0000 (22:52 +0930)]
ALSA: scarlett2: Fix scarlett2_*_ctl_put() return values again

Mixer control put callbacks should return 1 if the value is changed.
Fix the mute, air, phantom, direct monitor, speaker switch, talkback,
and MSD controls accordingly.

Fix scarlett2_speaker_switch_enable() to not ignore the return value
of scarlett2_sw_hw_change().

Reported-by: Aaron Wolf <aaron@wolftune.com>
Tested-by: Aaron Wolf <aaron@wolftune.com>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/76643f7ac81aef93351122d07881e30d51dcb1b9.1624798436.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: scarlett2: Fix pad count for 18i8 Gen 3
Geoffrey D. Bennett [Sun, 27 Jun 2021 13:22:26 +0000 (22:52 +0930)]
ALSA: scarlett2: Fix pad count for 18i8 Gen 3

The 18i8 Gen 3 has 4 inputs with a pad control, not 2. Update
s18i8_gen3_info.pad_input_count.

Reported-by: Aaron Wolf <aaron@wolftune.com>
Tested-by: Aaron Wolf <aaron@wolftune.com>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/29a6ce412a42373daab7c96c395560461fcf08c6.1624798436.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoMerge branch 'for-next' into for-linus
Takashi Iwai [Thu, 1 Jul 2021 06:34:15 +0000 (08:34 +0200)]
Merge branch 'for-next' into for-linus

3 years agoALSA: hda/realtek: fix mute/micmute LEDs for HP EliteBook 830 G8 Notebook PC
Jeremy Szu [Fri, 25 Jun 2021 13:34:13 +0000 (21:34 +0800)]
ALSA: hda/realtek: fix mute/micmute LEDs for HP EliteBook 830 G8 Notebook PC

The HP EliteBook 830 G8 Notebook PC using ALC285 codec which using 0x04 to
control mute LED and 0x01 to control micmute LED.
Therefore, add a quirk to make it works.

Signed-off-by: Jeremy Szu <jeremy.szu@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210625133414.26760-1-jeremy.szu@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoMerge remote-tracking branch 'asoc/for-5.14' into asoc-next
Mark Brown [Fri, 25 Jun 2021 13:08:03 +0000 (14:08 +0100)]
Merge remote-tracking branch 'asoc/for-5.14' into asoc-next

3 years agoMerge remote-tracking branch 'asoc/for-5.13' into asoc-linus
Mark Brown [Fri, 25 Jun 2021 13:08:01 +0000 (14:08 +0100)]
Merge remote-tracking branch 'asoc/for-5.13' into asoc-linus

3 years agoALSA: firewire-lib: Fix 'amdtp_domain_start()' when no AMDTP_OUT_STREAM stream is...
Christophe JAILLET [Thu, 24 Jun 2021 18:49:36 +0000 (20:49 +0200)]
ALSA: firewire-lib: Fix 'amdtp_domain_start()' when no AMDTP_OUT_STREAM stream is found

The intent here is to return an error code if we don't find what we are
looking for in the 'list_for_each_entry()' loop.

's' is not NULL if the list is empty or if we scan the complete list.
Introduce a new 'found' variable to handle such cases.

Fixes: 60dd49298ec5 ("ALSA: firewire-lib: handle several AMDTP streams in callback handler of IRQ target")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/9c9a53a4905984a570ba5672cbab84f2027dedc1.1624560484.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoASoC: qcom: lpass-cpu: mark IRQ_CLEAR register as volatile and readable
Srinivas Kandagatla [Thu, 24 Jun 2021 09:21:53 +0000 (10:21 +0100)]
ASoC: qcom: lpass-cpu: mark IRQ_CLEAR register as volatile and readable

Currently IRQ_CLEAR register is marked as write-only, however using
regmap_update_bits on this register will have some side effects.
so mark IRQ_CLEAR register appropriately as readable and volatile.

Fixes: da0363f7bfd3 ("ASoC: qcom: Fix for DMA interrupt clear reg overwriting")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210624092153.5771-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMAINTAINERS: remove Timur Tabi from Freescale SOC sound drivers
Timur Tabi [Sun, 20 Jun 2021 16:01:35 +0000 (11:01 -0500)]
MAINTAINERS: remove Timur Tabi from Freescale SOC sound drivers

I haven't touched these drivers in seven years, and none of the
patches sent to me these days affect code that I wrote.  The
other maintainers are doing a very good job without me.

Signed-off-by: Timur Tabi <timur@kernel.org>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20210620160135.28651-1-timur@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 50b1ce617d66d04f1f9006e51793e6cffcdec6ea)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoASoC: rt5645: Avoid upgrading static warnings to errors
Mark Brown [Tue, 8 Jun 2021 16:07:13 +0000 (17:07 +0100)]
ASoC: rt5645: Avoid upgrading static warnings to errors

One of the fixes reverted as part of the UMN fallout was actually fine,
however rather than undoing the revert the process that handled all this
stuff resulted in a patch which attempted to add extra error checks
instead.  Unfortunately this new change wasn't really based on a good
understanding of the subsystem APIs and bypassed the usual patch flow
without ensuring it was reviewed by people with subsystem knowledge and
was merged as a fix rather than during the merge window.

The effect of the new fix is to upgrade what were previously warnings on
static data in the code to hard errors on that data.  If this actually
happens then it would break existing systems, if it doesn't happen then
the change has no effect so this was not a safe change to apply as a fix
to the release candidates.  Since the new code has not been tested and
doesn't in practice improve error handling revert it instead, and also
drop the original revert since the original fix was fine.  This takes
the driver back to what it was in -rc1.

Fixes: 5e70b8e22b64e ("ASoC: rt5645: add error checking to rt5645_probe function")
Fixes: 1e0ce84215dbf ("Revert "ASoC: rt5645: fix a NULL pointer dereference")
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Phillip Potter <phil@philpotter.co.uk>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20210608160713.21040-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 916cccb5078eee57fce131c5fe18e417545083e2)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoMerge tag 'asoc-fix-v5.13-rc7' of https://git.kernel.org/pub/scm/linux/kernel/git...
Takashi Iwai [Thu, 24 Jun 2021 08:02:45 +0000 (10:02 +0200)]
Merge tag 'asoc-fix-v5.13-rc7' of https://git./linux/kernel/git/broonie/sound into for-next

ASoC: Fixes for v5.13

A final batch of fixes for v5.13, this is larger than I'd like due to
the fixes for a series of suspend issues that Intel turned up in their
testing this week.

3 years agoMerge series "ASoC: tlv320aic32x4: Add support for TAS2505" from Claudius Heine ...
Mark Brown [Wed, 23 Jun 2021 15:31:14 +0000 (16:31 +0100)]
Merge series "ASoC: tlv320aic32x4: Add support for TAS2505" from Claudius Heine <ch@denx.de>:

Hi,

this is v2 from my patchset that add support for the TAS2505 to the tlv320aic32x4 driver.

kind regards,
Claudius

Changes from v1:
- clarified commit message of first patch, which add the type value to the struct
- removed unnecessary code to put and get speaker volume
- removed 'Gain' from 'HP Driver Playback Volume' control
- fixed rebase issues

Claudius Heine (3):
  ASoC: tlv320aic32x4: add type to device private data struct
  ASoC: tlv320aic32x4: add support for TAS2505
  ASoC: tlv320aic32x4: dt-bindings: add TAS2505 to compatible

 .../bindings/sound/tlv320aic32x4.txt          |   1 +
 sound/soc/codecs/tlv320aic32x4-i2c.c          |  22 ++-
 sound/soc/codecs/tlv320aic32x4-spi.c          |  23 ++-
 sound/soc/codecs/tlv320aic32x4.c              | 139 +++++++++++++++++-
 sound/soc/codecs/tlv320aic32x4.h              |  10 ++
 5 files changed, 186 insertions(+), 9 deletions(-)

base-commit: 70585216fe7730d9fb5453d3e2804e149d0fe201
--
2.32.0

3 years agoMerge series "ASoC: tegra: Use devm_platform_get_and_ioremap_resource()" from Yang...
Mark Brown [Wed, 23 Jun 2021 15:31:13 +0000 (16:31 +0100)]
Merge series "ASoC: tegra: Use devm_platform_get_and_ioremap_resource()" from Yang Yingliang <yangyingliang@huawei.com>:

Use devm_platform_get_and_ioremap_resource() to simplify
code.

Yang Yingliang (4):
  ASoC: tegra20: i2s: Use devm_platform_get_and_ioremap_resource()
  ASoC: tegra20: spdif: Use devm_platform_get_and_ioremap_resource()
  ASoC: tegra: tegra210_admaif: Use
    devm_platform_get_and_ioremap_resource()
  ASoC: tegra30: ahub: Use devm_platform_get_and_ioremap_resource()

 sound/soc/tegra/tegra20_i2s.c     | 3 +--
 sound/soc/tegra/tegra20_spdif.c   | 3 +--
 sound/soc/tegra/tegra210_admaif.c | 4 +---
 sound/soc/tegra/tegra30_ahub.c    | 3 +--
 4 files changed, 4 insertions(+), 9 deletions(-)

--
2.25.1

3 years agoALSA: hda: Release codec display power during shutdown/reboot
Imre Deak [Wed, 23 Jun 2021 13:46:01 +0000 (16:46 +0300)]
ALSA: hda: Release codec display power during shutdown/reboot

Similarly to the previous patch for the HDA controller make sure here
that codecs also drop the display power reference during shutdown and
reboot.

This fixes a power ref leaked WARN in i915 during shutdown if the HDA
driver is built with CONFIG_PM=n.

Suggested-by: Takashi Iwai <tiwai@suse.de>
References: https://gitlab.freedesktop.org/drm/intel/-/issues/3618
References: https://lore.kernel.org/intel-gfx/s5hzgvhngw6.wl-tiwai@suse.de
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://lore.kernel.org/r/20210623134601.2128663-2-imre.deak@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: hda: Release controller display power during shutdown/reboot
Imre Deak [Wed, 23 Jun 2021 13:46:00 +0000 (16:46 +0300)]
ALSA: hda: Release controller display power during shutdown/reboot

Make sure the HDA driver's display power reference is released during
shutdown/reboot.

During the shutdown/reboot sequence the pci device core calls the
pm_runtime_resume handler for all devices before calling the driver's
shutdown callback and so the HDA driver's runtime resume callback will
acquire a display power reference (on HSW/BDW). This triggers a power
reference held WARN on HSW/BDW in the i915 driver's subsequent shutdown
handler, which expects all display power references to be released by
that time.

Since the HDA controller is stopped in the shutdown handler in any case,
let's follow here the same sequence as the one during runtime suspend.
This will also reset the HDA link and drop the display power reference,
getting rid of the above WARN.

Tested on HSW.

v2:
- Fix the build for CONFIG_PM=n (Takashi)
- s/__azx_runtime_suspend/azx_shutdown_chip/

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/3618
References: https://lore.kernel.org/lkml/cea1f9a-52e0-b83-593d-52997fe1aaf6@er-systems.de
Reported-and-tested-by: Thomas Voegtle <tv@lio96.de>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://lore.kernel.org/r/20210623134601.2128663-1-imre.deak@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: hda/realtek: Apply LED fixup for HP Dragonfly G1, too
Takashi Iwai [Wed, 23 Jun 2021 12:20:22 +0000 (14:20 +0200)]
ALSA: hda/realtek: Apply LED fixup for HP Dragonfly G1, too

HP Dragonfly G1 (SSID 103c:861f) also requires the same quirk for the
mute and mic-mute LED just as Dragonfly G2 model.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=213329
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210623122022.26179-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoASoC: fsl: remove unnecessary oom message
Zhen Lei [Thu, 17 Jun 2021 10:31:41 +0000 (18:31 +0800)]
ASoC: fsl: remove unnecessary oom message

Fixes scripts/checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' message

Remove it can help us save a bit of memory.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Link: https://lore.kernel.org/r/20210617103141.1765-1-thunder.leizhen@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: tlv320aic32x4: dt-bindings: add TAS2505 to compatible
Claudius Heine [Thu, 17 Jun 2021 08:52:30 +0000 (10:52 +0200)]
ASoC: tlv320aic32x4: dt-bindings: add TAS2505 to compatible

This adds 'ti,tas2505' for TAS2505 to the list of allowed compatible
strings.

Signed-off-by: Claudius Heine <ch@denx.de>
Link: https://lore.kernel.org/r/20210617085230.1851503-4-ch@denx.de
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: tlv320aic32x4: add support for TAS2505
Claudius Heine [Thu, 17 Jun 2021 08:52:29 +0000 (10:52 +0200)]
ASoC: tlv320aic32x4: add support for TAS2505

This adds support for TAS2505 and TAS2521 to the tlv320aic32x4 driver.

The TAS2505 seems to be a stripped down version of the TLV320AIC32X4 so
it makes sense to handle them in the same driver.

Signed-off-by: Claudius Heine <ch@denx.de>
Link: https://lore.kernel.org/r/20210617085230.1851503-3-ch@denx.de
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: tlv320aic32x4: add type to device private data struct
Claudius Heine [Thu, 17 Jun 2021 08:52:28 +0000 (10:52 +0200)]
ASoC: tlv320aic32x4: add type to device private data struct

While this driver can already handle different device variants, the
variant information cannot be used in the driver code and therefor
cannot have different code paths depending on the device variant.

This change adds a `type` value into the `aic32x4_priv` structure, that
contains a device variant identifier, which was set when the driver was
bound to the device.

Signed-off-by: Claudius Heine <ch@denx.de>
Link: https://lore.kernel.org/r/20210617085230.1851503-2-ch@denx.de
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: tegra30: ahub: Use devm_platform_get_and_ioremap_resource()
Yang Yingliang [Fri, 18 Jun 2021 02:47:22 +0000 (10:47 +0800)]
ASoC: tegra30: ahub: Use devm_platform_get_and_ioremap_resource()

Use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210618024722.2618842-5-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: tegra: tegra210_admaif: Use devm_platform_get_and_ioremap_resource()
Yang Yingliang [Fri, 18 Jun 2021 02:47:21 +0000 (10:47 +0800)]
ASoC: tegra: tegra210_admaif: Use devm_platform_get_and_ioremap_resource()

Use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210618024722.2618842-4-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: tegra20: spdif: Use devm_platform_get_and_ioremap_resource()
Yang Yingliang [Fri, 18 Jun 2021 02:47:20 +0000 (10:47 +0800)]
ASoC: tegra20: spdif: Use devm_platform_get_and_ioremap_resource()

Use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210618024722.2618842-3-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: tegra20: i2s: Use devm_platform_get_and_ioremap_resource()
Yang Yingliang [Fri, 18 Jun 2021 02:47:19 +0000 (10:47 +0800)]
ASoC: tegra20: i2s: Use devm_platform_get_and_ioremap_resource()

Use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210618024722.2618842-2-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl_spdif: Fix unexpected interrupt after suspend
Shengjiu Wang [Tue, 22 Jun 2021 12:31:24 +0000 (20:31 +0800)]
ASoC: fsl_spdif: Fix unexpected interrupt after suspend

When system enter suspend, the machine driver suspend callback
function will be called, then the cpu driver trigger callback
(SNDRV_PCM_TRIGGER_SUSPEND) be called, it would disable the
interrupt.

But the machine driver suspend and cpu dai driver suspend order
maybe changed, the cpu dai driver's suspend callback is called before
machine driver's suppend callback, then the interrupt is not cleared
successfully in trigger callback.

So need to clear interrupts in cpu dai driver's suspend callback
to avoid such issue.

Fixes: 9cb2b3796e08 ("ASoC: fsl_spdif: Add pm runtime function")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/1624365084-7934-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoALSA: firewire-motu: fix register handling for 896
Takashi Sakamoto [Wed, 23 Jun 2021 07:59:41 +0000 (16:59 +0900)]
ALSA: firewire-motu: fix register handling for 896

After further investigation, I find out some mistakes for 896 about its
register. This commit fixes it.

Fixes: b431f16f1685 ("ALSA: firewire-motu: add support for MOTU 896")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210623075941.72562-10-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: firewire-motu: fix register handling for 828
Takashi Sakamoto [Wed, 23 Jun 2021 07:59:40 +0000 (16:59 +0900)]
ALSA: firewire-motu: fix register handling for 828

After further investigation, I find out some mistakes for 828 about its
register. This commit fixes it.

Fixes: d13d6b284d8b ("ALSA: firewire-motu: add support for MOTU 828")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210623075941.72562-9-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: firewire-motu: use macro instead of magic number for clock source in v3 protocol
Takashi Sakamoto [Wed, 23 Jun 2021 07:59:39 +0000 (16:59 +0900)]
ALSA: firewire-motu: use macro instead of magic number for clock source in v3 protocol

This commit adds a series of macro for source of sampling clock in
version 3 protocol.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210623075941.72562-8-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: firewire-motu: code refactoring for source detection of sampling clock in v3...
Takashi Sakamoto [Wed, 23 Jun 2021 07:59:38 +0000 (16:59 +0900)]
ALSA: firewire-motu: code refactoring for source detection of sampling clock in v3 protocol

Current implementation of driver has two similar helper functions for
source detection of sampling clock. This commit merges them as a code
refactoring.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210623075941.72562-7-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: firewire-motu: code refactoring for packet format detection in v2 protocol
Takashi Sakamoto [Wed, 23 Jun 2021 07:59:37 +0000 (16:59 +0900)]
ALSA: firewire-motu: code refactoring for packet format detection in v2 protocol

Current implementation of driver has several similar helper functions
for packet format detection in protocol version 2.

This commit merges them as code refactoring.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210623075941.72562-6-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: firewire-motu: use macro instead of magic number for clock source in v2 protocol
Takashi Sakamoto [Wed, 23 Jun 2021 07:59:36 +0000 (16:59 +0900)]
ALSA: firewire-motu: use macro instead of magic number for clock source in v2 protocol

This commit adds a series of macro for source of sampling clock in
version 2 protocol.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210623075941.72562-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: firewire-motu: add support for AES/EBU clock source in v2 protocol
Takashi Sakamoto [Wed, 23 Jun 2021 07:59:35 +0000 (16:59 +0900)]
ALSA: firewire-motu: add support for AES/EBU clock source in v2 protocol

Although MOTU Traveler supports AES/EBU source for sampling clock,
current implementation of driver doesn't code it.

This commit adds support for AES/EBU source in protocol version 2.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210623075941.72562-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: firewire-motu: code refactoring for detection of clock source in v2 protocol
Takashi Sakamoto [Wed, 23 Jun 2021 07:59:34 +0000 (16:59 +0900)]
ALSA: firewire-motu: code refactoring for detection of clock source in v2 protocol

Current implementation of driver has two similar helper functions for
source detection of sampling clock. This commit merges them as a code
refactoring.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210623075941.72562-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: firewire-motu: fix detection for S/PDIF source on optical interface in v2 protocol
Takashi Sakamoto [Wed, 23 Jun 2021 07:59:33 +0000 (16:59 +0900)]
ALSA: firewire-motu: fix detection for S/PDIF source on optical interface in v2 protocol

The devices in protocol version 2 has a register with flag for IEC 60958
signal detection as source of sampling clock without discrimination
between coaxial and optical interfaces. On the other hand, current
implementation of driver manage to interpret type of signal on optical
interface instead.

This commit fixes the detection of optical/coaxial interface for S/PDIF
signal.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210623075941.72562-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoMAINTAINERS: Add Focusrite Scarlett Gen 2/3 Mixer Driver entry
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:17:24 +0000 (02:47 +0930)]
MAINTAINERS: Add Focusrite Scarlett Gen 2/3 Mixer Driver entry

Add Focusrite Scarlett Gen 2/3 Mixer Driver entry.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/20210622171724.GA15534@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Add support for the talkback feature
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:04:13 +0000 (02:34 +0930)]
ALSA: usb-audio: scarlett2: Add support for the talkback feature

Add support for the talkback feature of the 18i20 Gen 3.

Co-developed-by: Vladimir Sadovnikov <sadko4u@gmail.com>
Signed-off-by: Vladimir Sadovnikov <sadko4u@gmail.com>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/e39599893a7479c290e1aaec6c79dcee87681b47.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Update get_config to do endian conversion
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:04:09 +0000 (02:34 +0930)]
ALSA: usb-audio: scarlett2: Update get_config to do endian conversion

For configuration items with a size of 16, scarlett2_usb_get_config()
was filling *buf with little-endian data. Update it to convert to CPU
endian. This function is not currently used so affects nothing yet;
will be used by the upcoming talkback feature.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/cbc8b6eedd859dd27086ab4126d724a86dd50bcb.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Add speaker switching support
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:03:58 +0000 (02:33 +0930)]
ALSA: usb-audio: scarlett2: Add speaker switching support

The 18i8 and 18i20 Gen 3 support "speaker switching". Add a Speaker
Switch control which can be set to Off/Main/Alt.

When speaker switching is enabled or disabled, the interface may
change the state of the Analog Outputs 3 and 4 routing and the global
mute button, so use a flag private->speaker_switching_switched to note
that those should be checked when the next "monitor other"
notification is received.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/874193a534cd0aeb6f2e108ae761cadd2dc25ad2.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Update mux controls to allow updates
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:03:50 +0000 (02:33 +0930)]
ALSA: usb-audio: scarlett2: Update mux controls to allow updates

Enabling/disabling speaker switching will update the mux
configuration. To prepare for this, add a private->mux_updated flag
and update the scarlett2_mux_src_enum_ctl_get() callback to check it.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/5ce3bb9fe4006b550d18c783c5ff640fe0bfbfcb.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Add sw_hw_ctls and mux_ctls
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:03:45 +0000 (02:33 +0930)]
ALSA: usb-audio: scarlett2: Add sw_hw_ctls and mux_ctls

Save the struct snd_kcontrol pointers for the sw_hw and mux controls.
This is in preparation for speaker switching support which needs to be
able to update those controls.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/269d89181bf29dbea80ba6f8cfff84fb23b77f86.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Split up sw_hw_enum_ctl_put()
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:03:36 +0000 (02:33 +0930)]
ALSA: usb-audio: scarlett2: Split up sw_hw_enum_ctl_put()

Split part of scarlett2_sw_hw_enum_ctl_put() out into
scarlett2_sw_hw_change() so that the code which actually makes the
change is available in its own function. This will be used by the
speaker switching support which needs to set the SW/HW switch to HW
when speaker switching is enabled.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/f2cf91841ba067b490e7709bc4b14f4532b4ddd5.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Label 18i8 Gen 3 line outputs correctly
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:03:16 +0000 (02:33 +0930)]
ALSA: usb-audio: scarlett2: Label 18i8 Gen 3 line outputs correctly

The 18i8 Gen 3 analogue 7/8 outputs are identified as line 3/4 on the
rear of the unit. Add support for remapping the channel numbers to
match the labelling.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/461acb911509e60e9ab48109ece3bbadae7440c8.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Add direct monitor support
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:03:08 +0000 (02:33 +0930)]
ALSA: usb-audio: scarlett2: Add direct monitor support

The Solo and 2i2 devices don't have a mixer but they do have a "direct
monitor" switch. Add support for getting and setting the state of this
switch.

Co-developed-by: Vladimir Sadovnikov <sadko4u@gmail.com>
Signed-off-by: Vladimir Sadovnikov <sadko4u@gmail.com>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/61d23dc4feb3b046d870ad7203e66ff2bd1d278c.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Add phantom power switch support
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:02:40 +0000 (02:32 +0930)]
ALSA: usb-audio: scarlett2: Add phantom power switch support

Some inputs on Gen 3 models support software-selectable phantom power.
Add support for getting and setting the state of those switches and
the "Phantom Power Persistence" switch.

Co-developed-by: Vladimir Sadovnikov <sadko4u@gmail.com>
Signed-off-by: Vladimir Sadovnikov <sadko4u@gmail.com>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/5837ce8a8c686560fc8f40b4204dd2a10721869b.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Add "air" switch support
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:02:36 +0000 (02:32 +0930)]
ALSA: usb-audio: scarlett2: Add "air" switch support

Some inputs on Gen 3 models have an "air" feature which can be enabled
from the driver or (model-dependent) from the front panel. Add support
for getting and setting the state of those switches.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/44d448a4150b9c068754759c9fdd2bfe21484487.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Add support for Solo and 2i2 Gen 3
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:02:31 +0000 (02:32 +0930)]
ALSA: usb-audio: scarlett2: Add support for Solo and 2i2 Gen 3

Add initial support for the Focusrite Scarlett Solo and 2i2 devices:
- They have no mixer
- They don't support reporting sync status or levels
- The configuration space is laid out differently to the other models
- There is no level (line/inst) switch on input 1 of the Solo

Co-developed-by: Vladimir Sadovnikov <sadko4u@gmail.com>
Signed-off-by: Vladimir Sadovnikov <sadko4u@gmail.com>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/190b90f6f1f8f8d4dfb5f0a7761ff8ae5c40fdde.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Allow bit-level access to config
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:02:25 +0000 (02:32 +0930)]
ALSA: usb-audio: scarlett2: Allow bit-level access to config

Add support for accessing configuration values when multiple values
are stored in one byte. Needed by the upcoming Solo and 2i2 Gen 3
support.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/4e54e9e106ec7029c1a668c51b4fc769a7eb4ed0.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Move get config above set config
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:02:09 +0000 (02:32 +0930)]
ALSA: usb-audio: scarlett2: Move get config above set config

Move scarlett2_usb_get() and scarlett2_usb_get_config() above the
functions relating to updating the configuration so that
scarlett2_usb_set_config() can call scarlett2_usb_get() in a
subsequent patch.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/1549f8e44548be679119f0b1462f888f4a03812d.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Add Gen 3 MSD mode switch
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:01:52 +0000 (02:31 +0930)]
ALSA: usb-audio: scarlett2: Add Gen 3 MSD mode switch

Add a control to disable the Gen 3 MSD mode so that the full
functionality of the device is available. Don't create the other
controls until MSD mode is disabled.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/1cb93bbe585f6b0a74f5dc27450bc87e1f3776dc.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Add support for "input-other" notify
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:01:44 +0000 (02:31 +0930)]
ALSA: usb-audio: scarlett2: Add support for "input-other" notify

Some models allow the level and pad settings to be controlled from the
front-panel of the device. For these, the device will send an
"input-other" notification to prompt the driver to re-read the status
of those settings.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/06289a7697455e96b7dbdfd2d384d4b20f8df6e0.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Add Gen 3 mixer support
Geoffrey D. Bennett [Tue, 22 Jun 2021 17:01:37 +0000 (02:31 +0930)]
ALSA: usb-audio: scarlett2: Add Gen 3 mixer support

Add mixer support for the Focusrite Scarlett 4i4, 8i6, 18i8, and 18i20
Gen 3 devices.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/22d0dc877dec026eb19630edec217ab72ebcd50a.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Fix wrong resume call
Takashi Iwai [Tue, 22 Jun 2021 17:00:49 +0000 (02:30 +0930)]
ALSA: usb-audio: scarlett2: Fix wrong resume call

The current way of the scarlett2 mixer code managing the
usb_mixer_elem_info object is wrong in two ways: it passes its
internal index to the head.id field, and the val_type field is
uninitialized.  This ended up with the wrong execution at the resume
because a bogus unit id is passed wrongly.  Also, in the later code
extensions, we'll have more mixer elements, and passing the index will
overflow the unit id size (of 256).

This patch corrects those issues.  It introduces a new value type,
USB_MIXER_BESPOKEN, which indicates a non-standard mixer element, and
use this type for all scarlett2 mixer elements, as well as
initializing the fixed unit id 0 for avoiding the overflow.

Tested-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/49721219f45b7e175e729b0d9d9c142fd8f4342a.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Fix Level Meter control
Geoffrey D. Bennett [Mon, 21 Jun 2021 18:09:46 +0000 (03:39 +0930)]
ALSA: usb-audio: scarlett2: Fix Level Meter control

The Level Meter control had a fixed number of channels and therefore
only worked with the 18i20 Gen 2. Fix the control to contain the
correct number of channels.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/5e9a2d5c136270db2d048db53a3b4b6e6d4a63de.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Split struct scarlett2_ports
Geoffrey D. Bennett [Mon, 21 Jun 2021 18:09:43 +0000 (03:39 +0930)]
ALSA: usb-audio: scarlett2: Split struct scarlett2_ports

The scarlett2_ports struct contains both generic (hardware IDs and
descriptions) and model-specific (port count) data. Remove the generic
data from the scarlett2_device_info struct so it is not repeated for
every model.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/7a9e57e4e55a482390c692a9e60731d72b664a15.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Allow arbitrary ordering of mux entries
Geoffrey D. Bennett [Mon, 21 Jun 2021 18:09:41 +0000 (03:39 +0930)]
ALSA: usb-audio: scarlett2: Allow arbitrary ordering of mux entries

Some Gen 3 devices do not put all of the mux entries for the same port
types together in order in the "set mux" message data. To prepare for
this, replace the struct scarlett2_ports num[] array and the
assignment_order[] array with mux_assignment[], a list of port types
and ranges that is defined in the struct scarlett2_device_info.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/08e8d784d78262cb57496d28ef1ad7b6213a90ab.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Add mute support
Geoffrey D. Bennett [Mon, 21 Jun 2021 18:09:39 +0000 (03:39 +0930)]
ALSA: usb-audio: scarlett2: Add mute support

For each analogue output, in addition to the output volume (gain)
control, the hardware also has a mute control. Add ALSA mute controls
for each analogue output.

If the device has the line_out_hw_vol feature, then the mute control
is disabled along with the output volume control when the switch is
set to HW.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/6fad82174b44633e46cfd96332a038de74d544f2.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Add scarlett2_vol_ctl_write() helper
Geoffrey D. Bennett [Mon, 21 Jun 2021 18:09:37 +0000 (03:39 +0930)]
ALSA: usb-audio: scarlett2: Add scarlett2_vol_ctl_write() helper

Add helper function for setting the read/write status of a volume
control. This will simplify the upcoming mute control support.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/00dd57e1abb3fa379fb51d4ac8537dbddc09f0ea.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Remove repeated device info comments
Geoffrey D. Bennett [Mon, 21 Jun 2021 18:09:35 +0000 (03:39 +0930)]
ALSA: usb-audio: scarlett2: Remove repeated device info comments

Document the fields of struct scarlett2_device_info in the definition
of the struct, not in each instantiation.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/3486e4d38973333d4ec38f32578c16a9f97bf6c8.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Move info lookup out of init function
Geoffrey D. Bennett [Mon, 21 Jun 2021 18:09:33 +0000 (03:39 +0930)]
ALSA: usb-audio: scarlett2: Move info lookup out of init function

The info variable is not used by snd_scarlett_gen2_init() except to
pass it to snd_scarlett_gen2_controls_create(), so move the lookup
into that function.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/c4b6d17708e104503d9a2b88f9b3320bb9904cfa.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Improve device info lookup
Geoffrey D. Bennett [Mon, 21 Jun 2021 18:09:31 +0000 (03:39 +0930)]
ALSA: usb-audio: scarlett2: Improve device info lookup

Add the USB device ID to the scarlett2_device_info struct so that the
switch statement which finds the appropriate struct can be replaced
with a loop that looks through an array of pointers to those structs.

Suggested-by: Vladimir Sadovnikov <sadko4u@gmail.com>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/474c408c29fb280a611e47e49e59ca2fb9810d27.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Reformat scarlett2_config_items[]
Geoffrey D. Bennett [Mon, 21 Jun 2021 18:09:29 +0000 (03:39 +0930)]
ALSA: usb-audio: scarlett2: Reformat scarlett2_config_items[]

Use designated initializers and merge lines in preparation for more
configuration items coming soon.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/512d14eeb3571a266810c954d0f83140a3af7afc.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Merge common line in capture strings
Geoffrey D. Bennett [Mon, 21 Jun 2021 18:09:26 +0000 (03:39 +0930)]
ALSA: usb-audio: scarlett2: Merge common line in capture strings

Use a common sprintf() format for the mixer element names generated in
scarlett2_add_line_in_ctls() in preparation for more of them.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/d91dce45ac75a541c21f47540ecbda24bd83f68c.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Add "Sync Status" control
Geoffrey D. Bennett [Mon, 21 Jun 2021 18:09:24 +0000 (03:39 +0930)]
ALSA: usb-audio: scarlett2: Add "Sync Status" control

Add "Sync Status" control to display the sync locked/unlocked status.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/d6967d7a34b2ea7e0672ba819e4ed8b99e8dcd35.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Always enable interrupt polling
Geoffrey D. Bennett [Mon, 21 Jun 2021 18:09:20 +0000 (03:39 +0930)]
ALSA: usb-audio: scarlett2: Always enable interrupt polling

Always enable interrupt polling as every model has some sort of
status to report.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/8f49a6b9a9805ee0db221706193b7bb43b7fff75.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Fix 6i6 Gen 2 line out descriptions
Geoffrey D. Bennett [Mon, 21 Jun 2021 18:09:18 +0000 (03:39 +0930)]
ALSA: usb-audio: scarlett2: Fix 6i6 Gen 2 line out descriptions

There are two headphone outputs, and they map to the four analogue
outputs.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/205e5e5348f08ded0cc4da5446f604d4b91db5bf.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Update initialisation sequence
Geoffrey D. Bennett [Mon, 21 Jun 2021 18:09:13 +0000 (03:39 +0930)]
ALSA: usb-audio: scarlett2: Update initialisation sequence

The old initialisation code only works with Gen 2 devices. Replace it
with an initialisation sequence that works on both Gen 2 and Gen 3
devices.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/6e5c4fedb74b813872f6a4b7fba30b6c471fa63a.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: scarlett2: Add usb_tx/rx functions
Geoffrey D. Bennett [Mon, 21 Jun 2021 18:09:06 +0000 (03:39 +0930)]
ALSA: usb-audio: scarlett2: Add usb_tx/rx functions

Pull out snd_usb_ctl_msg() calls from scarlett2_usb() and put into
scarlett2_usb_tx() and scarlett2_usb_rx() functions.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/720d1d6f227fc8f5d7d6191a8de62db796940235.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: hdsp: fix a test for copy_to_user() failure
Dan Carpenter [Tue, 22 Jun 2021 19:02:02 +0000 (22:02 +0300)]
ALSA: hdsp: fix a test for copy_to_user() failure

The copy_to_user() function returns the number of bytes remaining to be
copied.  It doesn't return negatives.

Fixes: 66c8f75919dd ("ALSA: hdsp: Fix assignment in if condition")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YNIzqpVR6L2t/RwJ@mwanda
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoMerge series "ASoC: Intel: machine driver corrections" from Pierre-Louis Bossart...
Mark Brown [Tue, 22 Jun 2021 14:48:07 +0000 (15:48 +0100)]
Merge series "ASoC: Intel: machine driver corrections" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Some of these patches dealing with Sparse warnings were submitted
earlier but not merged. I grouped them with a couple of fixes from
Kai.

v2:
added Mark Brown in CC, was missed in v1
added Richard Fitzgerald Tested-by

Kai Vehmanen (3):
  ASoC: Intel: sof_sdw: use mach data for ADL RVP DMIC count
  ASoC: Intel: sof_sdw: remove hdac-hdmi support
  ASoC: Intel: skl_hda_dsp_generic: Update Kconfig documentation

Pierre-Louis Bossart (7):
  ASoC: Intel: sof_rt5682: shrink platform_id names below 20 characters
  ASoC: Intel: glk_rt5682_max98357a: shrink platform_id below 20
    characters
  ASoC: Intel: kbl_da7219_max98357a: shrink platform_id below 20
    characters
  ASoC: Intel: sof_da7219_max98373: shrink platform_id below 20
    characters
  ASoC: Intel: sof_sdw: fix signed/unsigned warning
  ASoC: Intel: soc-acpi: add ull suffix for SoundWire _ADR values
  ASoC: Intel: use MODULE_DEVICE_TABLE with platform_device_id tables

 sound/soc/intel/boards/Kconfig                |  7 ++--
 sound/soc/intel/boards/bxt_da7219_max98357a.c |  4 +-
 sound/soc/intel/boards/bxt_rt298.c            |  3 +-
 sound/soc/intel/boards/ehl_rt5660.c           |  2 +-
 sound/soc/intel/boards/glk_rt5682_max98357a.c |  4 +-
 sound/soc/intel/boards/kbl_da7219_max98357a.c |  4 +-
 sound/soc/intel/boards/kbl_da7219_max98927.c  |  5 +--
 sound/soc/intel/boards/kbl_rt5660.c           |  2 +-
 sound/soc/intel/boards/kbl_rt5663_max98927.c  |  3 +-
 .../intel/boards/kbl_rt5663_rt5514_max98927.c |  2 +-
 .../soc/intel/boards/skl_nau88l25_max98357a.c |  3 +-
 sound/soc/intel/boards/skl_nau88l25_ssm4567.c |  3 +-
 sound/soc/intel/boards/skl_rt286.c            |  3 +-
 sound/soc/intel/boards/sof_cs42l42.c          |  3 +-
 sound/soc/intel/boards/sof_da7219_max98373.c  |  6 +--
 sound/soc/intel/boards/sof_rt5682.c           | 20 +++-------
 sound/soc/intel/boards/sof_sdw.c              |  5 +--
 sound/soc/intel/boards/sof_sdw_common.h       |  1 -
 sound/soc/intel/boards/sof_sdw_hdmi.c         | 37 +-----------------
 .../intel/common/soc-acpi-intel-adl-match.c   | 28 +++++++-------
 .../intel/common/soc-acpi-intel-cml-match.c   | 20 +++++-----
 .../intel/common/soc-acpi-intel-cnl-match.c   |  2 +-
 .../intel/common/soc-acpi-intel-glk-match.c   |  2 +-
 .../intel/common/soc-acpi-intel-icl-match.c   | 12 +++---
 .../intel/common/soc-acpi-intel-jsl-match.c   |  6 +--
 .../intel/common/soc-acpi-intel-kbl-match.c   |  2 +-
 .../intel/common/soc-acpi-intel-tgl-match.c   | 38 +++++++++----------
 27 files changed, 83 insertions(+), 144 deletions(-)

--
2.25.1

3 years agoALSA: hda: Add IRQ check for platform_get_irq()
Jiajun Cao [Tue, 22 Jun 2021 13:19:42 +0000 (21:19 +0800)]
ALSA: hda: Add IRQ check for platform_get_irq()

The function hda_tegra_first_init() neglects to check the return
value after executing platform_get_irq().

hda_tegra_first_init() should check the return value (if negative
error number) for errors so as to not pass a negative value to
the devm_request_irq().

Fix it by adding a check for the return value irq_id.

Signed-off-by: Jiajun Cao <jjcao20@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20210622131947.94346-1-jjcao20@fudan.edu.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoASoC: fsl-asoc-card: change dev_err to dev_dbg for defer probe
Shengjiu Wang [Wed, 2 Jun 2021 06:42:12 +0000 (14:42 +0800)]
ASoC: fsl-asoc-card: change dev_err to dev_dbg for defer probe

Don't need to print error message for defer probe

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/1622616132-10391-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: simple-card: Fill in driver name
Guido Günther [Tue, 22 Jun 2021 08:27:09 +0000 (10:27 +0200)]
ASoC: simple-card: Fill in driver name

alsa-ucm groups by driver name so fill that in as well. Otherwise the
presented information is redundant and doesn't reflect the used
driver. We can't just use 'asoc-simple-card' since the driver name is
restricted to 15 characters.

Before:

 # cat /proc/asound/cards
 0 [Devkit         ]: Librem_5_Devkit - Librem 5 Devkit
                      Librem 5 Devkit
After:

 0 [Devkit         ]: simple-card - Librem 5 Devkit
                      Librem 5 Devkit

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Link: https://lore.kernel.org/r/YNGe3akAntQi8qJD@qwark.sigxcpu.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: SOF: imx: Add missing of_node_put() in imx8_probe()
Yang Yingliang [Thu, 17 Jun 2021 03:27:56 +0000 (11:27 +0800)]
ASoC: SOF: imx: Add missing of_node_put() in imx8_probe()

This node pointer is returned by of_parse_phandle() with refcount
incremented in this function. of_node_put() on it before exiting
this function.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210617032756.599359-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: codecs: wcd938x: fix uninitialized symbol warnings
Srinivas Kandagatla [Mon, 21 Jun 2021 13:45:02 +0000 (14:45 +0100)]
ASoC: codecs: wcd938x: fix uninitialized symbol warnings

This patch fixes below two uninitialized symbol warnings

warning:
sound/soc/codecs/wcd938x.c:2092 wcd938x_tx_swr_ctrl()
error: uninitialized symbol 'rate'

sound/soc/codecs/wcd938x.c:2189 wcd938x_tx_channel_config()
error: uninitialized symbol 'reg'.

First one my brining in check to already existing if condition and
second one by adding a default switch case to avoid any access to reg.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210621134502.19537-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: codecs: wcd938x: fix unused variable warning
Srinivas Kandagatla [Mon, 21 Jun 2021 13:45:01 +0000 (14:45 +0100)]
ASoC: codecs: wcd938x: fix unused variable warning

This patch fixes below

warning: unused variable wcd938x_dt_match

by placing device match table under CONFIG_OF

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210621134502.19537-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: skl_hda_dsp_generic: Update Kconfig documentation
Kai Vehmanen [Mon, 21 Jun 2021 19:40:57 +0000 (14:40 -0500)]
ASoC: Intel: skl_hda_dsp_generic: Update Kconfig documentation

The Kconfig documentation for SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH
is a bit misleading as it refers to a set of older platforms,
while in practise this machine driver supports all modern
Intel systems with Smart Sound Technology based DSP and HDA codecs.

Modify the Kconfig text to reflect current state.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210621194057.21711-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: use MODULE_DEVICE_TABLE with platform_device_id tables
Pierre-Louis Bossart [Mon, 21 Jun 2021 19:40:56 +0000 (14:40 -0500)]
ASoC: Intel: use MODULE_DEVICE_TABLE with platform_device_id tables

When we have a platform_device_id table, we can use
MODULE_DEVICE_TABLE to automatically generate the modalias. As a
result we can remove the manual insertion of MODULE_ALIAS.

Reported-by: Hulk Robot <hulkci@huawei.com>
Suggested-by: Zou Wei <zou_wei@huawei.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20210621194057.21711-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: soc-acpi: add ull suffix for SoundWire _ADR values
Pierre-Louis Bossart [Mon, 21 Jun 2021 19:40:55 +0000 (14:40 -0500)]
ASoC: Intel: soc-acpi: add ull suffix for SoundWire _ADR values

Sparse throws the following type of warnings:

sound/soc/intel/common/soc-acpi-intel-adl-match.c:34:24: error:
constant 0x000020025D071100 is so big it is long

Let's add the 'ull' suffix to make this go away and find real issues.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20210621194057.21711-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: sof_sdw: fix signed/unsigned warning
Pierre-Louis Bossart [Mon, 21 Jun 2021 19:40:54 +0000 (14:40 -0500)]
ASoC: Intel: sof_sdw: fix signed/unsigned warning

Sparse throws the following warning:

sound/soc/intel/boards/sof_sdw.c:796:31: error: incorrect type in argument 6 (different signedness)
sound/soc/intel/boards/sof_sdw.c:796:31:    expected int *group_id
sound/soc/intel/boards/sof_sdw.c:796:31:    got unsigned int *

The group_id cannot be negative, use unsigned int.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20210621194057.21711-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: sof_da7219_max98373: shrink platform_id below 20 characters
Pierre-Louis Bossart [Mon, 21 Jun 2021 19:40:53 +0000 (14:40 -0500)]
ASoC: Intel: sof_da7219_max98373: shrink platform_id below 20 characters

Sparse throws the following warning:

sound/soc/intel/boards/sof_da7219_max98373.c:438:25: error: too long
initializer-string for array of char(no space for nul char)

Fix by using 'mx' acronym for Maxim.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20210621194057.21711-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: kbl_da7219_max98357a: shrink platform_id below 20 characters
Pierre-Louis Bossart [Mon, 21 Jun 2021 19:40:52 +0000 (14:40 -0500)]
ASoC: Intel: kbl_da7219_max98357a: shrink platform_id below 20 characters

Sparse throws the following warnings:

sound/soc/intel/boards/kbl_da7219_max98357a.c:647:25: error: too long
initializer-string for array of char(no space for nul char)

Fix by using the 'mx' acronym for Maxim.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20210621194057.21711-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: glk_rt5682_max98357a: shrink platform_id below 20 characters
Pierre-Louis Bossart [Mon, 21 Jun 2021 19:40:51 +0000 (14:40 -0500)]
ASoC: Intel: glk_rt5682_max98357a: shrink platform_id below 20 characters

Sparse throws the following warning:

sound/soc/intel/boards/glk_rt5682_max98357a.c:622:25: error: too long
initializer-string for array of char(no space for nul char)

Fix by using the 'mx' acronym for Maxim

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20210621194057.21711-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: sof_rt5682: shrink platform_id names below 20 characters
Pierre-Louis Bossart [Mon, 21 Jun 2021 19:40:50 +0000 (14:40 -0500)]
ASoC: Intel: sof_rt5682: shrink platform_id names below 20 characters

Some Chromebooks machine driver aliases exceed 20 characters, which
leads to sparse warnings:

sound/soc/intel/boards/sof_rt5682.c:959:25: error: too long
initializer-string for array of char(no space for nul char)

sound/soc/intel/boards/sof_rt5682.c:989:25: error: too long
initializer-string for array of char(no space for nul char)

sound/soc/intel/boards/sof_rt5682.c:1039:25: error: too long
initializer-string for array of char(no space for nul char)

Fix by using the 'mx' shortcut for Maxim platforms (already used in
platform firmware)

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20210621194057.21711-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: sof_sdw: remove hdac-hdmi support
Kai Vehmanen [Mon, 21 Jun 2021 19:40:49 +0000 (14:40 -0500)]
ASoC: Intel: sof_sdw: remove hdac-hdmi support

Remove support for using hdac_hdmi codec driver. No known products use
this configuration and hdac_hdmi cannot support all the platforms
sof_sdw does.

This change also fixes a bug in Kconfig rules.
SND_SOC_INTEL_SOUNDWIRE_SOF_MACH did not have a select SND_SOC_HDAC_HDMI
and this could cause build failures.

Reported-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Tested-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210621194057.21711-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: sof_sdw: use mach data for ADL RVP DMIC count
Kai Vehmanen [Mon, 21 Jun 2021 19:40:48 +0000 (14:40 -0500)]
ASoC: Intel: sof_sdw: use mach data for ADL RVP DMIC count

On the reference boards, number of PCH dmics may vary and the number
should be taken from driver machine data. Remove the SOF_SDW_PCH_DMIC
quirk to make DMIC number configurable.

Fixes:d25bbe80485f8 ("ASoC: Intel: sof_sdw: add quirk for new ADL-P Rvp")

BugLink: https://github.com/thesofproject/sof/issues/4185
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210621194057.21711-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoALSA: usb-audio: Fix OOB access at proc output
Takashi Iwai [Tue, 22 Jun 2021 09:06:47 +0000 (11:06 +0200)]
ALSA: usb-audio: Fix OOB access at proc output

At extending the available mixer values for 32bit types, we forgot to
add the corresponding entries for the format dump in the proc output.
This may result in OOB access.  Here adds the missing entries.

Fixes: bc18e31c3042 ("ALSA: usb-audio: Fix parameter block size for UAC2 control requests")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210622090647.14021-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoMerge series "ASoC: fsl: Use devm_platform_get_and_ioremap_resource()" from Yang...
Mark Brown [Mon, 21 Jun 2021 18:16:54 +0000 (19:16 +0100)]
Merge series "ASoC: fsl: Use devm_platform_get_and_ioremap_resource()" from Yang Yingliang <yangyingliang@huawei.com>:

patch #1 ~ #8:
  Use devm_platform_get_and_ioremap_resource()

patch #9
  check return value of platform_get_resource_byname()

v2:
  change error message in patch #9

Yang Yingliang (9):
  ASoC: fsl_asrc: Use devm_platform_get_and_ioremap_resource()
  ASoC: fsl_aud2htx: Use devm_platform_get_and_ioremap_resource()
  ASoC: fsl_easrc: Use devm_platform_get_and_ioremap_resource()
  ASoC: fsl_esai: Use devm_platform_get_and_ioremap_resource()
  ASoC: fsl_micfil: Use devm_platform_get_and_ioremap_resource()
  ASoC: fsl_sai: Use devm_platform_get_and_ioremap_resource()
  ASoC: fsl_spdif: Use devm_platform_get_and_ioremap_resource()
  ASoC: fsl_ssi: Use devm_platform_get_and_ioremap_resource()
  ASoC: fsl_xcvr: check return value after calling
    platform_get_resource_byname()

 sound/soc/fsl/fsl_asrc.c    | 3 +--
 sound/soc/fsl/fsl_aud2htx.c | 3 +--
 sound/soc/fsl/fsl_easrc.c   | 3 +--
 sound/soc/fsl/fsl_esai.c    | 3 +--
 sound/soc/fsl/fsl_micfil.c  | 3 +--
 sound/soc/fsl/fsl_sai.c     | 3 +--
 sound/soc/fsl/fsl_spdif.c   | 3 +--
 sound/soc/fsl/fsl_ssi.c     | 3 +--
 sound/soc/fsl/fsl_xcvr.c    | 4 ++++
 9 files changed, 12 insertions(+), 16 deletions(-)

--
2.25.1

3 years agoMerge series "ASoC: tidyup snd_soc_of_parse_daifmt()" from Kuninori Morimoto <kuninor...
Mark Brown [Mon, 21 Jun 2021 18:16:53 +0000 (19:16 +0100)]
Merge series "ASoC: tidyup snd_soc_of_parse_daifmt()" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Hi Mark

These are v3 of parsing for daifmt.

I want to add new audio-graph-card2 sound card driver,
and this is last part of necessary soc-core cleanup for it.

Current some drivers are using DT, and then,
snd_soc_of_parse_daifmt() parses daifmt, but bitclock/frame provider
parsing part is one of headache, because we are assuming below both cases.

A) node {
bitclock-master;
frame-master;
...
};

B) link {
bitclock-master = <&xxx>;
frame-master = <&xxx>;
...
};

The original was style A), and style B) was added later.

snd_soc_of_parse_daifmt() parses A) style as original style,
and user need to update to B) style for clock_provider part if needed.

To handle it more flexibile, this patch-set adds new functions
which separates snd_soc_of_parse_daifmt() helper function.

snd_soc_daifmt_parse_format() : format part
snd_soc_daifmt_parse_clock_provider_as_flag() : clock part for style A)
snd_soc_daifmt_parse_clock_provider_as_phandl() : clock part for style B)
snd_soc_daifmt_parse_clock_provider_as_bitmap() : clock part use with _from_bitmap

v1 -> v2
- tidyup parse_clock_provider functions to _as_flag/phandle/bitmap()
- don't exchange code style on each drivers.

v2 -> v3
- use daifmt as much as possible (don't use daiclk) on each driver.

Link: https://lore.kernel.org/r/875yypdxlm.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87czsvdc4o.wl-kuninori.morimoto.gx@renesas.com
Kuninori Morimoto (8):
  ASoC: soc-core: add snd_soc_daifmt_clock_provider_from_bitmap()
  ASoC: soc-core: add snd_soc_daifmt_clock_provider_fliped()
  ASoC: soc-core: add snd_soc_daifmt_parse_format/clock_provider()
  ASoC: atmel: switch to use snd_soc_daifmt_parse_format/clock_provider()
  ASoC: fsl: switch to use snd_soc_daifmt_parse_format/clock_provider()
  ASoC: meson: switch to use snd_soc_daifmt_parse_format/clock_provider()
  ASoC: simple-card-utils: switch to use snd_soc_daifmt_parse_format/clock_provider()
  ASoC: soc-core: remove snd_soc_of_parse_daifmt()

 include/sound/soc.h                   |  21 ++++-
 sound/soc/atmel/mikroe-proto.c        |   9 ++-
 sound/soc/fsl/fsl-asoc-card.c         |   7 +-
 sound/soc/generic/simple-card-utils.c |  16 ++--
 sound/soc/meson/meson-card-utils.c    |   6 +-
 sound/soc/soc-core.c                  | 109 +++++++++++++++++---------
 6 files changed, 106 insertions(+), 62 deletions(-)

--
2.25.1

3 years agoMerge series "ASoC: sunxi: Use devm_platform_get_and_ioremap_resource()" from Yang...
Mark Brown [Mon, 21 Jun 2021 18:16:52 +0000 (19:16 +0100)]
Merge series "ASoC: sunxi: Use devm_platform_get_and_ioremap_resource()" from Yang Yingliang <yangyingliang@huawei.com>:

Use devm_platform_get_and_ioremap_resource() to simplify
code.

Yang Yingliang (3):
  ASoC: sunxi: sun4i-codec: Use devm_platform_get_and_ioremap_resource()
  ASoC: sun4i-i2s: Use devm_platform_get_and_ioremap_resource()
  ASoC: sunxi: sun4i-spdif: Use devm_platform_get_and_ioremap_resource()

 sound/soc/sunxi/sun4i-codec.c | 3 +--
 sound/soc/sunxi/sun4i-i2s.c   | 3 +--
 sound/soc/sunxi/sun4i-spdif.c | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

--
2.25.1

3 years agoMerge series "ASoC: samsung: Use devm_platform_get_and_ioremap_resource()" from Yang...
Mark Brown [Mon, 21 Jun 2021 18:16:51 +0000 (19:16 +0100)]
Merge series "ASoC: samsung: Use devm_platform_get_and_ioremap_resource()" from Yang Yingliang <yangyingliang@huawei.com>:

Use devm_platform_get_and_ioremap_resource() to simplify
code.

Yang Yingliang (4):
  ASoC: samsung: i2s: Use devm_platform_get_and_ioremap_resource()
  ASoC: samsung: pcm: Use devm_platform_get_and_ioremap_resource()
  ASoC: samsung: s3c2412-i2s: Use
    devm_platform_get_and_ioremap_resource()
  ASoC: samsung: s3c24xx-i2s: Use
    devm_platform_get_and_ioremap_resource()

 sound/soc/samsung/i2s.c         | 3 +--
 sound/soc/samsung/pcm.c         | 3 +--
 sound/soc/samsung/s3c2412-i2s.c | 3 +--
 sound/soc/samsung/s3c24xx-i2s.c | 3 +--
 4 files changed, 4 insertions(+), 8 deletions(-)

--
2.25.1

3 years agoASoC: fsl_xcvr: disable all interrupts when suspend happens
Shengjiu Wang [Fri, 18 Jun 2021 12:38:33 +0000 (20:38 +0800)]
ASoC: fsl_xcvr: disable all interrupts when suspend happens

There is an unhandled interrupt after suspend, which cause endless
interrupt when system resume, so system may hang.

Disable all interrupts in runtime suspend callback to avoid above
issue.

Fixes: 28564486866f ("ASoC: fsl_xcvr: Add XCVR ASoC CPU DAI driver")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/1624019913-3380-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: tegra: Fix a NULL vs IS_ERR() check
Dan Carpenter [Fri, 18 Jun 2021 13:44:24 +0000 (16:44 +0300)]
ASoC: tegra: Fix a NULL vs IS_ERR() check

The tegra_machine_parse_phandle() function doesn't return NULL, it returns
error pointers.

Fixes: cc8f70f56039 ("ASoC: tegra: Unify ASoC machine drivers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/YMyjOKFsPe9SietU@mwanda
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: qcom: lpass-cpu: Use devm_platform_get_and_ioremap_resource()
Yang Yingliang [Tue, 15 Jun 2021 14:07:11 +0000 (22:07 +0800)]
ASoC: qcom: lpass-cpu: Use devm_platform_get_and_ioremap_resource()

Use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210615140711.1676704-2-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: qcom: apq8016_sbc: Use devm_platform_get_and_ioremap_resource()
Yang Yingliang [Tue, 15 Jun 2021 14:07:10 +0000 (22:07 +0800)]
ASoC: qcom: apq8016_sbc: Use devm_platform_get_and_ioremap_resource()

Use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210615140711.1676704-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt711: add two jack detection modes
Shuming Fan [Thu, 17 Jun 2021 09:08:22 +0000 (17:08 +0800)]
ASoC: rt711: add two jack detection modes

Some boards use different circuits for jack detection.
This patch adds two modes as below
1. JD2/2 ports/external resister 100k
2. JD2/1 port/JD voltage 1.8V

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20210617090822.16960-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>