Commit Graph

1170209 Commits

Author SHA1 Message Date
Oswald Buddenhagen 6ffa6f397e ALSA: pcm: simplify top-up mode init in snd_pcm_playback_silence()
Inline the remaining call of snd_pcm_playback_hw_avail(). This makes
the top-up branch more congruent with the thresholded one, and allows
simplifying the handling of the corner cases.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230505155244.2312199-6-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-05 18:23:52 +02:00
Jaroslav Kysela 6d8d56db0c ALSA: pcm: playback silence - move silence variable updates to separate function
The code tracking the added samples in thresholded mode and the code
tracking the just played samples in top-up mode are semantically
identical, so factor it out to a common function to enhance readability.

Co-developed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230505155244.2312199-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-05 18:23:52 +02:00
Jaroslav Kysela 190cb66a4e ALSA: pcm: playback silence - remove extra code
The removed condition handles de facto only one situation where
runtime->silence_filled variable is equal to runtime->buffer_size,
because this variable cannot go over the buffer size. This case is
implicitly caught by the required comparison of the noise distance
with the threshold.

Suggested-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230505155244.2312199-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-05 18:23:51 +02:00
Jaroslav Kysela 781b4da64b ALSA: pcm: fix playback silence - correct incremental silencing
Commit 9a826ddba6 ("[ALSA] pcm core: fix silence_start calculations")
came with exactly the right commit message, but the patch just made
things broken in a different way: We'd fill at a too low address if the
area was already partially zeroed, so we'd under-fill. This affected
both thresholded mode (where it was somewhat less likely) and top-up
mode (where it would be the case consistently).

Co-developed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230505155244.2312199-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-05 18:23:50 +02:00
Jaroslav Kysela 2fbaa44a59 ALSA: pcm: fix playback silence - use the actual new_hw_ptr for the threshold mode
The snd_pcm_playback_hw_avail() function uses runtime->status->hw_ptr.
Unfortunately, in case when we call this function from snd_pcm_update_hw_ptr0(),
this variable contains the previous hardware pointer. Use the new_hw_ptr
argument to calculate hw_avail (filled samples by the user space) to
correct the threshold comparison.

The new_hw_ptr argument may also be set to ULONG_MAX which means the
initialization phase. In this case, use runtime->status->hw_ptr.

Suggested-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230505155244.2312199-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-05 18:23:49 +02:00
Jaroslav Kysela d7f5dd9790 ALSA: pcm: Revert "ALSA: pcm: rewrite snd_pcm_playback_silence()"
This reverts commit 9f656705c5.

There was a regression (in the top-up mode). Unfortunately, the patch
provided from the author of this commit is not easy to review.

Keep the updated and new comments in headers.
Also add a new comment that documents the missed API constraint which
led to the regression.

Reported-by: Jeff Chua <jeff.chua.linux@gmail.com>
Link: https://lore.kernel.org/r/CAAJw_ZsbTVd3Es373x_wTNDF7RknGhCD0r+NKUSwAO7HpLAkYA@mail.gmail.com
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230505155244.2312199-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-05 18:23:48 +02:00
Kai-Heng Feng 56fc217f0d ALSA: hda/realtek: Fix mute and micmute LEDs for an HP laptop
There's another laptop that needs the fixup to enable mute and micmute
LEDs. So do it accordingly.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230505125925.543601-1-kai.heng.feng@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-05 17:12:28 +02:00
Takashi Iwai 4a2248855f ASoC: Fixes for v6.4
A small set of fixes and device quirks that have come in during the
 merge window, the Qualcomm fix seems quite large but it's mainly code
 motion so looks larger than it is.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmRU+zUTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0IPPB/457WnFOGXv/3FSOfTU4KVznNPOS9NM
 7MfpsaI+ZtwhmHUZq/8Vd9+qcrKp4W6oJQa8z95oU+H3UQHmO8S9I4Ae+rqfzKSo
 t7Gu/NTWZ89Vhib9w+ACXclFD0wwz5WxRuvZKQhW5iNMpY3S/ha7lBh9KK5Csb6+
 JFiCsZcw4uWSdrH7hizZUQwZSZVyk3yoUDVDGOwUhCZ5ZS9N7/I5LQbI77Q1vadS
 9H1xtKt6UA8Dq2a9yF7LEvNBb16TfJjGv46BviUdqs/fLGMCROU1wBYDoomAnS1I
 iW0OGUwWGie/BAaDj3H1cwH9oEpUBm9wrjuRGf6MSuG/lrJeZOQ4zqIs
 =Opld
 -----END PGP SIGNATURE-----

Merge tag 'asoc-fix-v6.4-rc1' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v6.4

A small set of fixes and device quirks that have come in during the
merge window, the Qualcomm fix seems quite large but it's mainly code
motion so looks larger than it is.
2023-05-05 17:11:08 +02:00
Ruliang Lin 0d727e1856 ALSA: caiaq: input: Add error handling for unsupported input methods in `snd_usb_caiaq_input_init`
Smatch complains that:
snd_usb_caiaq_input_init() warn: missing error code 'ret'

This patch adds a new case to handle the situation where the
device does not support any input methods in the
`snd_usb_caiaq_input_init` function. It returns an `-EINVAL` error code
to indicate that no input methods are supported on the device.

Fixes: 523f1dce37 ("[ALSA] Add Native Instrument usb audio device support")
Signed-off-by: Ruliang Lin <u202112092@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
Acked-by: Daniel Mack <daniel@zonque.org>
Link: https://lore.kernel.org/r/20230504065054.3309-1-u202112092@hust.edu.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-04 09:50:11 +02:00
Geraldo Nascimento 7501f47297 ALSA: usb-audio: Add quirk for Pioneer DDJ-800
One more Pioneer quirk, this time for DDJ-800, which is quite similar like
other DJ DDJ models but with slightly different EPs or channels.

Signed-off-by: Geraldo Nascimento <geraldogabriel@gmail.com>
Tested-by: Grégory Desor <gregory.desor@free.fr>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/ZFLLzgEcsSF5aIHG@geday
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-04 09:39:06 +02:00
Caleb Harper e7477cb976 ALSA: hda/realtek: support HP Pavilion Aero 13-be0xxx Mute LED
This patch adds support for the mute LED on the HP Pavilion Aero Laptop
13-be0xxx. The current behavior is that the LED does not turn on at any
time and does not indicate to the user whether the sound is muted.

The solution is to add a PCI quirk to properly recognize and support the
LED on this device.

This change has been tested on the device in question using modified
versions of kernels 6.0.7-6.2.12 on Arch Linux.

Signed-off-by: Caleb Harper <calebharp2005@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230503175026.6796-1-calebharp2005@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-04 09:36:25 +02:00
Hans de Goede ec6f82b4c6
ASoC: Intel: soc-acpi-cht: Add quirk for Nextbook Ares 8A tablet
The Nextbook Ares 8A tablet which has Android as factory OS, has a buggy
DSDT with both ESSX8316 and 10EC5651 ACPI devices.

This tablet actually uses an rt5651 codec, but the matching code ends up
picking the ESSX8316 device, add a quirk to ignote the ESSX8316 device
on this tablet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Message-Id: <20230429104721.7176-1-hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-05-04 10:14:31 +09:00
Andrey Rakhmatullin 4a1b5bc73e
ASoC: amd: yc: Add Asus VivoBook Pro 14 OLED M6400RC to the quirks list for acp6x
This is needed (and enough) to get the internal mic visible and working.

Signed-off-by: Andrey Rakhmatullin <wrar@wrar.name>
Message-Id: <20230501185134.34591-1-wrar@wrar.name>
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-05-04 10:14:30 +09:00
Krzysztof Kozlowski 84822215ac
ASoC: codecs: wcd938x: fix accessing regmap on unattached devices
The WCD938x comes with three devices on two Linux drivers:
1. RX Soundwire device (wcd938x-sdw.c driver),
2. TX Soundwire device, which is used to access devices via regmap (also
   wcd938x-sdw.c driver),
3. platform device (wcd938x.c driver) - glue and component master,
   actually having most of the code using TX Soundwire device regmap.

When RX and TX Soundwire devices probe, the component master (platform
device) bind tries to write micbias configuration via TX Soundwire
regmap.  This might happen before TX Soundwire enumerates, so the regmap
access fails.  On Qualcomm SM8550 board with WCD9385:

  qcom-soundwire 6d30000.soundwire-controller: Qualcomm Soundwire controller v2.0.0 Registered
  wcd938x_codec audio-codec: bound sdw:0:0217:010d:00:4 (ops wcd938x_sdw_component_ops)
  wcd938x_codec audio-codec: bound sdw:0:0217:010d:00:3 (ops wcd938x_sdw_component_ops)
  qcom-soundwire 6ad0000.soundwire-controller: swrm_wait_for_wr_fifo_avail err write overflow

Fix the issue by:
1. Moving the regmap creation from platform device to TX Soundwire
   device.  The regmap settings are moved as-is with one difference:
   making the wcd938x_regmap_config const.
2. Using regmap in cache only mode till the actual TX Soundwire device
   enumerates and then sync the regmap cache.

Cc: <stable@vger.kernel.org> # v3.14+
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Message-Id: <20230503144102.242240-1-krzysztof.kozlowski@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-05-04 10:14:30 +09:00
Bagas Sanjaya e4212ed0ba ALSA: docs: Fix code block indentation in ALSA driver example
Sphinx reports htmldocs warnings:

Documentation/sound/kernel-api/writing-an-alsa-driver.rst:3997: WARNING: Literal block expected; none found.
Documentation/sound/kernel-api/writing-an-alsa-driver.rst:4004: WARNING: Literal block expected; none found.
Documentation/sound/kernel-api/writing-an-alsa-driver.rst:4009: WARNING: Unexpected indentation.
Documentation/sound/kernel-api/writing-an-alsa-driver.rst:4035: WARNING: Literal block expected; none found.

These are due to indentation of example driver snippets which is outside
the code block scope.

Fix these by indenting code blocks in question to the scope.

Fixes: 4d421eebe1 ("ALSA: docs: writing-an-alsa-driver.rst: polishing")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/linux-doc/202305021822.4U6XOvGf-lkp@intel.com/
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
Link: https://lore.kernel.org/r/20230503035416.62722-1-bagasdotme@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-03 08:08:25 +02:00
Ivan Orlov 1604f51b40 ALSA: docs: Extend module parameters description
Common ALSA module parameters look a little bit confusing because of the
description lacking, and it took me a while to understand the purpose of
their existence. To figure it out I asked the question about them to the
"alsa-devel" mailing list, and Takashi Iwai answered me with the text I
appended to the ALSA documentation in this patch.

These common module parameters aren't used a lot nowadays, but as I
understand they are important for providing compatibility with some
existing user-space apps. So in my opinion it is a good idea to document
why we need them.

Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20230501101634.476297-1-ivan.orlov0322@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-03 08:06:37 +02:00
Mark Asselstine 7e2d06628a ALSA: hda/realtek: Add quirk for ASUS UM3402YAR using CS35L41
This Asus Zenbook laptop uses Realtek HDA codec combined with
2xCS35L41 Amplifiers using I2C with External Boost.

Signed-off-by: Mark Asselstine <asselsm@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230501231346.54979-1-asselsm@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-02 16:03:07 +02:00
Oswald Buddenhagen 9d2f38638a ALSA: emu10k1: use more existing defines instead of open-coded numbers
Using the *_MASK defines for "maximal value" is debatable. I got the
idea from FreeBSD, and it sorta makes sense to me.

Some hunks look a bit incomplete, because code that is going to be
subsequently removed is not touched here.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230428080732.1697695-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-28 11:22:51 +02:00
Enrico Belleri 110ccfa9dd
ASoC: amd: yc: Add ASUS M3402RA into DMI table
Fix builtin microphone on ASUS Vivobook S 14 OLED 2022 (M3402RA)

Same issue with this model as apparently with other Rembrandt laptops: https://bugzilla.kernel.org/show_bug.cgi?id=216270

Signed-off-by: Enrico Belleri <kilgore.trout@idesmi.eu>
Link: https://lore.kernel.org/r/20230427191645.24519-1-kilgore.trout@idesmi.eu
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-04-27 21:55:33 +01:00
Vitaly Rodionov 067eb08459 ALSA: hda/realtek: Add quirk for ThinkPad P1 Gen 6
Lenovo ThinkPad P1 Gen 6 laptop has 2 CS35L41 amplifies
on I2C bus connected to Realtek codec.

Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230427110452.13787-1-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-27 14:22:42 +02:00
Takashi Iwai ea3292986c Merge branch 'for-linus' into for-next
Merge 6.3-devel branch back in order to apply the more Realtek HD-audio
changes cleanly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-27 14:21:18 +02:00
jasontao c51e431052 ALSA: hda: Glenfly: add HD Audio PCI IDs and HDMI Codec Vendor IDs.
Add a set of HD Audio PCI IDS, and the HDMI codec vendor IDs for
Glenfly Gpus.

- In default_bdl_pos_adj, set bdl to 128 as Glenfly Gpus have hardware
limitation, need to increase hdac interrupt interval.
- In azx_first_init, enable polling mode for Glenfly Gpu. When the codec
complete the command, it sends interrupt and writes response entries to
memory, howerver, the write requests sometimes are not actually
synchronized to memory when driver handle hdac interrupt on Glenfly Gpus.
If the RIRB status is not updated in the interrupt handler,
azx_rirb_get_response keeps trying to recevie a response from rirb until
1s timeout. Enabling polling mode for Glenfly Gpu can fix the issue.
- In patch_gf_hdmi, set Glenlfy Gpu Codec's no_sticky_stream as it need
driver to do actual clean-ups for the linked codec when switch from one
codec to another.

Signed-off-by: jasontao <jasontao@glenfly.com>
Signed-off-by: Reaper Li <reaperlioc@glenfly.com>
Link: https://lore.kernel.org/r/20230426013059.4329-1-reaperlioc@glenfly.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-26 14:03:36 +02:00
Hans de Goede c963e2ec09
ASoC: Intel: soc-acpi-byt: Fix "WM510205" match no longer working
Commit 7e1d728a94 ("ASoC: Intel: soc-acpi-byt: Add new WM5102 ACPI HID")
added an extra HID to wm5102_comp_ids.codecs, but it forgot to bump
wm5102_comp_ids.num_codecs, causing the last codec HID in the codecs list
to no longer work.

Bump wm5102_comp_ids.num_codecs to fix this.

Fixes: 7e1d728a94 ("ASoC: Intel: soc-acpi-byt: Add new WM5102 ACPI HID")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230421183714.35186-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-04-24 16:41:58 +01:00
Maxim Kochetkov 9e868ca1f2
ASoC: max98090: make it selectable
There is no way to select max98090 from menuconfig right now.
Add a Kconfig menu description to allow building the driver standalone.
It will allow this codec to be used by any other I2S master without
adding extra sound card entry in Kconfig.

Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
Link: https://lore.kernel.org/r/20230421211950.20972-1-fido_max@inbox.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-04-24 16:41:57 +01:00
Takashi Iwai baa6584a24 ASoC: Updates for v6.4
The bulk of the commits here are for the conversion of drivers to use
 void remove callbacks but there's a reasonable amount of other stuff
 going on, the pace of development with the SOF code continues to be high
 and there's a bunch of new drivers too:
 
  - More core cleanups from Morimto-san.
  - Update drivers to have remove() callbacks returning void, mostly
    mechanical with some substantial changes.
  - Continued feature and simplification work on SOF, including addition
    of a no-DSP mode for bringup, HDA MLink and extensions to the IPC4
    protocol.
  - Hibernation support for CS35L45.
  - More DT binding conversions.
  - Support for Cirrus Logic CS35L56, Freescale QMC, Maxim MAX98363,
    nVidia systems with MAX9809x and RT5631, Realtek RT712, Renesas R-Car
    Gen4, Rockchip RK3588 and TI TAS5733.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmRGdEsACgkQJNaLcl1U
 h9BNVAf+Ijupg3dhAl6847v1PRYXkYK6YjAayhNd0xRoRePKnnv1zkrsXSBzxZUM
 8KHpQDUJyfQbPnE2JRmr1WfHSoNDl/NXdJl+lefPBgol5bzxRji68hDPGjA0645o
 R6vzrqLNw8mh3jwptXfEpQfKH8tIvwOeMeLkncDvsm0ZCUR2GhYnjB1g82ih0ssx
 lvh36PdCRF0e/ruHxkiVn9b/riID65oTRkN6IxJqoPnqJZVyCiqmiJcfWePpaPir
 4R9Dyk+REos/aCLdne1g6H21Tgi0td+blv6empqwdEXG41VSdRMTrOZb1ZISKmpF
 ggPbKsk9BjJFBCewllHXJ0YEcBp9/g==
 =TVxt
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v6.4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next

ASoC: Updates for v6.4

The bulk of the commits here are for the conversion of drivers to use
void remove callbacks but there's a reasonable amount of other stuff
going on, the pace of development with the SOF code continues to be high
and there's a bunch of new drivers too:

 - More core cleanups from Morimto-san.
 - Update drivers to have remove() callbacks returning void, mostly
   mechanical with some substantial changes.
 - Continued feature and simplification work on SOF, including addition
   of a no-DSP mode for bringup, HDA MLink and extensions to the IPC4
   protocol.
 - Hibernation support for CS35L45.
 - More DT binding conversions.
 - Support for Cirrus Logic CS35L56, Freescale QMC, Maxim MAX98363,
   nVidia systems with MAX9809x and RT5631, Realtek RT712, Renesas R-Car
   Gen4, Rockchip RK3588 and TI TAS5733.
2023-04-24 15:15:31 +02:00
Oswald Buddenhagen 7002cbd625 ALSA: emu10k1: use high-level I/O in set_filterQ()
This makes the code shorter and more legible.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230423181002.1246793-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-24 08:16:26 +02:00
Oswald Buddenhagen 8d60d5cabe ALSA: emu10k1: use high-level I/O functions also during init
... and also use more pre-defined constants on the way (some of which
required adjustment).

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

Link: https://lore.kernel.org/r/20230422161021.1143967-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-23 09:22:09 +02:00
Oswald Buddenhagen 14a2956539 ALSA: emu10k1: fix error handling in snd_audigy_i2c_volume_put()
Check all inputs before changing anything, and return the right error
code in case of failure.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1144026-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-23 09:22:00 +02:00
Oswald Buddenhagen dad173035e ALSA: emu10k1: don't stop DSP in _snd_emu10k1_{,audigy_}init_efx()
These functions don't actually touch the DSP until they poke the code
into it, at which point it's temporarily stopped anyway. And fx8010.dbg
is already zero anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1144004-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-23 09:21:41 +02:00
Oswald Buddenhagen 3750528921 ALSA: emu10k1: fix SNDRV_EMU10K1_IOCTL_SINGLE_STEP
- Use correct address limit for Audigy
- Use the right constant to actually make a step on Audigy
- Don't store *_DBG_STEP and the address in emu->fx8010.dbg, as
  otherwise unrelated operations would make steps, too

This is untested. as10k1 was never ported to Audigy anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1144004-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-23 09:21:30 +02:00
Oswald Buddenhagen 65243c7eb6 ALSA: emu10k1: skip Sound Blaster-specific hacks for E-MU cards
The rev2 cards use CA0108, but the embedded P17V goes entirely unused.
Also, A_IOCTL (which is really the GPIO port) is actually the FPGA
control port, so messing with it is no good idea.

The hacks are actually mutually exclusive, so make that explicit while
we're at it.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1143888-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-23 09:21:16 +02:00
Oswald Buddenhagen 2696d5a3b0 ALSA: emu10k1: fixup DSP defines
Firstly, fix the distribution between public and private headers.
Otherwise, some of the already public macros wouldn't actually work, and
the SNDRV_EMU10K1_IOCTL_DBG_READ result for Audigy would be useless.

Secondly, add condition code registers for Audigy. These are just
aliases for selected constant registers, and thus are generation-
specific. At least A_CC_REG_ZERO is actually correct ...

Finally, shuffle around some defines to more logical places while at it,
and fix up some more comments.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1143903-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-23 09:19:47 +02:00
Oswald Buddenhagen 145ec1fd00 ALSA: emu10k1: pull in some register definitions from kX-project
For documentation purposes and later use.

Some pre-existing but (mostly) unused definitions were renamed for
consistency.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1143903-6-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-23 09:15:18 +02:00
Oswald Buddenhagen ac9219d93a ALSA: emu10k1: remove some bogus defines
Firstly, remove the FXWC_* defines - the comment on FXWC implies that
the relevant defines are the (A_)EXTOUT_* ones. It's unclear where this
came from - it was in the initial ALSA import, but neither the driver
from Creative nor kX-project have these defines.

Secondly, remove A_HR, which made plain no sense (was unused, and
clashed with FXRT). Amends commit cbb7d8f9b7 ("emu10k1: Update
registers defines for the Audigy 2/emu10k2.5").

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1143903-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-23 09:15:17 +02:00
Oswald Buddenhagen a062b1032a ALSA: emu10k1: eliminate some unused defines
One might be mislead to think that these mean anything.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1143903-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-23 09:15:16 +02:00
Oswald Buddenhagen 6815f5359a ALSA: emu10k1: fix lineup of EMU_HANA_* defines
The bit values are supposed to be internally indented by one step
relative to the register addresses.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1143903-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-23 09:15:16 +02:00
Oswald Buddenhagen a869057cd6 ALSA: emu10k1: comment updates
Move comments to better locations, de-duplicate, fix/remove incorrect/
outdated ones, add new ones, and unify spacing somewhat.

While at it, also add testing credits for Jonathan Dowland (SB Live!
Platinum) and myself (E-MU 0404b).

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1143903-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-23 09:15:13 +02:00
Oswald Buddenhagen 6fb861bb3c ALSA: emu10k1: fix snd_emu1010_fpga_read() input masking for rev2 cards
Unlike the Alice2 chips used on 1st generation E-MU cards, the
Tina/Tina2 chips used on the 2nd gen cards have only six GPIN pins,
which means that we need to use a smaller mask. Failure to do so would
falsify the read data if the FPGA tried to raise an IRQ right at that
moment. This wasn't a problem so far, as we didn't actually enable FPGA
IRQs, but that's going to change soon.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422132430.1057490-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-22 17:34:28 +02:00
Oswald Buddenhagen 8b2dd46d9a ALSA: emu10k1: remove unused emu->pcm_playback_efx_substream field
Amends historic commit 27ae958cf6 ("emu10k1 driver - add multichannel
device hw:x,3 [2-8/8]").

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422132430.1057468-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-22 17:34:04 +02:00
Oswald Buddenhagen be250b7c9b ALSA: emu10k1: remove unused `resume` parameter from snd_emu10k1_init()
This was unnecessarily added in commit 09668b441d ("emu10k1 - Add PM
support").

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422132430.1057468-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-22 17:33:24 +02:00
Oswald Buddenhagen e922da40be ALSA: emu10k1: minor optimizations
- In snd_emu10k1_look_for_ctl(), evaluate the cheap condition first
- In _snd_emu10k1_{audigy_,}init_efx(), don't use expensive bit setting
  loops to fill arrays
- In snd_emu_proc_ptr_reg_read(), remove useless condition - iobase can
  be only 0 or 0x20

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422121519.1052813-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-22 17:32:23 +02:00
Oswald Buddenhagen 335927b125 ALSA: emu10k1: remove remaining cruft from snd_emu10k1_emu1010_init()
Various redundant FPGA writes which were presumably also cargo-culted
from the Windows driver.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230421141006.1005539-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-22 10:43:10 +02:00
Oswald Buddenhagen 1cbad9a50a ALSA: emu10k1: remove apparently pointless EMU_HANA_OPTION_CARDS reads
These seem to be another instance of cargo-culting from the Windows
driver. It presumably queries the register to decide about the followup
actions, but we don't do that.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230421141006.1005539-6-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-22 10:42:47 +02:00
Oswald Buddenhagen 462d972d47 ALSA: emu10k1: remove apparently pointless FPGA reads
These seem to be simply cargo-culted from the Windows driver's behavior.
However, the original reason were presumably read-modify-write cycles,
which we don't do.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230421141006.1005539-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-22 10:42:37 +02:00
Oswald Buddenhagen 384e396f15 ALSA: emu10k1: stop doing weird things with HCFG in snd_emu10k1_emu1010_init()
This doesn't do anything snd_emu10k1_init() wouldn't do later, and none
of the things it does seem relevant for the function itself (which is
pretty much about setting up the FPGA). It was probably a Windows
driver behavior cargo-culting artifact.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230421141006.1005539-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-22 10:42:27 +02:00
Oswald Buddenhagen a1c87c0b27 ALSA: emu10k1: fix access to Audigy GPIO port
As the register definition clearly states, this is a 16-bit register,
yet we did all accesses as 32-bit. The writes in particular would have
the potential to clear the TIMER register (depending on how the bus/card
actually handles the too long writes).

This commit also introduces a separate define A_GPIO which aliases
A_IOCFG, which better reflects the distinct usage on E-MU cards.
This is done in the same commit to keep the churn down, as we're
touching all involved lines anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230421141006.1005539-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-22 10:42:08 +02:00
Oswald Buddenhagen 10f212bd7a ALSA: emu10k1: properly assert E-MU FPGA access constaints
Assert the validity of the registers and values, as them being out of
range would indicate an error in the driver. Consequently, don't bother
returning error codes; they were ignored everywhere anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230421141006.1005539-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-22 10:41:53 +02:00
Oswald Buddenhagen 02a0d9c281 ALSA: emu10k1: clean up P16V part somewhat
Detach it better from the main PCM driver, which it really doesn't have
much in common with.

In particular, this moves the interrupt handler implementation into
p16v.c, and makes it access the substream runtime status more directly,
so it doesn't need to abuse structs snd_emu10k1_pcm and
snd_emu10k1_voice any more.

We don't need private pcm runtime data at all, as the only thing it was
used for (except the back-link to the substream) was the `running` flag.
So store that directly in runtime->private_data.

This somewhat radical strip-down shows that this driver contains some
complexity that was never actually utilized. I suppose the right way to
fully utilize the hardware in a simple way would be introducing more
substreams. This wouldn't require any of the removed code.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

Link: https://lore.kernel.org/r/20230421141006.1005452-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-22 10:41:25 +02:00
Oswald Buddenhagen 14a5c5a44b ALSA: emu10k1: remove unused snd_emu10k1_voice.emu field
It was written, but never read from. Its value is available via the epcm
field.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230421141006.1005452-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-22 10:40:55 +02:00
Oswald Buddenhagen d4af7ca201 ALSA: emu10k1: remove obsolete card type variable and defines
The use of the variable was removed in commit 2b637da5a1 ("clean up
card features"). That commit also broke user space (the ioctl
structure), at which point the defines became meaningless, so I don't
think purging them is a problem.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230421141006.1005452-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-22 10:40:39 +02:00