Commit Graph

10399 Commits

Author SHA1 Message Date
Andy Chi
18a434f32f ALSA: hda/realtek: fix mute/micmute LEDs for a HP ZBook
There is a HP ZBook which using ALC236 codec and need the
ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF quirk to make mute LED
and micmute LED work.

[ confirmed that the new entries are for new models that have no
  proper name, so the strings are left as "HP" which will be updated
  eventually later -- tiwai ]

Signed-off-by: Andy Chi <andy.chi@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20240102024916.19093-1-andy.chi@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-01-02 15:56:01 +01:00
Takashi Iwai
bd968aef07 Merge branch 'topic/cs35l41' into for-next
Pull CS35L41 codec updates for Lenovo laptops.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-30 12:55:04 +01:00
Dorian Cruveiller
ba7053b4b4 ALSA: hda: Add driver properties for cs35l41 for Lenovo Legion Slim 7 Gen 8 serie
Add driver properties on 4 models of this laptop serie since they don't
have _DSD in the ACPI table

Signed-off-by: Dorian Cruveiller <doriancruveiller@gmail.com>
Cc: <stable@vger.kernel.org> # v6.7
Link: https://lore.kernel.org/r/20231230114312.22118-1-doriancruveiller@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-30 12:54:36 +01:00
Dorian Cruveiller
99af5b11c5 ALSA: hda/realtek: enable SND_PCI_QUIRK for Lenovo Legion Slim 7 Gen 8 (2023) serie
Link up the realtek audio chip to the cirrus cs35l41 sound amplifier chip
on 4 models of the Lenovo legion slim 7 gen 8 (2023). These models are
16IRH8 (2 differents subsystem id) and 16APH8 (2 differents subsystem ids).

Subsystem ids list:
 - 17AA38B4
 - 17AA38B5
 - 17AA38B6
 - 17AA38B7

Signed-off-by: Dorian Cruveiller <doriancruveiller@gmail.com>
Cc: <stable@vger.kernel.org> # v6.7
Link: https://lore.kernel.org/r/20231230114001.19855-1-doriancruveiller@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-30 12:54:22 +01:00
Gergo Koteles
68f7f3ff6c ALSA: hda/tas2781: configure the amp after firmware load
Make the amp available immediately after a module
load to avoid having to wait for a PCM hook action.
(eg. unloading & loading the module while listening
music)

Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/7f2f65d9212aa16edd4db8725489ae59dbe74c66.1703895108.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-30 10:50:55 +01:00
Aabish Malik
13a5b21197 ALSA: hda/realtek: enable SND_PCI_QUIRK for hp pavilion 14-ec1xxx series
The HP Pavilion 14 ec1xxx series uses the HP mainboard 8A0F with the
ALC287 codec.
The mute led can be enabled using the already existing
ALC287_FIXUP_HP_GPIO_LED quirk.
Tested on an HP Pavilion ec1003AU

Signed-off-by: Aabish Malik <aabishmalik3337@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231229170352.742261-3-aabishmalik3337@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-30 10:13:57 +01:00
Takashi Iwai
3abf66a42f Merge branch 'topic/cs35l41' into for-next
Pull CS35L41 codec extension series.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-29 15:14:07 +01:00
Stefan Binding
423206604b ALSA: hda/realtek: Add quirks for Dell models
These models use 2 or 4 CS35L41 amps with HDA using SPI and I2C.
Models use internal and external boost.
All models require DSD support to be added inside
cs35l41_hda_property.c

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Cc: <stable@vger.kernel.org> # v6.7+
Link: https://lore.kernel.org/r/20231221132518.3213-4-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-29 14:28:36 +01:00
Stefan Binding
d110858a69 ALSA: hda: cs35l41: Prevent firmware load if SPI speed too low
Some laptops without _DSD have the SPI speed set very low in the BIOS.
Since the SPI controller uses this speed as its max speed, the SPI
transactions are very slow. Firmware download writes to many registers,
and if the SPI speed is too slow, it can take a long time to download.
For this reason, disable firmware loading if the maximum SPI speed is
too low. Without Firmware, audio playback will work, but the volume
will be low to ensure safe operation of the CS35L41.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Cc: <stable@vger.kernel.org> # v6.7+
Link: https://lore.kernel.org/r/20231221132518.3213-3-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-29 14:28:29 +01:00
Stefan Binding
ee694e7db4 ALSA: hda: cs35l41: Support additional Dell models without _DSD
Add new model entries into configuration table.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Cc: <stable@vger.kernel.org> # v6.7+
Link: https://lore.kernel.org/r/20231221132518.3213-2-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-29 14:26:54 +01:00
Gergo Koteles
4e7914eb1d ALSA: hda/tas2781: remove sound controls in unbind
Remove sound controls in hda_unbind to make
module loadable after module unload.

Add a driver specific struct (tas2781_hda) to store
the controls.

This patch depends on patch:
ALSA: hda/tas2781: do not use regcache

Fixes: 5be27f1e3e ("ALSA: hda/tas2781: Add tas2781 HDA driver")
CC: stable@vger.kernel.org
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/362aa3e2f81b9259a3e5222f576bec5debfc5e88.1703204848.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-29 13:42:24 +01:00
Gergo Koteles
e7aa105657 ALSA: hda/tas2781: move set_drv_data outside tasdevice_init
allow driver specific driver data in tas2781-hda-i2c and tas2781-i2c

Fixes: ef3bcde75d ("ASoC: tas2781: Add tas2781 driver")
CC: stable@vger.kernel.org
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/1398bd8bf3e935b1595a99128320e4a1913e210a.1703204848.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-29 13:42:17 +01:00
Gergo Koteles
a0c9f7f2e0 ALSA: hda/tas2781: fix typos in comment
Correct typos.

Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/ead5609d63e71e8e87c13e1767decca5b272d696.1703203812.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-29 13:41:31 +01:00
Gergo Koteles
6dad45f4d2 ALSA: hda/tas2781: do not use regcache
There are two problems with using regcache in this module.

The amplifier has 3 addressing levels (BOOK, PAGE, REG). The firmware
contains blocks that must be written to BOOK 0x8C. The regcache doesn't
know anything about BOOK, so regcache_sync writes invalid values to the
actual BOOK.

The module handles 2 or more separate amplifiers. The amplifiers have
different register values, and the module uses only one regmap/regcache
for all the amplifiers. The regcache_sync only writes the last amplifier
used.

The module successfully restores all the written register values (RC
profile, program, configuration, calibration) without regcache.

Remove regcache functions and set regmap cache_type to REGCACHE_NONE.

Link: https://lore.kernel.org/r/21a183b5a08cb23b193af78d4b1114cc59419272.1701906455.git.soyer@irl.hu/

Fixes: 5be27f1e3e ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Acked-by: Mark Brown <broonie@kernel.org>
CC: stable@vger.kernel.org
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/491aeed0e2eecc3b704ec856f815db21bad3ba0e.1703202126.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-29 13:41:04 +01:00
Stefan Binding
916d051730 ALSA: hda: cs35l41: Only add SPI CS GPIO if SPI is enabled in kernel
If CONFIG_SPI is not set in the kernel, there is no point in trying
to set the chip selects. We can selectively compile it.

Fixes: 8c4c216db8 ("ALSA: hda: cs35l41: Add config table to support many laptops without _DSD")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202312192256.lJelQEoZ-lkp@intel.com/

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231219162232.790358-3-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-21 09:24:01 +01:00
Stefan Binding
ed7326a24a ALSA: hda: cs35l41: Do not allow uninitialised variables to be freed
Initialise the variables to NULL so that they cannot be uninitialised
when devm_kfree is called.

Found by static analysis.

Fixes: 8c4c216db8 ("ALSA: hda: cs35l41: Add config table to support many laptops without _DSD")

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231219162232.790358-2-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-21 09:23:51 +01:00
Stefan Binding
ae53e2198c ALSA: hda/realtek: Add quirks for ASUS Zenbook 2023 Models
These models use 2xCS35L41amps with HDA using SPI and I2C.
Models use internal and external boost.
All models require DSD support to be added inside
cs35l41_hda_property.c

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231218151221.388745-8-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-18 18:46:01 +01:00
Stefan Binding
2b35b66d82 ALSA: hda: cs35l41: Support additional ASUS Zenbook 2023 Models
Add new model entries into configuration table.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231218151221.388745-7-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-18 18:46:01 +01:00
Stefan Binding
51d9760799 ALSA: hda/realtek: Add quirks for ASUS Zenbook 2022 Models
These models use 2xCS35L41amps with HDA using SPI and I2C.
Models use internal and external boost.
All models require DSD support to be added inside
cs35l41_hda_property.c

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231218151221.388745-6-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-18 18:46:00 +01:00
Stefan Binding
b257187bcf ALSA: hda: cs35l41: Support additional ASUS Zenbook 2022 Models
Add new model entries into configuration table.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231218151221.388745-5-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-18 18:46:00 +01:00
Stefan Binding
a40ce9f4bd ALSA: hda/realtek: Add quirks for ASUS ROG 2023 models
These models use 2xCS35L41amps with HDA using SPI and I2C.
All models use Internal Boost.
Some models also use Realtek Speakers in conjunction with
CS35L41.
All models require DSD support to be added inside
cs35l41_hda_property.c

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231218151221.388745-4-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-18 18:45:59 +01:00
Stefan Binding
b592ed2e1d ALSA: hda: cs35l41: Support additional ASUS ROG 2023 models
Add new model entries into configuration table.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231218151221.388745-3-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-18 18:45:59 +01:00
Stefan Binding
8c4c216db8 ALSA: hda: cs35l41: Add config table to support many laptops without _DSD
This make use of the CS35L41 HDA Property framework, which supports
laptops which do not have the _DSD properties in their ACPI.

Add configuration table to be able to use a generic function which allows
laptops to be supported just by adding an entry into the table.

Use configuration table function for existing system 103C89C6.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231218151221.388745-2-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-18 18:45:57 +01:00
Ghanshyam Agrawal
c7e37b07cc ALSA: au88x0: fixed a typo
Fixed typo in the word communicate

Signed-off-by: Ghanshyam Agrawal <ghanshyam1898@gmail.com>
Link: https://lore.kernel.org/r/20231218065442.43523-1-ghanshyam1898@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-18 09:16:34 +01:00
Ghanshyam Agrawal
c18852cf16 ALSA: au88x0: fixed spelling mistakes in au88x0_core.c
Multiple spelling mistakes were reported by codespell.
They were fixed.

Signed-off-by: Ghanshyam Agrawal <ghanshyam1898@gmail.com>
Link: https://lore.kernel.org/r/20231215031144.521359-1-ghanshyam1898@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-15 08:15:17 +01:00
Gergo Koteles
ec1de5c214 ALSA: hda/tas2781: select program 0, conf 0 by default
Currently, cur_prog/cur_conf remains at the default value (-1), while
program 0 has been loaded into the amplifiers.

In the playback hook, tasdevice_tuning_switch tries to restore the
cur_prog/cur_conf. In the runtime_resume/system_resume,
tasdevice_prmg_load tries to load the cur_prog as well.

Set cur_prog and cur_conf to 0 if available in the firmware.

Fixes: 5be27f1e3e ("ALSA: hda/tas2781: Add tas2781 HDA driver")
CC: stable@vger.kernel.org
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/038add0bdca1f979cc7abcce8f24cbcd3544084b.1702596646.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-15 08:13:40 +01:00
Clément Villeret
02a460adfc ALSA: hda/realtek: Add quirk for ASUS ROG GV302XA
Asus ROG Flowx13 (GV302XA) seems require same patch as others asus products

Signed-off-by: Clément Villeret <clement.villeret@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/0a27bf4b-3056-49ac-9651-ebd7f3e36328@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-15 08:12:40 +01:00
Gergo Koteles
315deab289 ALSA: hda/tas2781: reset the amp before component_add
Calling component_add starts loading the firmware, the callback function
writes the program to the amplifiers. If the module resets the
amplifiers after component_add, it happens that one of the amplifiers
does not work because the reset and program writing are interleaving.

Call tas2781_reset before component_add to ensure reliable
initialization.

Fixes: 5be27f1e3e ("ALSA: hda/tas2781: Add tas2781 HDA driver")
CC: stable@vger.kernel.org
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/4d23bf58558e23ee8097de01f70f1eb8d9de2d15.1702511246.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-14 12:04:38 +01:00
Gergo Koteles
6c6fa26414 ALSA: hda/tas2781: call cleanup functions only once
If the module can load the RCA but not the firmware binary, it will call
the cleanup functions. Then unloading the module causes general
protection fault due to double free.

Do not call the cleanup functions in tasdev_fw_ready.

general protection fault, probably for non-canonical address
0x6f2b8a2bff4c8fec: 0000 [#1] PREEMPT SMP NOPTI
Call Trace:
 <TASK>
 ? die_addr+0x36/0x90
 ? exc_general_protection+0x1c5/0x430
 ? asm_exc_general_protection+0x26/0x30
 ? tasdevice_config_info_remove+0x6d/0xd0 [snd_soc_tas2781_fmwlib]
 tas2781_hda_unbind+0xaa/0x100 [snd_hda_scodec_tas2781_i2c]
 component_unbind+0x2e/0x50
 component_unbind_all+0x92/0xa0
 component_del+0xa8/0x140
 tas2781_hda_remove.isra.0+0x32/0x60 [snd_hda_scodec_tas2781_i2c]
 i2c_device_remove+0x26/0xb0

Fixes: 5be27f1e3e ("ALSA: hda/tas2781: Add tas2781 HDA driver")
CC: stable@vger.kernel.org
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/1a0885c424bb21172702d254655882b59ef6477a.1702510018.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-14 12:03:49 +01:00
Gergo Koteles
3307142271 ALSA: hda/tas2781: handle missing EFI calibration data
The code does not properly check whether the calibration variable is
available in the EFI. If it is not available, it causes a NULL pointer
dereference.

Check the return value of the first get_variable call also.

BUG: kernel NULL pointer dereference, address: 0000000000000000
Call Trace:
 <TASK>
 ? __die+0x23/0x70
 ? page_fault_oops+0x171/0x4e0
 ? srso_alias_return_thunk+0x5/0x7f
 ? schedule+0x5e/0xd0
 ? exc_page_fault+0x7f/0x180
 ? asm_exc_page_fault+0x26/0x30
 ? crc32_body+0x2c/0x120
 ? tas2781_save_calibration+0xe4/0x220 [snd_hda_scodec_tas2781_i2c]
 tasdev_fw_ready+0x1af/0x280 [snd_hda_scodec_tas2781_i2c]
 request_firmware_work_func+0x59/0xa0

Fixes: 5be27f1e3e ("ALSA: hda/tas2781: Add tas2781 HDA driver")
CC: stable@vger.kernel.org
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/f1f6583bda918f78556f67d522ca7b3b91cebbd5.1702251102.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-11 08:58:18 +01:00
Gergo Koteles
75a25d31b8 ALSA: hda/tas2781: leave hda_component in usable state
Unloading then loading the module causes a NULL ponter dereference.

The hda_unbind zeroes the hda_component, later the hda_bind tries
to dereference the codec field.

The hda_component is only initialized once by tas2781_generic_fixup.

Set only previously modified fields to NULL.

BUG: kernel NULL pointer dereference, address: 0000000000000322
Call Trace:
 <TASK>
 ? __die+0x23/0x70
 ? page_fault_oops+0x171/0x4e0
 ? exc_page_fault+0x7f/0x180
 ? asm_exc_page_fault+0x26/0x30
 ? tas2781_hda_bind+0x59/0x140 [snd_hda_scodec_tas2781_i2c]
 component_bind_all+0xf3/0x240
 try_to_bring_up_aggregate_device+0x1c3/0x270
 __component_add+0xbc/0x1a0
 tas2781_hda_i2c_probe+0x289/0x3a0 [snd_hda_scodec_tas2781_i2c]
 i2c_device_probe+0x136/0x2e0

Fixes: 5be27f1e3e ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Cc: stable@vger.kernel.org
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/8b8ed2bd5f75fbb32e354a3226c2f966fa85b46b.1702156522.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-10 10:06:31 +01:00
Hartmut Knaack
9b726bf6ae ALSA: hda/realtek: Apply mute LED quirk for HP15-db
The HP laptop 15-db0403ng uses the ALC236 codec and controls the mute
LED using COEF 0x07 index 1.
Sound card subsystem: Hewlett-Packard Company Device [103c:84ae]

Use the existing quirk for this model.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/e61815d0-f1c7-b164-e49d-6ca84771476a@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-10 10:05:04 +01:00
Kai Vehmanen
924f5ca297 ALSA: hda/hdmi: add force-connect quirks for ASUSTeK Z170 variants
On ASUSTeK Z170M PLUS and Z170 PRO GAMING systems, the display codec
pins are not registered properly without the force-connect quirk. The
codec will report only one pin as having external connectivity, but i915
finds all three connectors on the system, so the two drivers are not
in sync.

Issue found with DRM igt-gpu-tools test kms_hdmi_inject@inject-audio.

Link: https://gitlab.freedesktop.org/drm/intel/-/issues/9801
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Jani Saarinen <jani.saarinen@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231208132127.2438067-3-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-10 10:04:54 +01:00
Kai Vehmanen
3b1ff57e24 ALSA: hda/hdmi: add force-connect quirk for NUC5CPYB
Add one more older NUC model that requires quirk to force all pins to be
connected. The display codec pins are not registered properly without
the force-connect quirk. The codec will report only one pin as having
external connectivity, but i915 finds all three connectors on the
system, so the two drivers are not in sync.

Issue found with DRM igt-gpu-tools test kms_hdmi_inject@inject-audio.

Link: https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/3
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Jani Saarinen <jani.saarinen@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231208132127.2438067-2-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-10 10:04:35 +01:00
Mark Brown
88a50c1663
spi: Add support for stacked/parallel memories
Merge series from Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>:

This patch series adds support to the SPI framework for using multiple
chip selects.
2023-12-07 20:20:35 +00:00
Takashi Iwai
634e5e1e06 ALSA: hda/realtek: Add quirk for Lenovo Yoga Pro 7
Lenovo Yoga Pro 7 14APH8 (PCI SSID 17aa:3882) seems requiring the
similar workaround like Yoga 9 model for the bass speaker.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/CAGGk=CRRQ1L9p771HsXTN_ebZP41Qj+3gw35Gezurn+nokRewg@mail.gmail.com
Link: https://lore.kernel.org/r/20231207182035.30248-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-07 19:21:08 +01:00
Amit Kumar Mahapatra
f05e2f61fe
ALSA: hda/cs35l56: Use set/get APIs to access spi->chip_select
In preparation for adding multiple CS support for a device, set/get
functions were introduces accessing spi->chip_select in
'commit 303feb3cc0 ("spi: Add APIs in spi core to set/get
spi->chip_select and spi->cs_gpiod")'.
Replace spi->chip_select with spi_get_chipselect() API.

Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
Link: https://lore.kernel.org/r/20231125092137.2948-3-amit.kumar-mahapatra@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-07 16:23:19 +00:00
Pierre-Louis Bossart
a31014ebad ALSA: hda: Intel: add HDA_ARL PCI ID support
Yet another PCI ID.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231204212710.185976-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-07 09:28:57 +01:00
Mario Limonciello
8804fa04a4 ALSA: hda/realtek: Add Framework laptop 16 to quirks
The Framework 16" laptop has the same controller as other Framework
models.  Apply the presence detection quirk.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231206193927.2996-1-mario.limonciello@amd.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-07 08:00:42 +01:00
Tim Bosse
33038efb64 ALSA: hda/realtek: add new Framework laptop to quirks
The Framework Laptop 13 (AMD Ryzen 7040Series) has an ALC295 with
a disconnected or faulty headset mic presence detect similar to the
previous models.  It works with the same quirk chain as
309d7363ca.  This model has a VID:PID
of f111:0006.

Signed-off-by: Tim Bosse <flinn@timbos.se>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231206142629.388615-1-flinn@timbos.se
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-06 15:31:03 +01:00
Bin Li
6f7e4664e5 ALSA: hda/realtek: Enable headset on Lenovo M90 Gen5
Lenovo M90 Gen5 is equipped with ALC897, and it needs
ALC897_FIXUP_HEADSET_MIC_PIN quirk to make its headset mic work.

Signed-off-by: Bin Li <bin.li@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231204100450.642783-1-bin.li@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-04 15:23:53 +01:00
Aleksandrs Vinarskis
cd14dedf15 ALSA: hda/realtek: fix speakers on XPS 9530 (2023)
XPS 9530 has 2 tweeters and 2 subwoofers powered by CS35L41 amplifier, SPI
connected. For subwoofers to work, it requires both to enable amplifier
support, and to enable output to subwoofers via 0x17 quirk (similalry to
XPS 9510/9520).

Signed-off-by: Aleksandrs Vinarskis <alex.vinarskis@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231203233006.100558-1-alex.vinarskis@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-04 15:23:07 +01:00
Pascal Noël
c5c325bb58 ALSA: hda/realtek: Apply quirk for ASUS UM3504DA
The ASUS UM3504DA uses a Realtek HDA codec and two CS35L41 amplifiers via I2C.
Apply existing quirk to model.

Signed-off-by: Pascal Noël <pascal@pascalcompiles.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231202013744.12369-1-pascal@pascalcompiles.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-03 10:04:46 +01:00
Takashi Iwai
a337c35571 ALSA: hda: Disable power-save on KONTRON SinglePC
It's been reported that the runtime PM on KONTRON SinglePC (PCI SSID
1734:1232) caused a stall of playback after a bunch of invocations.
(FWIW, this looks like an timing issue, and the stall happens rather
on the controller side.)

As a workaround, disable the default power-save on this platform.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231130151321.9813-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-30 16:14:21 +01:00
Kailang Yang
cae2bdb579 ALSA: hda/realtek: Add supported ALC257 for ChromeOS
ChromeOS want to support ALC257.
Add codec ID to some relation function.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/99a88a7dbdb045fd9d934abeb6cec15f@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-29 09:31:30 +01:00
Kailang Yang
baaacbff64 ALSA: hda/realtek: Headset Mic VREF to 100%
This platform need to set Mic VREF to 100%.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/0916af40f08a4348a3298a9a59e6967e@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-28 08:52:18 +01:00
Cezary Rojewski
0d41f0c07f ALSA: hda/ca0132: Switch to new stream-format interface
To provide option for selecting different bit-per-sample than just the
maximum one, use the new format calculation mechanism.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20231117120610.1755254-8-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-27 17:28:06 +01:00
Cezary Rojewski
67ea58daab ALSA: hda/hdmi: Switch to new stream-format interface
To provide option for selecting different bit-per-sample than just the
maximum one, use the new format calculation mechanism.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20231117120610.1755254-7-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-27 17:27:56 +01:00
Cezary Rojewski
61b52df4b6 ALSA: hda: Switch to new stream-format interface
To provide option for selecting different bit-per-sample than just the
maximum one, use the new format calculation mechanism.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20231117120610.1755254-6-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-27 17:27:49 +01:00
Cezary Rojewski
a7fc8b862f ALSA: hda: Honor subformat when querying PCMs
Update mechanism for querying supported PCMs to allow for granular
format selection when container size is 32 bits. Currently always the
highest bit depth is selected, regardless of how many actual formats
codec in question supports.

Acked-by: Mark Brown <broonie@kernel.org>
Co-developed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20231117120610.1755254-3-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-27 17:24:27 +01:00
Richard Fitzgerald
732c678eb0 ALSA: hda: cs35l56: Enable low-power hibernation mode on SPI
SPI hibernation is now supported with the latest hibernation/wake
sequences in the shared ASoC code.

This has a functional dependency on two commits:

commit 3df761bdbc ("ASoC: cs35l56: Wake transactions need to be issued
twice")

commit a47cf4dac7 ("ASoC: cs35l56: Change hibernate sequence to use
allow auto hibernate")

To protect against this, enabling hibernation is conditional on
CS35L56_WAKE_HOLD_TIME_US being defined, which indicates that the new
hibernation sequences are available.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231121154419.19435-1-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-22 14:39:42 +01:00
Stefan Binding
d04ce4113c ALSA: cs35l41: Fix for old systems which do not support command
Some older laptops using cs35l41 use firmware which does not support
the CSPL_MBOX_CMD_SPK_OUT_ENABLE command.
Firmware versions v0.28.0 and older do not support this command.

Fixes: fa3efcc36a ("ALSA: cs35l41: Use mbox command to enable speaker output for external boost")
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231117163609.823627-3-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-20 12:37:01 +01:00
Stefan Binding
37f67abe08 ALSA: hda: cs35l41: Remove unnecessary boolean state variable firmware_running
This state duplicates the running state inside cs_dsp, so is not necessary.
Remove it, and use cs_dsp.running instead.
This brings the CS35L41 HDA driver more inline with its ASoC version,
allowing the same state to be used when calling library functions.

Fixes: fa3efcc36a ("ALSA: cs35l41: Use mbox command to enable speaker output for external boost")
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231117163609.823627-2-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-20 12:36:37 +01:00
Vasiliy Kovalev
7c9caa2993 ALSA: hda - Fix speaker and headset mic pin config for CHUWI CoreBook XPro
This patch corrected the speaker and headset mic pin config to the more
appropriate values.

Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
Link: https://lore.kernel.org/r/20231117170923.106822-1-kovalev@altlinux.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-20 12:35:30 +01:00
Linus Torvalds
eb9a643c17 sound fixes for 6.7-rc2
A collection of small fixes: including a regression fix in RC1
 wrt HD-audio / i915 component binding, while the rest are HD-audio
 device-speific fixes / quirks.
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAmVVFa0OHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE8mmhAAsQnKT9yf84OnPsDHbqfn2AzMuBoHLa7RGU6C
 xKMkRj19cxVeQ6pBoB21S8EIgo7oTIK7ca7Ph0SsB+DDigocgWn6tYd0lUEzJ2Su
 TxrKi8xcyQ2ebQ5fmnusNYE3UwxV4uM/gD6qD9gucEiFQrfwF/rV9ozip5+a0fm8
 +NwVCa/PZiBgLgG71qULHFuU3BOQp7Z25dSBt8+/uPpZSHnvbwQEEnD4abJ5fx3s
 RaHI1BxQMDFlXysY4CHQBZVO56gg5pfHB3SqVpfDkMyLMXTgFoByBEJk7rvE+63m
 wCHwfJaGPtTEBXHDi/DphS1Ym1jqcWpmopXVjCYV1bckCpbvQIIRmgm216iS3zCG
 KeTpjfuNIe9YYNKtlOX1vSPOZc7FYd4mILHtPa/gmkbyN/7Y4cnRJ38bztkNLQkg
 g6lHkSKF6q98lmhYxnQVKkFeCoxbm2brAJ7CusPnSkuG4IzB+pvGKBao6yc8iz6q
 ODNCw7I/TCZXsRmTJFRpfYxzvnk66J908T2ODEv1Ur5UkbCdANusAjPIooobwNcQ
 DiJKRzPGTHsRbf4t2jiw6KbIIrZq8/RMWbjQxIltBAoEBJsI40TaRsudtPpg/oYA
 +WFji44UlXcbw3NUG5kn9IjdSX6adfWbzh9x4h+/GF5/Gs4d9vAEkm72qnQrTJmJ
 AsNFsvQ=
 =JybD
 -----END PGP SIGNATURE-----

Merge tag 'sound-6.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "A collection of small fixes: including a regression fix in RC1 wrt
  HD-audio / i915 component binding, while the rest are HD-audio
  device-speific fixes / quirks"

* tag 'sound-6.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda/realtek: Add quirks for HP Laptops
  ALSA: hda/realtek: Add quirks for ASUS 2024 Zenbooks
  ALSA: hda: i915: Alays handle -EPROBE_DEFER
  ALSA: hda/realtek: Enable Mute LED on HP 255 G10
  ALSA: hda: cs35l56: Enable low-power hibernation mode on i2c
  ALSA: hda/realtek - Enable internal speaker of ASUS K6500ZC
  ALSA: hda/realtek: Enable Mute LED on HP 255 G8
  ALSA: hda/realtek - Add Dell ALC295 to pin fall back table
2023-11-17 09:05:31 -05:00
Stefan Binding
5d639b6097 ALSA: hda/realtek: Add quirks for HP Laptops
These HP laptops use Realtek HDA codec combined with 2 or 4 CS35L41
Amplifiers using SPI with Internal Boost.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231115162116.494968-3-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-15 20:00:44 +01:00
Stefan Binding
61cbc08fdb ALSA: hda/realtek: Add quirks for ASUS 2024 Zenbooks
These ASUS Zenbook laptops use Realtek HDA codec combined with
2xCS35L41 Amplifiers using SPI or I2C with External Boost or
Internal Boost.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231115162116.494968-2-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-15 20:00:17 +01:00
Maarten Lankhorst
9e88b49315 ALSA: hda: i915: Alays handle -EPROBE_DEFER
It turns out that even if the comment says that the driver can load
fine, it's not really the case and no codecs are detected.
Specifically for -EPROBE_DEFER, always fail the probe.

This fixes a regression when HDA-intel is loaded before i915.

Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Closes: https://lore.kernel.org/r/ZVNUxZzCGcxQzqJX@intel.com
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Tested-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Fixes: e6d0c13e9f ("ALSA: hda: i915: Remove extra argument from snd_hdac_i915_init")
Link: https://gitlab.freedesktop.org/drm/intel/-/issues/9671
Link: https://lore.kernel.org/r/20231115123625.74286-1-maarten.lankhorst@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-15 13:42:31 +01:00
Matus Malych
b944aa9d86 ALSA: hda/realtek: Enable Mute LED on HP 255 G10
HP 255 G10 has a mute LED that can be made to work using quirk
ALC236_FIXUP_HP_MUTE_LED_COEFBIT2.
Enable already existing quirk - at correct line to keep order

Signed-off-by: Matus Malych <matus@malych.org>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231114133524.11340-1-matus@malych.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-14 17:48:04 +01:00
Simon Trimmer
d02ef87db9 ALSA: hda: cs35l56: Enable low-power hibernation mode on i2c
This can now be re-enabled as the sequence to reliably wake the device
has been implemented in the shared ASoC code.

This has a functional dependency on commit 3df761bdbc
("ASoC: cs35l56: Wake transactions need to be issued twice")

To protect against this, enabling hibernation is conditional on
CS35L56_WAKE_HOLD_TIME_US being defined, which indicates that the new
hibernation sequences are available.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231113164029.1156669-1-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-13 17:44:30 +01:00
Chandradeep Dey
713f040cd2 ALSA: hda/realtek - Enable internal speaker of ASUS K6500ZC
Apply the already existing quirk chain ALC294_FIXUP_ASUS_SPK to enable
the internal speaker of ASUS K6500ZC.

Signed-off-by: Chandradeep Dey <codesigning@chandradeepdey.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/NizcVHQ--3-9@chandradeepdey.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-12 09:36:38 +01:00
Linus Torvalds
e1d809b3c5 sound fixes for 6.7-rc1
A collection of fixes for RC1.  Majority of changes are various
 ASoC driver-specific small fixes and usual HD-audio quirks, while
 there are a couple of core changes: a fix in ALSA core procfs code
 to avoid deadlocks at disconnection and an ASoC core fix for DAPM
 clock widgets.
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAmVN9RwOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE9N6g/+OVspRs0DYTuUR4jjPKI9KKyhbRaWLHh2BWDw
 CFEsvSMt38YqP9WXWXsioE01dw5++gdSiqrrID9Gk6ivwMjg8U3EGXaQxW4Z5MQJ
 CNWaHZxTVlHNjj/mMpxsk/6c4/evHvuuAPp1k6rSnmPtzcu4nfwffyxEJggjFJmW
 c8nPWYkXy1xnGpLVfb8D2FJYLacYQypyVn4vMSj/EU4jGXrz1mTJm7RcVJhCOuDq
 wf+JmytYde+2WJwM7ILar9spB3C6+7S5cnttBlFA/t6ZsftI5HLlFMElXjFPugas
 3j//GxJw4mjeEf4tfgd4U3AhQVcE0Jhc0t89VGeHs2vPrgXXKOe/Jdloq1OFLEnc
 nG3VLEP0R5FUQEsbsEwGYXFqUBoOx6IeoKhksDnVPP1LiMS9Igu6rr8IbAYA6spl
 wpGggpTULJ11fv9uGk8MA2I6V/AxJ8JhE1W0K7G9NZ0Z6hctYvP9Kr5ntnHCrJZa
 K3rDzfKtAnH1FsKXa6ehRgvfTPRXCznGlNby7KQlwycL18OOzlPCLPuboe4IMT8T
 SjfQt3sPhWI3+vdoo3qNoHG6l2Wt9bDO3FzGG9KxVqf0LU3vuLyWWry0uPUljAZq
 8fs0vkOwrtobMgeqr38obIQJCHMaeYPHb23/kd1v7D8/oZrY4im/Y4N0+4XRGmsy
 hmaNt4Q=
 =6iW2
 -----END PGP SIGNATURE-----

Merge tag 'sound-fix-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "A collection of fixes for rc1.

  The majority of changes are various ASoC driver-specific small fixes
  and usual HD-audio quirks, while there are a couple of core changes: a
  fix in ALSA core procfs code to avoid deadlocks at disconnection and
  an ASoC core fix for DAPM clock widgets"

* tag 'sound-fix-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  OSS: dmasound/paula: Convert to platform remove callback returning void
  ALSA: hda: ASUS UM5302LA: Added quirks for cs35L41/10431A83 on i2c bus
  ALSA: info: Fix potential deadlock at disconnection
  ASoC: nau8540: Add self recovery to improve capture quility
  ALSA: hda/realtek: Add support dual speaker for Dell
  ALSA: hda: Add ASRock X670E Taichi to denylist
  ALSA: hda/realtek: Add quirk for ASUS UX7602ZM
  ASoC: SOF: sof-client: trivial: fix comment typo
  ASoC: dapm: fix clock get name
  ASoC: hdmi-codec: register hpd callback on component probe
  ASoC: mediatek: mt8186_mt6366_rt1019_rt5682s: trivial: fix error messages
  ASoC: da7219: Improve system suspend and resume handling
  ASoC: codecs: Modify macro value error
  ASoC: codecs: Modify the wrong judgment of re value
  ASoC: codecs: Modify the maximum value of calib
  ASoC: amd: acp: fix for i2s mode register field update
  ASoC: codecs: aw88399: Fix -Wuninitialized in aw_dev_set_vcalb()
  ASoC: rt712-sdca: fix speaker route missing issue
  ASoC: rockchip: Fix unused rockchip_i2s_tdm_match warning for !CONFIG_OF
  ASoC: ti: omap-mcbsp: Fix runtime PM underflow warnings
2023-11-10 11:57:51 -08:00
Eymen Yigit
8384c0baf2 ALSA: hda/realtek: Enable Mute LED on HP 255 G8
This HP Notebook uses ALC236 codec with COEF 0x07 idx 1 controlling
the mute LED. Enable already existing quirk for this device.

Signed-off-by: Eymen Yigit <eymenyg01@gmail.com>
Cc: Luka Guzenko <l.guzenko@web.de>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231110150715.5141-1-eymenyg01@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-10 17:37:37 +01:00
Kailang Yang
4b21a669ca ALSA: hda/realtek - Add Dell ALC295 to pin fall back table
Add ALC295 to pin fall back table.
Remove 5 pin quirks for Dell ALC295.
ALC295 was only support MIC2 for external MIC function.
ALC295 assigned model "ALC269_FIXUP_DELL1_MIC_NO_PRESENCE" for pin
fall back table.
It was assigned wrong model. So, let's remove it.

Fixes: fbc571290d ("ALSA: hda/realtek - Fixed Headphone Mic can't record on Dell platform")
Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/7c1998e873834df98d59bd7e0d08c72e@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-10 17:36:01 +01:00
Vitalii Torshyn
6ae90e906a ALSA: hda: ASUS UM5302LA: Added quirks for cs35L41/10431A83 on i2c bus
Proposed patch fixes initialization of CSC3551 on the UM5302LA laptop.
Patching DSDT table is not required since ASUS did added _DSD entry.
Nothing new introduced but reused work started by Stefan B.

Currently there is no official firmware available for 10431A83 on
cirrus git unfortunately.
For testing used 104317f3 (which is also seems on i2c bus):

$ cd /lib/firmware/cirrus/ && \
for fw in $(find ./ -name '*104317f3*'); do newfw=$(echo $fw | sed 's/104317f3/10431a83/g'); echo echo "$fw -> $newfw"; ln -s $f $newfw; done

With the patch applied to 6.6.0 and obviously symlinks to 104317F3 FW,
speakers works and to my susrprise they sound quite good and loud
without distortion.

Probably confirmation from cirrus team is needed on firmware.

Signed-off-by: Vitalii Torshyn <vitaly.torshyn@gmail.com>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=218119
Link: https://lore.kernel.org/r/CAHiQ-bCMPpCJ8eOYAaVVoqGkFixS1qTgSS4xfbZvL4oZV9LYew@mail.gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-09 16:19:45 +01:00
Kailang Yang
f0d9da19d7 ALSA: hda/realtek: Add support dual speaker for Dell
Dell new platform support dual speaker. But BIOS verb table only show one speaker.
It will fill verb table for second speaker. Then bind with CS AMP model.

Fixes: de90f5165b ("ALSA: hda/realtek: Add support for DELL Oasis 13/14/16 laptops")
Signed-off-by: Kailang Yang <kailang@realtek.com>
Link: https://lore.kernel.org/r/4dd390a77bf742b8a518ac2deee00b0f@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-08 09:45:33 +01:00
Alexander Koskovich
df42ee7e22 ALSA: hda: Add ASRock X670E Taichi to denylist
Recent AMD platforms expose an HD-audio bus but without any actual
codecs, which is internally tied with a USB-audio device, supposedly.
It results in "no codecs" error of HD-audio bus driver, and it's
nothing but a waste of resources.

snd_hda_intel 0000:59:00.6: no codecs found!

Signed-off-by: Alexander Koskovich <akoskovich@pm.me>
Link: https://lore.kernel.org/r/20231105152834.5620-1-akoskovich@pm.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-07 15:09:38 +01:00
Alex Spataru
26fd31ef9c ALSA: hda/realtek: Add quirk for ASUS UX7602ZM
Enables the SPI-connected CSC35L41 audio amplifier for this
laptop model.

As of BIOS version 303 it's still necessary to
modify the ACPI table to add the related _DSD properties:
https://github.com/alex-spataru/asus_zenbook_ux7602zm_sound/

Signed-off-by: Alex Spataru <alex_spataru@outlook.com>
Link: https://lore.kernel.org/r/DS7PR07MB7621BB5BB14F5473D181624CE3A4A@DS7PR07MB7621.namprd07.prod.outlook.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-07 15:08:31 +01:00
Linus Torvalds
8f6f76a6a2 As usual, lots of singleton and doubleton patches all over the tree and
there's little I can say which isn't in the individual changelogs.
 
 The lengthier patch series are
 
 - "kdump: use generic functions to simplify crashkernel reservation in
   arch", from Baoquan He.  This is mainly cleanups and consolidation of
   the "crashkernel=" kernel parameter handling.
 
 - After much discussion, David Laight's "minmax: Relax type checks in
   min() and max()" is here.  Hopefully reduces some typecasting and the
   use of min_t() and max_t().
 
 - A group of patches from Oleg Nesterov which clean up and slightly fix
   our handling of reads from /proc/PID/task/...  and which remove
   task_struct.therad_group.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCZUQP9wAKCRDdBJ7gKXxA
 jmOAAQDh8sxagQYocoVsSm28ICqXFeaY9Co1jzBIDdNesAvYVwD/c2DHRqJHEiS4
 63BNcG3+hM9nwGJHb5lyh5m79nBMRg0=
 =On4u
 -----END PGP SIGNATURE-----

Merge tag 'mm-nonmm-stable-2023-11-02-14-08' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull non-MM updates from Andrew Morton:
 "As usual, lots of singleton and doubleton patches all over the tree
  and there's little I can say which isn't in the individual changelogs.

  The lengthier patch series are

   - 'kdump: use generic functions to simplify crashkernel reservation
     in arch', from Baoquan He. This is mainly cleanups and
     consolidation of the 'crashkernel=' kernel parameter handling

   - After much discussion, David Laight's 'minmax: Relax type checks in
     min() and max()' is here. Hopefully reduces some typecasting and
     the use of min_t() and max_t()

   - A group of patches from Oleg Nesterov which clean up and slightly
     fix our handling of reads from /proc/PID/task/... and which remove
     task_struct.thread_group"

* tag 'mm-nonmm-stable-2023-11-02-14-08' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (64 commits)
  scripts/gdb/vmalloc: disable on no-MMU
  scripts/gdb: fix usage of MOD_TEXT not defined when CONFIG_MODULES=n
  .mailmap: add address mapping for Tomeu Vizoso
  mailmap: update email address for Claudiu Beznea
  tools/testing/selftests/mm/run_vmtests.sh: lower the ptrace permissions
  .mailmap: map Benjamin Poirier's address
  scripts/gdb: add lx_current support for riscv
  ocfs2: fix a spelling typo in comment
  proc: test ProtectionKey in proc-empty-vm test
  proc: fix proc-empty-vm test with vsyscall
  fs/proc/base.c: remove unneeded semicolon
  do_io_accounting: use sig->stats_lock
  do_io_accounting: use __for_each_thread()
  ocfs2: replace BUG_ON() at ocfs2_num_free_extents() with ocfs2_error()
  ocfs2: fix a typo in a comment
  scripts/show_delta: add __main__ judgement before main code
  treewide: mark stuff as __ro_after_init
  fs: ocfs2: check status values
  proc: test /proc/${pid}/statm
  compiler.h: move __is_constexpr() to compiler.h
  ...
2023-11-02 20:53:31 -10:00
Linus Torvalds
edd8e84ae9 sound updates for 6.7
Most of changes at this time are for ASoC, spread over ASoC core and
 drivers due to the API prefix standardization.  Other than that, there
 have little change wrt API, rather lots of driver-specific updates and
 fixes.  Some highlight below:
 
 ASoC:
 - Standardization of API prefix
 - GPIO API usage improvements
 - Support for HDA patches
 - Lots of work on SOF, including crash dump support
 - Fixes for noise when stopping some Sounwire CODECs
 - Support for AMD platforms with es83xx, AMD ACP 6.3 and 7.0, Awinc
   AT87390 and AW88399, many Intel platforms, many Mediatek platforms,
   Qualcomm SM6115 and SC7180 platforms, Richtek RTQ9128 and Texas
   Instruments TAS575x
 
 HD-audio and USB-audio:
 - Deferred probe support of audio component binding
 - More fixes and enhancements for Cirrus subcodecs
 - USB Scarlett2 mixer and McIntosh DSD quirk
 
 Others:
 - More enhancement of snd-aloop driver
 - Update MAINTAINERS entry for linux-sound mailing list
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAmVDqXcOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE+PbhAAsmiOxjXpCNVGbhy9tR+UB9p6gCIzFv5RQQIc
 0DzqnqssbJt86jtFMrv0VC6BNfnwcyBVzKxWinKz861xXiM9SRU5vTirUES3Cil/
 sZaQYC9ppTrZm3q2EGF4eGC349oZGzuLzk1EkEVPfNHiELwcO4R1NZbtgWKIc8LE
 bNz8RT3FyxHAv+5juW5suGs0Bq4Mwa9z+eM8xEPwxPL3gpIAb5EapIesHEgaa893
 w3jYwKRHCDq0ADtXIY9xI3ypqenfbeTge4nuBnw354sPRVdZInrRfCNkTJojb+tp
 5Pc2gpFmTUGy6T2wG6QP23VgeV14BJHrQD3Z1Wh2aQ8V+ARa92XvY1Xeg4vJ+NE0
 yhvlh028GjKrMIvhl7mmepV9mia2zA1TluqlzKEla3B5lIj0E1zvMA+vCzNAz3Ro
 lV2Q0dpJ3ENQ9ahGF/d37u3glrqXxISlG9uTGdY0UcF7U9Iyxb0jEnhQYl05b+zR
 Oaw/HApuvIUj4cdJWEYf0AnTTqeE8KSZ3wUlPPyuQAdAusCaQFMciWeO0EeLqEId
 KR/rbnSgVKS3zHLdNw5A67Sv36E9OG/E+EiJ6Tet15a69yq2Oyv4pwMMwbqsvBG5
 8kNbtBFGxOHnCrZgM6VV2/g3BP/IwyIFd5kkS2q13FXBTYRpY01dQDjHlmspasNK
 hYH69AA=
 =2/dI
 -----END PGP SIGNATURE-----

Merge tag 'sound-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound updates from Takashi Iwai:
 "Most of changes at this time are for ASoC, spread over ASoC core and
  drivers due to the API prefix standardization.

  Other than that, there have little change wrt API, rather lots of
  driver-specific updates and fixes.

  Some highlight below:

  ASoC:
   - Standardization of API prefix
   - GPIO API usage improvements
   - Support for HDA patches
   - Lots of work on SOF, including crash dump support
   - Fixes for noise when stopping some Sounwire CODECs
   - Support for AMD platforms with es83xx, AMD ACP 6.3 and 7.0, Awinc
     AT87390 and AW88399, many Intel platforms, many Mediatek platforms,
     Qualcomm SM6115 and SC7180 platforms, Richtek RTQ9128 and Texas
     Instruments TAS575x

  HD-audio and USB-audio:
   - Deferred probe support of audio component binding
   - More fixes and enhancements for Cirrus subcodecs
   - USB Scarlett2 mixer and McIntosh DSD quirk

  Others:
   - More enhancement of snd-aloop driver
   - Update MAINTAINERS entry for linux-sound mailing list"

* tag 'sound-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (485 commits)
  ALSA: hda: cs35l41: Fix missing error code in cs35l41_smart_amp()
  ALSA: hda: cs35l41: mark cs35l41_verify_id() static
  ASoC: codecs: wsa883x: make use of new mute_unmute_on_trigger flag
  ASoC: soc-dai: add flag to mute and unmute stream during trigger
  ASoC: ams-delta.c: use component after check
  ASoC: amd: acp: select SND_SOC_AMD_ACP_LEGACY_COMMON for ACP63
  ASoC: codecs: aw88399: fix typo in Kconfig select
  ASoC: amd: acp: add ACPI dependency
  ASoC: Intel: avs: Add rt5514 machine board
  ASoC: Intel: avs: Add rt5514 machine board
  ALSA: scarlett2: Add missing check with firmware version control
  ALSA: virtio: use ack callback
  ALSA: scarlett2: Remap Level Meter values
  ALSA: scarlett2: Allow passing any output to line_out_remap()
  ALSA: scarlett2: Add support for reading firmware version
  ALSA: scarlett2: Rename Gen 3 config sets
  ALSA: scarlett2: Rename scarlett_gen2 to scarlett2
  ASoC: cs35l41: Detect CSPL errors when sending CSPL commands
  ALSA: hda: cs35l41: Check CSPL state after loading firmware
  ALSA: hda: cs35l41: Do not unload firmware before reset in system suspend
  ...
2023-11-02 14:34:14 -10:00
Linus Torvalds
27beb3ca34 pci-v6.7-changes
-----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEEgMe7l+5h9hnxdsnuWYigwDrT+vwFAmVBaU8UHGJoZWxnYWFz
 QGdvb2dsZS5jb20ACgkQWYigwDrT+vwEdxAAo++s98+ZaaTdUuoV0Zpft1fuY6Yr
 mR80jUDxjHDbcI1G4iNVUSWG6pGIdlURnrBp5kU74FV9R2Ps3Fl49XQUHowE0HfH
 D/qmihiJQdnMsQKwzw3XGoTSINrDcF6nLafl9brBItVkgjNxfxSEbnweJMBf+Boc
 rpRXHzxbVHVjwwhBLODF2Wt/8sQ24w9c+wcQkpo7im8ZZReoigNMKgEa4J7tLlqA
 vTyPR/K6QeU8IBUk2ObCY3GeYrVuqi82eRK3Uwzu7IkQwA9orE416Okvq3Z026/h
 TUAivtrcygHaFRdGNvzspYLbc2hd2sEXF+KKKb6GNAjxuDWUhVQW4ObY4FgFkZ65
 Gqz/05D6c1dqTS3vTxp3nZYpvPEbNnO1RaGRL4h0/mbU+QSPSlHXWd9Lfg6noVVd
 3O+CcstQK8RzMiiWLeyctRPV5XIf7nGVQTJW5aCLajlHeJWcvygNpNG4N57j/hXQ
 gyEHrz3idXXHXkBKmyWZfre6YpLkxZtKyONZDHWI/AVhU0TgRdJWmqpRfC1kVVUe
 IUWBRcPUF4/r3jEu6t10N/aDWQN1uQzIsJNnCrKzAddPDTTYQJk8VVzKPo8SVxPD
 X+OjEMgBB/fXUfkJ7IMwgYnWaFJhxthrs6/3j1UqRvGYRoulE4NdWwJDky9UYIHd
 qV3dzuAxC/cpv08=
 =G//C
 -----END PGP SIGNATURE-----

Merge tag 'pci-v6.7-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci

Pull pci updates from Bjorn Helgaas:
 "Enumeration:

   - Use acpi_evaluate_dsm_typed() instead of open-coding _DSM
     evaluation to learn device characteristics (Andy Shevchenko)

   - Tidy multi-function header checks using new PCI_HEADER_TYPE_MASK
     definition (Ilpo Järvinen)

   - Simplify config access error checking in various drivers (Ilpo
     Järvinen)

   - Use pcie_capability_clear_word() (not
     pcie_capability_clear_and_set_word()) when only clearing (Ilpo
     Järvinen)

   - Add pci_get_base_class() to simplify finding devices using base
     class only (ignoring subclass and programming interface) (Sui
     Jingfeng)

   - Add pci_is_vga(), which includes ancient PCI_CLASS_NOT_DEFINED_VGA
     devices from before the Class Code was added to PCI (Sui Jingfeng)

   - Use pci_is_vga() for vgaarb, sysfs "boot_vga", virtio, qxl to
     include ancient VGA devices (Sui Jingfeng)

  Resource management:

   - Make pci_assign_unassigned_resources() non-init because sparc uses
     it after init (Randy Dunlap)

  Driver binding:

   - Retain .remove() and .probe() callbacks (previously __init) because
     sysfs may cause them to be called later (Uwe Kleine-König)

   - Prevent xHCI driver from claiming AMD VanGogh USB3 DRD device, so
     it can be claimed by dwc3 instead (Vicki Pfau)

  PCI device hotplug:

   - Add Ampere Altra Attention Indicator extension driver for acpiphp
     (D Scott Phillips)

  Power management:

   - Quirk VideoPropulsion Torrent QN16e with longer delay after reset
     (Lukas Wunner)

   - Prevent users from overriding drivers that say we shouldn't use
     D3cold (Lukas Wunner)

   - Avoid PME from D3hot/D3cold for AMD Rembrandt and Phoenix USB4
     because wakeup interrupts from those states don't work if amd-pmc
     has put the platform in a hardware sleep state (Mario Limonciello)

  IOMMU:

   - Disable ATS for Intel IPU E2000 devices with invalidation message
     endianness erratum (Bartosz Pawlowski)

  Error handling:

   - Factor out interrupt enable/disable into helpers (Kai-Heng Feng)

  Peer-to-peer DMA:

   - Fix flexible-array usage in struct pci_p2pdma_pagemap in case we
     ever use pagemaps with multiple entries (Gustavo A. R. Silva)

  ASPM:

   - Revert a change that broke when drivers disabled L1 and users later
     enabled an L1.x substate via sysfs, and fix a similar issue when
     users disabled L1 via sysfs (Heiner Kallweit)

  Endpoint framework:

   - Fix double free in __pci_epc_create() (Dan Carpenter)

   - Use IS_ERR_OR_NULL() to simplify endpoint core (Ruan Jinjie)

  Cadence PCIe controller driver:

   - Drop unused "is_rc" member (Li Chen)

  Freescale Layerscape PCIe controller driver:

   - Enable 64-bit addressing in endpoint mode (Guanhua Gao)

  Intel VMD host bridge driver:

   - Fix multi-function header check (Ilpo Järvinen)

  Microsoft Hyper-V host bridge driver:

   - Annotate struct hv_dr_state with __counted_by (Kees Cook)

  NVIDIA Tegra194 PCIe controller driver:

   - Drop setting of LNKCAP_MLW (max link width) since dw_pcie_setup()
     already does this via dw_pcie_link_set_max_link_width() (Yoshihiro
     Shimoda)

  Qualcomm PCIe controller driver:

   - Use PCIE_SPEED2MBS_ENC() to simplify encoding of link speed
     (Manivannan Sadhasivam)

   - Add a .write_dbi2() callback so DBI2 register writes, e.g., for
     setting the BAR size, work correctly (Manivannan Sadhasivam)

   - Enable ASPM for platforms that use 1.9.0 ops, because the PCI core
     doesn't enable ASPM states that haven't been enabled by the
     firmware (Manivannan Sadhasivam)

  Renesas R-Car Gen4 PCIe controller driver:

   - Add DesignWare core support (set max link width, EDMA_UNROLL flag,
     .pre_init(), .deinit(), etc) for use by R-Car Gen4 driver
     (Yoshihiro Shimoda)

   - Add driver and DT schema for DesignWare-based Renesas R-Car Gen4
     controller in both host and endpoint mode (Yoshihiro Shimoda)

  Xilinx NWL PCIe controller driver:

   - Update ECAM size to support 256 buses (Thippeswamy Havalige)

   - Stop setting bridge primary/secondary/subordinate bus numbers,
     since PCI core does this (Thippeswamy Havalige)

  Xilinx XDMA controller driver:

   - Add driver and DT schema for Zynq UltraScale+ MPSoCs devices with
     Xilinx XDMA Soft IP (Thippeswamy Havalige)

  Miscellaneous:

   - Use FIELD_GET()/FIELD_PREP() to simplify and reduce use of _SHIFT
     macros (Ilpo Järvinen, Bjorn Helgaas)

   - Remove logic_outb(), _outw(), outl() duplicate declarations (John
     Sanpe)

   - Replace unnecessary UTF-8 in Kconfig help text because menuconfig
     doesn't render it correctly (Liu Song)"

* tag 'pci-v6.7-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci: (102 commits)
  PCI: qcom-ep: Add dedicated callback for writing to DBI2 registers
  PCI: Simplify pcie_capability_clear_and_set_word() to ..._clear_word()
  PCI: endpoint: Fix double free in __pci_epc_create()
  PCI: xilinx-xdma: Add Xilinx XDMA Root Port driver
  dt-bindings: PCI: xilinx-xdma: Add schemas for Xilinx XDMA PCIe Root Port Bridge
  PCI: xilinx-cpm: Move IRQ definitions to a common header
  PCI: xilinx-nwl: Modify ECAM size to enable support for 256 buses
  PCI: xilinx-nwl: Rename the NWL_ECAM_VALUE_DEFAULT macro
  dt-bindings: PCI: xilinx-nwl: Modify ECAM size in the DT example
  PCI: xilinx-nwl: Remove redundant code that sets Type 1 header fields
  PCI: hotplug: Add Ampere Altra Attention Indicator extension driver
  PCI/AER: Factor out interrupt toggling into helpers
  PCI: acpiphp: Allow built-in drivers for Attention Indicators
  PCI/portdrv: Use FIELD_GET()
  PCI/VC: Use FIELD_GET()
  PCI/PTM: Use FIELD_GET()
  PCI/PME: Use FIELD_GET()
  PCI/ATS: Use FIELD_GET()
  PCI/ATS: Show PASID Capability register width in bitmasks
  PCI/ASPM: Fix L1 substate handling in aspm_attr_store_common()
  ...
2023-11-02 14:05:18 -10:00
Harshit Mogalapalli
dc6e08b1a2 ALSA: hda: cs35l41: Fix missing error code in cs35l41_smart_amp()
When firmware status is invalid, assign -EINVAL to ret as ret is '0' at
that point and returning success is incorrect when firmware status is
invalid.

Fixes: a51d8ba03a ("ALSA: hda: cs35l41: Check CSPL state after loading firmware")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Link: https://lore.kernel.org/r/20231030070836.3234385-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-31 18:30:16 +01:00
Arnd Bergmann
f71e0be5d2 ALSA: hda: cs35l41: mark cs35l41_verify_id() static
The newly introduced function is global but only called in this one
file and has no extern prototype, so it should probably be static:

sound/pci/hda/cs35l41_hda.c:733:5: error: no previous prototype for 'cs35l41_verify_id' [-Werror=missing-prototypes]
  733 | int cs35l41_verify_id(struct cs35l41_hda *cs35l41, unsigned int *regid, unsigned int *reg_revid)

Fixes: 881b7bce0c ("ALSA: hda: cs35l41: Run boot process during resume callbacks")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20231027152515.482411-1-arnd@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-29 08:29:29 +01:00
Stefan Binding
a51d8ba03a ALSA: hda: cs35l41: Check CSPL state after loading firmware
CSPL firmware should be in RUNNING or PAUSED state after loading.
If not, the firmware has not been loaded correctly, and we can unload
it and pass the error up.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231026150558.2105827-8-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 17:55:22 +02:00
Stefan Binding
33790d1f03 ALSA: hda: cs35l41: Do not unload firmware before reset in system suspend
Given the part is about to reset due to system suspend, and we are
already in hibernate, there is no need to wake up the amp, just to get
it ready to be reset. We just need to ensure cs_dsp is ready for reset
by resetting the states.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231026150558.2105827-7-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 17:55:21 +02:00
Stefan Binding
2ee06ff5d7 ALSA: hda: cs35l41: Force a software reset after hardware reset
To ensure the chip has correctly reset during probe and system suspend,
we need to force a software reset, in case of systems where the
hardware reset is not available.

The software reset register was labelled as volatile but not readable,
however, it is readable, (just returns 0x0). Adding it to readable
registers means it will be correctly treated as volatile, and thus
will not be cached.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231026150558.2105827-6-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 17:55:20 +02:00
Stefan Binding
881b7bce0c ALSA: hda: cs35l41: Run boot process during resume callbacks
During initial probe, after reset is asserted for the first time, the
driver goes through a boot process to ensure the amp is ready to be
used. This involves verifying a boot flag, as well as verifying the
chip ids.

This is necessary since it is possible for the amp to have been fully
reset by the system suspend calls.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231026150558.2105827-5-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 17:55:19 +02:00
Stefan Binding
fff393db71 ALSA: hda: cs35l41: Assert Reset prior to de-asserting in probe and system resume
To ensure we are in a known state, exiting from reset at the point of
probe or in system resume, assert reset before we de-assert it.

Since the BIOS may enter into a pre-boot environment to control the
amps (for example for boot beep), we need to ensure we start from a
known, reset state prior to probe or system resume.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231026150558.2105827-4-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 17:55:19 +02:00
Stefan Binding
a7423e9019 ALSA: hda: cs35l41: Assert reset before system suspend
Some system suspend modes may remove power supplies.
To ensure we are not running during this time, we should assert reset.

Note: since the amps use a shared reset, asserting reset prior to
system suspend only works if the amps are suspended in the reverse
order to probe.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231026150558.2105827-3-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 17:55:18 +02:00
Stefan Binding
f01b371b07 ALSA: hda: cs35l41: Use reset label to get GPIO for HP Zbook Fury 17 G9
This laptop has an incorrect setting in its _DSD for boost type, but
the rest of the _DSD is correct, and we can still use the reset label
to obtain the reset gpio.

Also fix channel map so that amp 0 is right, and amp 1 is left.

Fixes: 581523ee36 ("ALSA: hda: cs35l41: Override the _DSD for HP Zbook Fury 17 G9 to correct boost type")

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231026150558.2105827-2-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 17:55:17 +02:00
Takashi Iwai
e244953ef6 ALSA: mixart: Replace with __packed attribute
Replace the old __attribute__((packed)) with the new __packed.
Only cleanup, no functional changes.

Link: https://lore.kernel.org/r/20231025132314.5878-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 09:43:03 +02:00
Takashi Iwai
afcd82afd2 ALSA: azt3328: Replace with __packed attribute
Replace the old __attribute__((packed)) with the new __packed.
Only cleanup, no functional changes.

Link: https://lore.kernel.org/r/20231025132314.5878-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 09:42:59 +02:00
Takashi Iwai
39cd06e3f7 ASoC: Updates for v6.7
This is quite a large set of changes but mostly due to API cleanups and
 in driver specific ways rather than due to anything subsystem wide.
 Highlights include:
 
  - Standardisation of API prefixes on snd_soc_, removing asoc_.
  - GPIO API usage improvements.
  - Support for HDA patches.
  - Lots of work on SOF, including crash dump support.
  - Support for AMD platforms with es83xx, Awinc AT87390, many Intel
    platforms, many Mediatek platforms, Qualcomm SM6115,  Richtek RTQ9128
    and Texas Instruments TAS575x.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmUy6X8ACgkQJNaLcl1U
 h9Cv7Qf+PO4ucl/rFITWAp2Ta9fw7Z5J6UCiXiR54TPgAiLJrpKSi3rbYTXjO90Y
 1NNOdoMKr109zdOpdSZI7EX0GgWQbGbdB40nxESdTcojAloRH0jt4RaF7G7B7+86
 b8PGlVPLLV/4zFf9f2gpEKPcKhRRRKYOBIEB+amfjWpdXVrqPD3zS/S16Q3Hn4Gy
 Fx9b9X/lVDG9uqJomHpunEdViZjkm5CCNzdyAhHH99afiqSe//pevx6/FpzAHyng
 AZgE9Yfq4Xw4pdzDdGVfYC+L1GZiHIDRzsusz6aPA5nrMhSn0ru8PMGtmQQTzyhb
 PLYw0OW8cWymfqwal8wrNGJfSZ8IGA==
 =lN5P
 -----END PGP SIGNATURE-----

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

ASoC: Updates for v6.7

This is quite a large set of changes but mostly due to API cleanups and
in driver specific ways rather than due to anything subsystem wide.
Highlights include:

 - Standardisation of API prefixes on snd_soc_, removing asoc_.
 - GPIO API usage improvements.
 - Support for HDA patches.
 - Lots of work on SOF, including crash dump support.
 - Support for AMD platforms with es83xx, Awinc AT87390, many Intel
   platforms, many Mediatek platforms, Qualcomm SM6115,  Richtek RTQ9128
   and Texas Instruments TAS575x.

[ the merge conflicts around SOF Intel HD-audio and CS35L41 subcodec
  drivers are resolved here -- tiwai ]
2023-10-21 09:49:15 +02:00
Maarten Lankhorst
e6d0c13e9f ALSA: hda: i915: Remove extra argument from snd_hdac_i915_init
Now that all drivers have moved from modprobe loading to
handling -EPROBE_DEFER, we can remove the argument again.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20231009115437.99976-14-maarten.lankhorst@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-19 14:56:25 +02:00
Maarten Lankhorst
65cbbfa4e2 ALSA: hda: Intel: Move snd_hdac_i915_init to before probe_work.
Now that we can use -EPROBE_DEFER, it's no longer required to spin off
the snd_hdac_i915_init into a workqueue.

Use the -EPROBE_DEFER mechanism instead, which must be returned in the
probe function.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20231009115437.99976-11-maarten.lankhorst@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-19 14:55:54 +02:00
Maarten Lankhorst
32f4e921fe ALSA: hda: i915: Add an allow_modprobe argument to snd_hdac_i915_init
Xe is a new GPU driver that re-uses the display (and sound) code from
i915. It's no longer possible to load i915, as the GPU can be driven
by the xe driver instead.

The new behavior will return -EPROBE_DEFER, and wait for a compatible
driver to be loaded instead of modprobing i915.

Converting all drivers at the same time is a lot of work, instead we
will convert each user one by one.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20231009115437.99976-8-maarten.lankhorst@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-19 14:55:27 +02:00
Maarten Lankhorst
ad6413bc48 ALSA: hda: Intel: Fix error handling in azx_probe()
Add missing pci_set_drv to NULL call on error.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20231009115437.99976-6-maarten.lankhorst@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-19 14:54:57 +02:00
Takashi Iwai
87543ce503 Merge branch 'for-linus' into for-next
For applying HD-audio EPROBE_DEFER series cleanly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-19 14:51:12 +02:00
Alexey Dobriyan
5097a69d67 extract and use FILE_LINE macro
Extract nifty FILE_LINE useful for printk style debugging:

	printk("%s\n", FILE_LINE);

It should not be used en mass probably because __FILE__ string literals
can be merged while FILE_LINE's won't. But for debugging it is what
the doctor ordered.

Don't add leading and trailing underscores, they're painful to type. 
Trust me, I've tried both versions.

Link: https://lkml.kernel.org/r/ebf12ac4-5a61-4b12-b8b0-1253eb371332@p183
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-10-18 14:43:21 -07:00
Kailang Yang
c8c0a03ec1 ALSA: hda/realtek - Fixed ASUS platform headset Mic issue
ASUS platform Headset Mic was disable by default.
Assigned verb table for Mic pin will enable it.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1155d914c20c40569f56d36c79254879@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-17 09:54:42 +02:00
Artem Borisov
5dedc9f53e ALSA: hda/realtek: Add quirk for ASUS ROG GU603ZV
Enables the SPI-connected Cirrus amp and the required pins
for headset mic detection.

As of BIOS version 313 it is still necessary to modify the
ACPI table to add the related _DSD properties:
  https://gist.github.com/Flex1911/1bce378645fc95a5743671bd5deabfc8

Signed-off-by: Artem Borisov <dedsa2002@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231014075044.17474-1-dedsa2002@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-17 09:39:33 +02:00
Luka Guzenko
56e8599389 ALSA: hda/relatek: Enable Mute LED on HP Laptop 15s-fq5xxx
This HP Laptop uses ALC236 codec with COEF 0x07 controlling the
mute LED. Enable existing quirk for this device.

Signed-off-by: Luka Guzenko <l.guzenko@web.de>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231016221328.1521674-1-l.guzenko@web.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-17 09:38:48 +02:00
Cezary Rojewski
5eb4ff884f ALSA: hda: Add code_loading parameter to stream setup
AudioDSP firmware is the one who kicks SDxFIFOS calculation when a
stream is decoupled mode. During firmware bring up procedure, there is
no firmware running and the code-loading stream is always a decoupled
one. So, there is none to trigger the calculation and we end up with
false-positive timeout (-110) messages.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231006102857.749143-4-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-06 14:30:39 +02:00
Cezary Rojewski
956b610c49 ALSA: hda: Fix stream fifo_size initialization
SDxFIFOS register indicates the fifo size directly. There is no need to
modify the value after reading the register.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20231006102857.749143-3-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-06 14:30:19 +02:00
Thomas Perl
8eb2194e3f ALSA: intel8x0m: fix name of SIS7013 sound chip in comment
While grep'ing for SIS7012, I noticed that there is
only one reference to it in sound/pci/intel8x0m.c,
while most of its code lives in sound/pci/intel8x0.c.

This probably was a simple copy'n'paste mistake, as
the sound/pci/intel8x0m.c driver implements support
for SIS7013 (see DEVICE_SIS), and the two devices
seem to share the same behavior / registers.

Signed-off-by: Thomas Perl <m@thp.io>
Link: https://lore.kernel.org/r/5E4B5CA1-1109-4C82-A581-838ACF19A15D@thp.io
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-06 11:11:40 +02:00
Kailang Yang
ccbd88be05 ALSA: hda/realtek: Change model for Intel RVP board
Intel RVP board (0x12cc) has Headset Mic issue for reboot.
If system plugged headset when system reboot the headset Mic was gone.

Fixes: 1a93f10c5b ("ALSA: hda/realtek: Add "Intel Reference board" and "NUC 13" SSID in the ALC256")
Signed-off-by: Kailang Yang <kailang@realtek.com>
Link: https://lore.kernel.org/r/28112f54c0c6496f97ac845645bc0256@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-06 11:11:18 +02:00
Stefan Binding
5d542b850d ALSA: hda: cs35l41: Cleanup and fix double free in firmware request
There is an unlikely but possible double free when loading firmware,
and a missing free calls if a firmware is successfully requested but
the coefficient file request fails, leading to the fallback firmware
request occurring without clearing the previously loaded firmware.

Fixes: cd40dad2ca ("ALSA: hda: cs35l41: Ensure firmware/tuning pairs are always loaded")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202309291331.0JUUQnPT-lkp@intel.com/
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231003142138.180108-1-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-06 11:11:18 +02:00
Dan Carpenter
c258bcc289 ALSA: hda: cirrus_scodec: fix an error code
The "ret" variable is zero but we should return -EINVAL.

Fixes: 2144833e7b ("ALSA: hda: cirrus_scodec: Add KUnit test")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/5eea7fd5-67c8-4ed4-b5b3-b85dfb7572cc@moroto.mountain
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-30 09:47:17 +02:00
Sui Jingfeng
9ed8fcfd7f ALSA: hda: Use pci_get_base_class() to reduce duplicated code
Use pci_get_base_class() to reduce duplicated code.  No functional change
intended.

Link: https://lore.kernel.org/r/20230825062714.6325-3-sui.jingfeng@linux.dev
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Fred Oh <fred.oh@linux.intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-09-28 16:54:43 -05:00
Kees Cook
81420faff0 ALSA: hda: Annotate struct hda_conn_list with __counted_by
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct hda_conn_list.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230922175042.work.547-kees@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-23 12:36:45 +02:00
Stefan Binding
4c870513fb ALSA: hda: cs35l41: Add read-only ALSA control for forced mute
When the CS35L41 amp is requested to mute using the ACPI
notification mechanism, userspace is not notified that the amp
is muted. To allow userspace to know about the mute, add an
ALSA control which tracks the forced mute override.
This control does not track the overall mute state of the amp,
since the amp is only unmuted during playback anyway, instead
it tracks the mute override request from the ACPI notification.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230921162849.1988124-5-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-22 10:47:50 +02:00
Stefan Binding
447106e92a ALSA: hda: cs35l41: Support mute notifications for CS35L41 HDA
Some laptops require a hardware based mute system, where when a hotkey
is pressed, it forces the amp to be muted.

For CS35L41, when the hotkey is pressed, an acpi notification is sent
to the CS35L41 Device Node. The driver needs to handle this notification
and call a _DSM function to retrieve the mute state.

Since the amp is only muted during playback, the driver will only mute
or unmute if playback is occurring, otherwise it will save the mute
state for when playback starts.

This uses the ACPI Notification mechanism, where a handler has been
registered in the component master, which notifies each amp through
the component binding.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230921162849.1988124-4-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-22 10:47:49 +02:00
Stefan Binding
7ce669334c ALSA: hda/realtek: Support ACPI Notification framework via component binding
For systems which have support for ACPI notifications, add a mechanism to
register a handler for ACPI notifications and then call the acpi_notify
api on the bound components.

Registering a handler in the Realtek HDA driver, allows a single handler to
be registered, which then calls into all the components, rather than
attempting to register the same handler multiple times, once for each
component.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230921162849.1988124-3-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-22 10:47:48 +02:00
Stefan Binding
502629a755 ALSA: hda: cs35l41: Add notification support into component binding
Some systems support a notification from ACPI, which can be used
for different things.

Only one handler can be registered for the acpi notification, but all
amps need to receive that notification, we can register a single handler
inside the component master, so that it can then notify through the
component framework.

This is required to support mute notifications from ACPI.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230921162849.1988124-2-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-22 10:47:47 +02:00
Kailang Yang
d93eeca627 ALSA: hda/realtek - ALC287 merge RTK codec with CS CS35L41 AMP
This is merge model ALC287_FIXUP_THINKPAD_I2S_SPK and
ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Fixes: f7b069cf08 ("ALSA: hda/realtek: Fix generic fixup definition for cs35l41 amp")
Link: https://lore.kernel.org/r/82a45234327c4c50b4988a27e9f64c37@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-21 16:29:27 +02:00
Richard Fitzgerald
f9262fb1da ALSA: hda: cirrus_scodec: Select GPIOLIB for KUnit test
The KUnit test for cirrus_scodec uses GPIO library functions so select
GPIOLIB in Kconfig.

This fixes the ld failures on builds that didn't already select GPIOLIB.
 ld: vmlinux.o: in function `cirrus_scodec_test_gpio_get':
 sound/pci/hda/cirrus_scodec_test.c:40: undefined reference to
	`gpiochip_get_data'
 ld: vmlinux.o: in function `cirrus_scodec_test_gpio_probe':
 sound/pci/hda/cirrus_scodec_test.c:94: undefined reference to
	`gpiochip_generic_request'
 ld: sound/pci/hda/cirrus_scodec_test.c:94: undefined reference to
	`gpiochip_generic_free'
 ld: sound/pci/hda/cirrus_scodec_test.c:95: undefined reference to
	`devm_gpiochip_add_data_with_key'

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202309201646.NnjfKPWk-lkp@intel.com/
Fixes: 2144833e7b ("ALSA: hda: cirrus_scodec: Add KUnit test")
Link: https://lore.kernel.org/r/20230920090338.29345-1-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-20 11:19:40 +02:00
Kailang Yang
41b07476da ALSA: hda/realtek - ALC287 Realtek I2S speaker platform support
New platform SSID:0x231f.

0x17 was only speaker pin, DAC assigned will be 0x03. Headphone
assigned to 0x02.
Playback via headphone will get EQ filter processing.
So, it needs to swap DAC.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/8d63c6e360124e3ea2523753050e6f05@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-19 14:56:06 +02:00
Richard Fitzgerald
deff8486a4 ALSA: hda: cs35l56: Use the new RUNTIME_PM_OPS() macro
Use RUNTIME_PM_OPS() instead of the old SET_RUNTIME_PM_OPS().
This means we don't need  __maybe_unused on the functions.

Fixes: 73cfbfa9ca ("ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier")
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230919081153.19793-1-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-19 14:47:22 +02:00
Richard Fitzgerald
2144833e7b ALSA: hda: cirrus_scodec: Add KUnit test
Add a KUnit test for cirrus_scodec_get_speaker_id(). It is impractical
to have enough hardware with every possible permutation of speaker id.
So use a test harness to test all theoretically supported options.

The test harness consists of:
- a mock GPIO controller.
- a mock struct device to represent the scodec driver
- software nodes to provide the fwnode info that would normally come
  from ACPI.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230918095129.440-3-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-18 17:49:28 +02:00
Richard Fitzgerald
6f03b446cb ALSA: hda: cs35l56: Add support for speaker id
Add handling of the "spk-id-gpios" _DSD property. If present, the
value indicated by the GPIOs is appended to the subsystem-id
part of the firmware name to load the appropriate tunings for that
speaker.

Some manufacturers use multiple sources of speakers, which need
different tunings for best performance. On these models the type
of speaker fitted is indicated by the values of one or more GPIOs.
The number formed by the GPIOs identifies the tuning required.

The speaker ID is only used in combination with a _SUB identifier
because the value is only meaningful if the exact model is known.

The code to get the speaker ID value has been implemented as a
new library so that the cs35l41_hda driver can be switched in
future to share common code. This library can be extended for
other common functionality shared by Cirrus Logic amp drivers.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230918095129.440-2-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-18 17:49:26 +02:00
Takashi Iwai
322e0c5000 ALSA: riptide: Fix -Wformat-truncation warning for longname string
The filling of card->longname can be gracefully truncated, as it's
only informative.  Use scnprintf() and suppress the superfluous
compile warning with -Wformat-truncation.

Link: https://lore.kernel.org/r/20230915091313.5988-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-15 13:23:06 +02:00
Takashi Iwai
5f6af0050a ALSA: hda: generic: Check potential mixer name string truncation
add_control_with_pfx() constructs a mixer name element with the fixed
size, and it got compile warnings with -Wformat-truncation.

Although the size overflow is very unlikely, let's have a sanity check
of the string size and returns the error if it really doesn't fit
instead of silent truncation.

Link: https://lore.kernel.org/r/20230915082802.28684-14-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-15 13:22:16 +02:00
Takashi Iwai
28329936d1 ALSA: cmipci: Fix -Wformat-truncation warning
CMIPCI driver got compile warnings with -Wformat-truncation at a
couple of plain sprintf() usages.  Use scnprintf() for filling the
longname string for avoiding the warnings.

Link: https://lore.kernel.org/r/20230915082802.28684-13-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-15 13:22:16 +02:00
Richard Fitzgerald
21484e43b9 ALSA: hda: cs35l56: Fix missing RESET GPIO if _SUB is missing
In cs35l56_hda_read_acpi() do not return if ACPI _SUB is missing.

A missing _SUB means that the driver cannot load a system-specific
firmware, because the firmware is identified by the _SUB. But it can
fallback to a generic firmware. Unfortunately this was being handled
by immediately returning 0, which would skip the remaining ACPI
configuration in cs35l56_hda_read_acpi() and so it would not get the
RESET GPIO.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 73cfbfa9ca ("ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier")
Link: https://lore.kernel.org/r/20230914152525.20829-1-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-15 10:31:04 +02:00
Kailang Yang
057a28ef93 ALSA: hda: Disable power save for solving pop issue on Lenovo ThinkCentre M70q
Lenovo ThinkCentre M70q had boot up pop noise.
Disable power save will solve pop issue.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/315900e2efef42fd9855eacfeb443abd@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-15 10:29:33 +02:00
Richard Fitzgerald
72ca56664e ALSA: hda: cs35l56: Don't 'return ret' if ret is always zero
The final return in cs35l56_hda_posture_get() was returning the
value of 'ret', but ret is always zero at this point. So this
can be a simple 'return 0'.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230914140852.7112-1-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-14 16:29:43 +02:00
Knyazev Arseniy
07058dceb0 ALSA: hda/realtek: Splitting the UX3402 into two separate models
UX3402VA and UX3402ZA models require different hex values, so comibining
them into one model is incorrect.

Fixes: 491a4ccd8a ("ALSA: hda/realtek: Add quirk for ASUS Zenbook using CS35L41")
Signed-off-by: Knyazev Arseniy <poseaydone@ya.ru>
Link: https://lore.kernel.org/r/20230913053343.119798-1-poseaydone@ya.ru
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-13 09:45:11 +02:00
Richard Fitzgerald
0342518b0c ALSA: hda: cs35l56: Disable low-power hibernation mode
Do not allow the CS35L56 to be put into its lowest power
"hibernation" mode. This only affects I2C because "hibernation"
is already disabled on SPI.

Recent firmwares need a different wake-up sequence. Until
that sequence has been specified, the chip "hibernation" mode
must be disabled otherwise it can intermittently fail to wake.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230912132739.3478441-1-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-13 09:42:33 +02:00
Kailang Yang
fb6254df09 ALSA: hda/realtek - Fixed two speaker platform
If system has two speakers and one connect to 0x14 pin, use this
function will disable it.

Fixes: e43252db7e ("ALSA: hda/realtek - ALC287 I2S speaker platform support")
Signed-off-by: Kailang Yang <kailang@realtek.com>
Link: https://lore.kernel.org/r/e3f2aac3fe6a47079d728a6443358cc2@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-12 12:38:18 +02:00
Richard Fitzgerald
caaaa34eff ALSA: hda: cs35l56: Call pm_runtime_dont_use_autosuspend()
Driver remove() must call pm_runtime_dont_use_autosuspend().

Drivers that call pm_runtime_use_autosuspend() must disable
it in driver remove(). Unfortunately until recently this was
only mentioned in 1 line in a 900+ line document so most
people hadn't noticed this. It has only recently been added
to the kerneldoc of pm_runtime_use_autosuspend().

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 73cfbfa9ca ("ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier")
Link: https://lore.kernel.org/r/20230908101223.2656901-1-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-12 10:00:19 +02:00
Cristian Ciocaltea
206b250c3e
ALSA: hda: cs35l41: Consistently use dev_err_probe()
Replace the remaining dev_err() calls in probe() with dev_err_probe(),
to improve consistency.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20230907171010.1447274-12-cristian.ciocaltea@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11 13:34:42 +01:00
Cristian Ciocaltea
85a1bf86fa
ALSA: hda: cs35l41: Undo runtime PM changes at driver exit time
According to the documentation, drivers are responsible for undoing at
removal time all runtime PM changes done during probing.

Hence, add the missing calls to pm_runtime_dont_use_autosuspend(), which
are necessary for undoing pm_runtime_use_autosuspend().

Fixes: 1873ebd30c ("ALSA: hda: cs35l41: Support Hibernation during Suspend")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20230907171010.1447274-11-cristian.ciocaltea@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11 13:34:41 +01:00
Cristian Ciocaltea
486465508f
ALSA: hda: cs35l41: Fix unbalanced pm_runtime_get()
If component_add() fails, probe() returns without calling
pm_runtime_put(), which leaves the runtime PM usage counter incremented.

Fix the issue by jumping to err_pm label and drop the now unnecessary
pm_runtime_disable() call.

Fixes: 7b2f3eb492 ("ALSA: hda: cs35l41: Add support for CS35L41 in HDA systems")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20230907171010.1447274-10-cristian.ciocaltea@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11 13:34:40 +01:00
Cristian Ciocaltea
77bf613f0b
ASoC: cs35l41: Fix broken shared boost activation
Enabling the active/passive shared boosts requires setting SYNC_EN, but
*not* before receiving the PLL Lock signal.

Due to improper error handling, it was not obvious that waiting for the
completion operation times out and, consequently, the shared boost is
never activated.

Further investigations revealed the signal is triggered while
snd_pcm_start() is executed, right after receiving the
SNDRV_PCM_TRIGGER_START command, which happens long after the
SND_SOC_DAPM_PRE_PMU event handler is invoked as part of
snd_pcm_prepare().  That is where cs35l41_global_enable() is called
from.

Increasing the wait duration doesn't help, as it only causes an
unnecessary delay in the invocation of snd_pcm_start().  Moving the wait
and the subsequent regmap operations to the SNDRV_PCM_TRIGGER_START
callback is not a solution either, since they would be executed in an
IRQ-off atomic context.

Solve the issue by setting the SYNC_EN bit in PWR_CTRL3 register right
after receiving the PLL Lock interrupt.

Additionally, drop the unnecessary writes to PWR_CTRL1 register, part of
the original mdsync_up_seq, which would have toggled GLOBAL_EN with
unwanted consequences on PLL locking behavior.

Fixes: f503056493 ("ALSA: cs35l41: Add shared boost feature")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: David Rhodes <david.rhodes@cirrus.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20230907171010.1447274-5-cristian.ciocaltea@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11 13:34:36 +01:00
Kailang Yang
e43252db7e ALSA: hda/realtek - ALC287 I2S speaker platform support
0x17 was only speaker pin, DAC assigned will be 0x03. Headphone
assigned to 0x02.
Playback via headphone will get EQ filter processing. So,it needs to
swap DAC.

Tested-by: Mark Pearson <mpearson@lenovo.com>
Signed-off-by: Kailang Yang <kailang@realtek.com>
Link: https://lore.kernel.org/r/4e4cfa1b3b4c46838aecafc6e8b6f876@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-07 10:33:04 +02:00
Vitaly Rodionov
99bf5b0baa ALSA: hda/cirrus: Fix broken audio on hardware with two CS42L42 codecs.
Recently in v6.3-rc1 there was a change affecting behaviour of hrtimers
(commit 0c52310f26) and causing
few issues on platforms with two CS42L42 codecs. Canonical/Dell
has reported an issue with Vostro-3910.
We need to increase this value by 15ms.

Link: https://bugs.launchpad.net/somerville/+bug/2031060
Fixes: 9fb9fa18fb ("ALSA: hda/cirrus: Add extra 10 ms delay to allow PLL settle and lock.")
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230904160033.908135-1-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-04 18:09:24 +02:00
Takashi Iwai
da42bcb30e ALSA: hda/tas2781: Use standard clamp() macro
Instead of the home-made clamp() function, use the standard macro().

Fixes: 5be27f1e3e ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Link: https://lore.kernel.org/r/20230831123620.23064-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-31 14:36:46 +02:00
Takashi Iwai
61698d3fbd ALSA: hda: Add missing dependency on CONFIG_EFI for Cirrus/TI sub-codecs
The CS35L41 and TAS2781 sub-codecs depend on CONFIG_EFI, as they have
the code accessing efi variable directly.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202308250621.1lwt7PtZ-lkp@intel.com/
Fixes: 5be27f1e3e ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Link: https://lore.kernel.org/r/20230825092819.12340-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-25 11:28:45 +02:00
Fabian Vogt
c99c26b16c ALSA: hda/realtek: Add quirk for mute LEDs on HP ENVY x360 15-eu0xxx
The LED for the mic mute button is controlled by GPIO2.
The mute button LED is slightly more complex, it's controlled by two bits
in coeff 0x0b.

Signed-off-by: Fabian Vogt <fabian@ritter-vogt.de>
Link: https://lore.kernel.org/r/2693091.mvXUDI8C0e@fabians-envy
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-25 09:48:29 +02:00
Uwe Kleine-König
ed81cb9e05 ALSA: hda/tas2781: Switch back to use struct i2c_driver's .probe()
struct i2c_driver::probe_new is about to go away. Switch the driver to
use the probe callback with the same prototype.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fixes: 5be27f1e3e ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Link: https://lore.kernel.org/r/20230824200219.9569-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-25 09:45:27 +02:00
Su Hui
67de40c9df ALSA: ac97: Fix possible error value of *rac97
Before committing 79597c8bf6, *rac97 always be NULL if there is
an error. When error happens, make sure *rac97 is NULL is safer.

For examble, in snd_vortex_mixer():
	err = snd_ac97_mixer(pbus, &ac97, &vortex->codec);
	vortex->isquad = ((vortex->codec == NULL) ?
		0 : (vortex->codec->ext_id&0x80));
If error happened but vortex->codec isn't NULL, this may cause some
problems.

Move the judgement order to be clearer and better.

Fixes: 79597c8bf6 ("ALSA: ac97: Fix possible NULL dereference in snd_ac97_mixer")
Suggested-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Su Hui <suhui@nfschina.com>
Link: https://lore.kernel.org/r/20230823025212.1000961-1-suhui@nfschina.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-24 10:02:01 +02:00
SungHwan Jung
93dc18e11b ALSA: hda/realtek: Add quirk for HP Victus 16-d1xxx to enable mute LED
This quirk enables mute LED on HP Victus 16-d1xxx (8A25) laptops, which
use ALC245 codec.

Signed-off-by: SungHwan Jung <onenowy@gmail.com>
Link: https://lore.kernel.org/r/20230823114051.3921-1-onenowy@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-24 09:57:46 +02:00
Stefan Binding
581523ee36 ALSA: hda: cs35l41: Override the _DSD for HP Zbook Fury 17 G9 to correct boost type
CS35L41 HDA driver requires ACPI to contain correct _DSD properties to
correctly configure the device. Whilst the HP Zbook Fury 17 G9 contains
valid _DSD properties, the boost type has been configured incorrectly
in the _DSD for this laptop. We can override these properties to fix
the boost type.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230823143956.755758-1-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-24 09:53:12 +02:00
Takashi Iwai
a057efde80 Merge branch 'for-linus' into for-next
Back-merge the 6.5-devel branch for the clean patch application for
6.6 and resolving merge conflicts.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-24 09:27:21 +02:00
Takashi Iwai
1d0eb6143c ALSA: ymfpci: Fix the missing snd_card_free() call at probe error
Like a few other drivers, YMFPCI driver needs to clean up with
snd_card_free() call at an error path of the probe; otherwise the
other devres resources are released before the card and it results in
the UAF.

This patch uses the helper for handling the probe error gracefully.

Fixes: f33fc15767 ("ALSA: ymfpci: Create card with device-managed snd_devm_card_new()")
Cc: <stable@vger.kernel.org>
Reported-and-tested-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Closes: https://lore.kernel.org/r/20230823135846.1812-1-takashi.yano@nifty.ne.jp
Link: https://lore.kernel.org/r/20230823161625.5807-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-23 18:17:33 +02:00
Takashi Iwai
17a1eab7b7 ALSA: hda/tas2781: Fix PM refcount unbalance at tas2781_hda_bind()
The error path of tas2781_hda_bind() needs to release PM refcount as
well.  Modify the code flow to handle properly.

Fixes: 5be27f1e3e ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Closes: https://lore.kernel.org/r/9f910785-e856-1539-e3e4-c9817af5fe67@linux.intel.com
Link: https://lore.kernel.org/r/20230820172635.22236-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-21 16:20:55 +02:00
Takashi Iwai
1c80cc055b ALSA: hda/tas2781: Fix acpi device refcount leak at tas2781_read_acpi()
The error path at tas2781_read_acpi() doesn't release the acpi_device
adev but releases another device physdev instead.  This results in a
refcount leak.  Fix it by replacing with the right object.

Fixes: 5be27f1e3e ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Closes: https://lore.kernel.org/r/9f910785-e856-1539-e3e4-c9817af5fe67@linux.intel.com
Link: https://lore.kernel.org/r/20230820172635.22236-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-21 16:20:54 +02:00
Colin Ian King
f286620b5d ALSA: hda/realtek: Fix spelling mistake "powe" -> "power"
There is a spelling mistake in a quirk entry. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Fixes: 3babae915f ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Link: https://lore.kernel.org/r/20230821080003.16678-1-colin.i.king@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-21 12:40:55 +02:00
Yue Haibing
9f53373464 ALSA: asihpi: Remove unused declarations
These are not implemented, so can remove them.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20230818124852.51468-1-yuehaibing@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-18 15:42:06 +02:00
Takashi Iwai
2098765e95 ALSA: rme9652: Convert to generic PCM copy ops
This patch converts the rme9652 driver code to use the new unified PCM
copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants.

Note that copy_from/to_iter() returns the copied bytes, hence the
error condition is adjusted accordingly.

Link: https://lore.kernel.org/r/20230815190136.8987-14-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-18 12:18:24 +02:00
Takashi Iwai
90ed231177 ALSA: hdsp: Convert to generic PCM copy ops
This patch converts the hdsp driver code to use the new unified PCM
copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants.

Note that copy_from/to_iter() returns the copied bytes, hence the
error condition is adjusted accordingly.

Link: https://lore.kernel.org/r/20230815190136.8987-13-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-18 12:18:23 +02:00
Takashi Iwai
c3abdf06a9 ALSA: rme96: Convert to generic PCM copy ops
This patch converts the rme96 driver code to use the new unified PCM
copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants.

Link: https://lore.kernel.org/r/20230815190136.8987-12-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-18 12:18:22 +02:00
Takashi Iwai
50496aa216 ALSA: rme32: Convert to generic PCM copy ops
This patch converts the rme32 driver code to use the new unified PCM
copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants.

Link: https://lore.kernel.org/r/20230815190136.8987-11-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-18 12:18:21 +02:00
Takashi Iwai
75bd8e3f4c ALSA: nm256: Convert to generic PCM copy ops
This patch converts the nm256 driver code to use the new unified PCM
copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants.

Link: https://lore.kernel.org/r/20230815190136.8987-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-18 12:18:21 +02:00
Takashi Iwai
49aa6ed94c ALSA: korg1212: Convert to generic PCM copy ops
This patch converts the korg1212 driver code to use the new unified
PCM copy callback.  The open-coded conditional memory copies are
replaced with simpler copy_from/to_iter() calls.

Note that copy_from/to_iter() returns the copied bytes, hence the
error condition is adjusted accordingly.

Link: https://lore.kernel.org/r/20230815190136.8987-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-18 12:18:20 +02:00
Takashi Iwai
07ee02a2e1 ALSA: es1938: Convert to generic PCM copy ops
This patch converts the es1938 driver code to use the new unified PCM
copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants in most parts.

Note that copy_from/to_iter() returns the copied bytes, hence the
error condition is adjusted accordingly.

Link: https://lore.kernel.org/r/20230815190136.8987-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-18 12:18:19 +02:00
Shenghao Ding
5be27f1e3e ALSA: hda/tas2781: Add tas2781 HDA driver
Create tas2781 side codec HDA driver for Lenovo Laptops. The quantity
of the speakers has been define in ACPI. All of the tas2781s in the
laptop will be aggregated as one audio speaker. The code supports
realtek codec as the primary codec. Code offers several controls for
digtial/analog gain setting during playback, and other for eq params
setting in case of different audio profiles, such as music, voice,
movie, etc.

[ adjusted patch to be applied to the latest for-next branch -- tiwai ]

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://lore.kernel.org/r/20230818085836.1442-2-shenghao-ding@ti.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-18 12:14:43 +02:00
Shenghao Ding
3babae915f ALSA: hda/tas2781: Add tas2781 HDA driver
Integrate tas2781 configs for Lenovo Laptops. All of the tas2781s in the
laptop will be aggregated as one audio device. The code support realtek
as the primary codec. Rename "struct cs35l41_dev_name" to
"struct scodec_dev_name" for all other side codecs instead of the certain
one.

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://lore.kernel.org/r/20230818085836.1442-1-shenghao-ding@ti.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-18 12:14:34 +02:00
Takashi Iwai
897c8882df ALSA: hwdep: Don't embed device
Like control and PCM devices, it's better to avoid the embedded struct
device for hwdep (although it's more or less well working), too.
Change it to allocate via snd_device_alloc(), and free the memory at
the common snd_hwdep_free().

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Tested-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20230816160252.23396-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-17 09:24:01 +02:00
Yang Yingliang
2e6f979037 ALSA: hda: cs35l41: change cs35l41_prop_model to static
cs35l41_prop_model is only used in cs35l41_hda_property.c now,
change it to static.

Fixes: ef4ba63f12 ("ALSA: hda: cs35l41: Support systems with missing _DSD properties")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20230817014252.1511232-1-yangyingliang@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-17 09:03:37 +02:00
Kailang Yang
46cdff2369 ALSA: hda/realtek - Remodified 3k pull low procedure
Set spec->en_3kpull_low default to true.
Then fillback ALC236 and ALC257 to false.

Additional note: this addresses a regression caused by the previous
fix 69ea4c9d02 ("ALSA: hda/realtek - remove 3k pull low procedure").
The previous workaround was applied too widely without necessity,
which resulted in the pop noise at PM again.  This patch corrects the
condition and restores the old behavior for the devices that don't
suffer from the original problem.

Fixes: 69ea4c9d02 ("ALSA: hda/realtek - remove 3k pull low procedure")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=217732
Link: https://lore.kernel.org/r/01e212a538fc407ca6edd10b81ff7b05@realtek.com
Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-16 14:20:27 +02:00
Takashi Iwai
4098967943 ALSA: hda: cs35l41: Fix the loop check in cs35l41_add_dsd_properties
model->hid is a pointer, and should be rather NULL-checked in the loop
of cs35l41_prop_model_table.

Fixes: ef4ba63f12 ("ALSA: hda: cs35l41: Support systems with missing _DSD properties")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202308160506.8lCEeFDG-lkp@intel.com/
Link: https://lore.kernel.org/r/20230816063525.23009-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-16 08:36:07 +02:00
Stefan Binding
ef4ba63f12 ALSA: hda: cs35l41: Support systems with missing _DSD properties
Some systems using CS35L41 with HDA were released without some
required _DSD properties in ACPI. To support these special cases,
add an api to configure the correct properties for systems with
this issue.

This initial commit moves the no _DSD support for Lenovo
Legion Laptops (CLSA0100, CLSA0101) into a new framework which
can be extended to support additional laptops in the future.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230815161033.3519-1-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-15 20:51:19 +02:00
Stefan Binding
7c76116639 ALSA: hda/cs8409: Support new Dell Dolphin Variants
Add 4 new Dell Dolphin Systems, same configuration as older systems.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230811123044.1045651-1-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-11 16:45:52 +02:00
Stefan Binding
98c68ea031 ALSA: hda/realtek: Switch Dell Oasis models to use SPI
All I2C Dell Oasis models using CS35L41 have been changed to use SPI.
In addition, System 10280cc5 is no longer required.

Fixes: de90f5165b ("ALSA: hda/realtek: Add support for DELL Oasis 13/14/16 laptops")
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230809142957.675933-3-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-10 10:11:56 +02:00
Stefan Binding
fb8cce69e5 ALSA: hda/realtek: Add quirks for HP G11 Laptops
These HP G11 laptops use Realtek HDA codec combined with
2xCS35L41 Amplifiers using SPI or I2C with External Boost.

Laptop 103c8c26 has been removed as this has been replaced
by this new series of laptops.

Fixes: 3e10f6ca76 ("ALSA: hda/realtek: Add quirk for HP EliteBook G10 laptops")
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230809142957.675933-2-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-10 10:11:33 +02:00
Justin Stitt
3d28c46631 ALSA: hda/tegra: refactor deprecated strncpy
`strncpy` is deprecated for use on NUL-terminated destination strings [1].

A suitable replacement is `strscpy` [2] due to the fact that it
guarantees NUL-termination on its destination buffer argument which is
_not_ the case for `strncpy`!

It should be noted that the current implementation is unlikely to have a
bug because `drv_name` is a string literal with a size of 9 while
`card->driver` has a size of 16. However, it is probably worthwhile to
switch to a more robust and less ambiguous interface.

[1]: www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
[2]: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html

Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Justin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/r/20230807-sound-pci-hda-v1-1-6d9cdcd085ca@google.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-08 14:46:11 +02:00
Takashi Iwai
d700a11633 Merge branch 'topic/intel-hda' into for-next
Pull ArrowLake-S PCI ID addition and config for MTL/LNL

Link: https://lore.kernel.org/r/20230802150105.24604-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-04 13:05:42 +02:00
Kai Vehmanen
3bef068168 ALSA: hda: add HD Audio PCI ID for Intel Arrow Lake-S
Add HD Audio PCI ID for Intel Arrow Lake-S platform.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@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/20230802150105.24604-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-04 12:53:53 +02:00
Stefan Binding
cfad53a99d ALSA: hda: cs35l41: Print amp configuration after bind
Print amp configuration information to be able to confirm ACPI
_DSD information (and other useful info) for each amp on each
system using CS35L41, without having to get the acpidump.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230802121235.467358-1-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-02 15:41:41 +02:00
Richard Fitzgerald
8ca3ee6f3f ALSA: hda/cs35l56: Reject I2C alias addresses
The ACPI nodes for CS35L56 can contain an extra I2CSerialBusV2 that
is not a real device, it is an alias address.

This alias address will not be in the cirrus,dev-index array, so reject
any instantions with a device address not found in the array.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-10-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-01 08:30:09 +02:00
Richard Fitzgerald
3106797d2b ALSA: hda/cs35l56: Fail if .bin not found and firmware not patched
A tuning patch is always needed to enable the ASP audio port.
If the BIOS did not patch the firmware, then it is mandatory to
have a .bin file.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-9-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-01 08:30:08 +02:00
Richard Fitzgerald
2f860dd895 ALSA: hda/cs35l56: Do not download firmware over existing RAM firmware
A RAM firmware can only be downloaded if the CS35L56 is currently
running from ROM firmware. The driver must not try to overwrite
the RAM if the CS35L56 is already running from that RAM.

Firmware can be downloaded in these two cases:

- The BIOS has already patched the firmware (secured mode).
  In this case the firmware files will only contain tunings that
  are safe to overwrite.

- The CS35L56 is running the built-in ROM firmware.

After a RAM firmware has been downloaded it can only be cleared by
hard resetting CS35L56. Some systems only hard-reset during
power-on and do not give the driver control of hard reset.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-8-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-01 08:30:08 +02:00
Richard Fitzgerald
0ba0dfd969 ALSA: hda/cs35l56: cs_dsp_power_down() on cs35l56_hda_fw_load() error path
If cs35l56_hda_fw_load() successfully called cs_dsp_power_up() the error
path must balance that with a call to cs_dsp_power_down().

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-7-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-01 08:30:07 +02:00
Richard Fitzgerald
fb78d73dde ALSA: hda/cs35l56: Call cs_dsp_power_down() before calling cs_dsp_remove()
In cs35l56_hda_unbind() cs_dsp_power_down() must be called to cleanup
before calling cs_dsp_remove cs_dsp_remove().

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-6-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-01 08:30:06 +02:00
Richard Fitzgerald
e5bac77b67 ALSA: hda/cs35l56: Always power-up and start cs_dsp
Always call cs_dsp_power_up() and cs_dsp_run() in
cs35l56_hda_fw_load() even if there aren't any firmware files
to download. Also, if there aren't any firmware files to
download there is no need to do cs35l56_firmware_shutdown() and
cs35l56_system_reset().

If there aren't any firmware files there's no need to write
anything to the CS35L56 registers to make it work - it will
already be running the ROM firmware. So it's not strictly
necessary to start cs_dsp.

But it's perfectly ok to call cs_dsp_power_up() and
cs_dsp_run() without downloading any firmware. This avoids
having to support a state where audio is playing but cs_dsp
is not running.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-5-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-01 08:30:06 +02:00
Richard Fitzgerald
15c378d66f ALSA: hda/cs35l56: Call cs_dsp_power_down() before reloading firmware
When firmware is reloaded after a system resume cs_dsp_power_down() should
be called before calling cs_dsp_power_up().

The fw_patched flag should also be cleared and only set again if the
firmware download succeeded.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-4-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-01 08:30:05 +02:00
Richard Fitzgerald
c36570970a ALSA: hda/cs35l56: Do not mark cache dirty after REINIT
Only call regcache_mark_dirty() in cs35l56_hda_fw_load() if
the CS35L56 was SYSTEM_RESET.

recache_mark_dirty() changes the behaviour of regcache_sync()
to write out cache values that are not the default value, and
skip cache values that are the default.

AUDIO_REINIT does not reset the registers. regcache_mark_dirty()
after AUDIO_REINIT could cause the regcache_sync() to sync
registers incorrectly because it will assume that all registers
have reset to default.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-3-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-01 08:30:04 +02:00
Richard Fitzgerald
7b6466ad1d ALSA: hda/cs35l56: Complete firmware reboot before calling cs_dsp_run()
Move the call to cs_dsp_run() in cs35l56_hda_fw_load() so that it
is after the CS35L56 has been reset/reinit'd and the regmap
cache has been synced.

cs_dsp_run() syncs up ALSA control cache values with the DSP memory
so this must not be done until the firmware has reinitialized.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-2-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-01 08:30:04 +02:00
Dan Carpenter
367ef1e1c4 ALSA: hda/cs35l56: Do some clean up on probe error
Smatch complains that this return should be a goto:

    sound/pci/hda/cs35l56_hda.c:910 cs35l56_hda_common_probe()
    warn: missing unwind goto?

The goto error disables cansleep so that seems reasonable.

Fixes: 73cfbfa9ca ("ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/465160f4-b7cf-41d5-931e-d6c9e68fa3c7@moroto.mountain
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-27 11:53:45 +02:00
Pavel Asyutchenko
8019a4ab3d ALSA: hda/realtek: Support ASUS G713PV laptop
This laptop has CS35L41 amp connected via I2C.

With this patch speakers begin to work if the
missing _DSD properties are added to ACPI tables.

Signed-off-by: Pavel Asyutchenko <svenpavel@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230726223732.20775-1-svenpavel@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-27 09:17:51 +02:00
Luka Guzenko
d510acb610 ALSA: hda/relatek: Enable Mute LED on HP 250 G8
This HP Notebook used ALC236 codec with COEF 0x07 idx 1 controlling
the mute LED. Enable already existing quirk for this device.

Signed-off-by: Luka Guzenko <l.guzenko@web.de>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230725111509.623773-1-l.guzenko@web.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-25 14:20:33 +02:00
Takashi Iwai
a32e0834df ASoC: Updates for v6.6
Here's an initial batch of updates for ASoC for this release cycle.
 We've got a bunch of new drivers in here, a bit of core work from
 Morimoto-san and quite a lot of janitorial work.  There's several
 updates that pull in changes from other subsystems in order to build
 on them:
 
  - An adaptor to allow use of IIO DACs and ADCs in ASoC which pulls in
    some IIO changes.
  - Create a library function for intlog10() and use it in the NAU8825
    driver.
  - Include the ASoC tests, including the topology tests, in the default
    KUnit full test coverage.  This also involves enabling UML builds of
    ALSA since that's the default KUnit test environment which pulls in
    the addition of some stubs to the driver.
  - More factoring out from Morimoto-san.
  - Convert a lot of drivers to use the more modern maple tree register
    cache.
  - Support for AMD machines with MAX98388 and NAU8821, Cirrus Logic
    CS35L36, Intel AVS machines with ES8336 and RT5663 and NXP i.MX93.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmS/t9MACgkQJNaLcl1U
 h9Dg4wf+Njvy5zphgUJlSJ7vNj7GtzgldnWwfQrb+19BOtv5HHIYg4e/Yr4eWdgc
 rg5DGIGvr8sxYQ44TCA59sXdTuakkNF/ejDoj8AwNsr/J3sD6S+FTkV8qLFcgQ3r
 +0ElZ26I2kd6gfvDlwHfa5rJVPCa7vrg3o6EHccqRX9CSyPJRlwRqRRj+w8ftZtV
 rZ7Gapz3E4A3mBo7VIO/kEgI1uSmaShM8d4HoVmxJEKJ6lbyX8SIXMBzZVq5z/iX
 DcnRaMPAMhgzytmdDJ7SjJuxL0EOd6p8Lnk0jILvO6U30Z7aTunzMuK/o0GHqFkm
 eHveoHIU4gbt3YqDFgPosPlxi4OCgw==
 =KJZq
 -----END PGP SIGNATURE-----

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

ASoC: Updates for v6.6

Here's an initial batch of updates for ASoC for this release cycle.
We've got a bunch of new drivers in here, a bit of core work from
Morimoto-san and quite a lot of janitorial work.  There's several
updates that pull in changes from other subsystems in order to build
on them:

 - An adaptor to allow use of IIO DACs and ADCs in ASoC which pulls in
   some IIO changes.
 - Create a library function for intlog10() and use it in the NAU8825
   driver.
 - Include the ASoC tests, including the topology tests, in the default
   KUnit full test coverage.  This also involves enabling UML builds of
   ALSA since that's the default KUnit test environment which pulls in
   the addition of some stubs to the driver.
 - More factoring out from Morimoto-san.
 - Convert a lot of drivers to use the more modern maple tree register
   cache.
 - Support for AMD machines with MAX98388 and NAU8821, Cirrus Logic
   CS35L36, Intel AVS machines with ES8336 and RT5663 and NXP i.MX93.
2023-07-25 14:06:08 +02:00
Stefan Binding
2d816d4f92 ALSA: hda: cs35l41: Ensure amp is only unmuted during playback
Currently we only mute after playback has finished, and unmute
prior to setting global enable. To prevent any possible pops
and clicks, mute at probe, and then only unmute after global
enable is set.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-12-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-24 11:00:05 +02:00
Stefan Binding
7cf5ce66df ALSA: hda: cs35l41: Add device_link between HDA and cs35l41_hda
To ensure consistency between the HDA core and the CS35L41 HDA
driver, add a device_link between them. This ensures that the
HDA core will suspend first, and resume second, meaning the
amp driver will not miss any events from the playback hook from
the HDA core during system suspend and resume.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-11-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-24 11:00:05 +02:00
Stefan Binding
c4d0510b81 ALSA: hda: cs35l41: Rework System Suspend to ensure correct call separation
In order to correctly pause audio on suspend, amps using external boost
require parts of the pause sequence to be called for all amps before moving
on to the next steps.
For example, as part of pausing the audio, the VSPK GPIO must be disabled,
but since this GPIO is controlled by one amp, but controls the boost for
all amps, it is required to separate the calls.
During playback this is achieved by using the pre and post playback hooks,
however during system suspend, this is not possible, so to separate the
calls, we use both the .prepare and .suspend calls to pause the audio.

Currently, for this reason, we do not restart audio on system resume.
However, we can support this by relying on the playback hook to resume
playback after system suspend.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-10-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-24 11:00:04 +02:00
Stefan Binding
01ecc56293 ALSA: hda: cs35l41: Use pre and post playback hooks
Use new hooks to ensure separation between play/pause actions,
as required by external boost.

External Boost on CS35L41 requires the amp to go through a
particular sequence of steps. One of these steps involes
the setting of a GPIO. This GPIO is connected to one or
more of the amps, and it may control the boost for all of
the amps. To ensure that the GPIO is set when it is safe
to do so, and to ensure that boost is ready for the rest of
the sequence to be able to continue, we must ensure that
the each part of the sequence is executed for each amp
before moving on to the next part of the sequence.

Some of the Play and Pause actions have moved from Open to
Prepare. This is because Open is not guaranteed to be called
again on system resume, whereas Prepare should.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-9-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-24 11:00:03 +02:00
Stefan Binding
4eae4892c5 ALSA: hda: hda_component: Add pre and post playback hooks to hda_component
These hooks can be used to add callbacks that would be run before and after
the main playback hooks. These hooks would be called for all amps, before
moving on to the next hook, i.e. pre_playback_hook would be called for
all amps, before the playback_hook is called for all amps, then finally
the post_playback_hook is called for all amps.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-8-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-24 11:00:02 +02:00
Stefan Binding
a5adbfb60b ALSA: hda: cs35l41: Move Play and Pause into separate functions
This allows play and pause to be called from multiple places,
which is necessary for system suspend and resume.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-7-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-24 11:00:02 +02:00
Stefan Binding
f2a58481a5 ALSA: hda: cs35l41: Ensure we pass up any errors during system suspend.
There are several steps required to put the system into system suspend.
Some of these steps may fail, so the driver should pass up the errors
if they occur.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-6-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-24 11:00:01 +02:00
Stefan Binding
a3ff564658 ALSA: hda: cs35l41: Ensure we correctly re-sync regmap before system suspending.
In order to properly system suspend, it is necessary to unload the firmware
and ensure the chip is ready for shutdown (if necessary). If the system
is currently in runtime suspend, it is necessary to wake up the device,
and then make it ready. Currently, the wake does not correctly resync
the device, which may mean it cannot suspend correctly. Fix this by
performaing a resync.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-5-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-24 11:00:01 +02:00
Stefan Binding
5299b79ca1 ALSA: hda: cs35l41: Check mailbox status of pause command after firmware load
Currently, we do not check the return status of the pause command,
immediately after we load firmware. If the pause has failed,
the firmware is not running.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-4-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-24 11:00:00 +02:00
Stefan Binding
fa3efcc36a ALSA: cs35l41: Use mbox command to enable speaker output for external boost
To enable the speaker output in external boost mode, 2 registers must
be set, one after another. The longer the time between the writes of
the two registers, the more likely, and more loudly a pop may occur.
To minimize this, an mbox command can be used to allow the firmware
to perform this action, minimizing any delay between write, thus
minimizing any pop or click as a result. The old method will remain
when running without firmware.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-2-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-24 10:59:58 +02:00
Simon Trimmer
73cfbfa9ca
ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier
Add a driver for the Cirrus Logic CS35L56 amplifier. This uses the same
component binding API as the CS35L41 driver. This is not a standalone
HDA device; it provides control of the CS35L56 for systems that use a
combination of an HDA codec and CS35L56 amplifiers with audio routed
through the HDA codec.

The CS35L56 combines a high-performance mono audio amplifier, Class-H
tracking inductive boost converter, Halo Core(TM) DSP and a DC-DC boost
converter supporting Class-H tracking.

Control interfaces are I2C or SPI through the standard Linux I2C or SPI
bus framework.

Most chip functionality is controlled by on-board ROM firmware that is
always running. Firmware patches can be applied by the driver in the form
of a .wmfw file (firmware patch) and/or a .bin file (system tuning).

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20230721132120.5523-12-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-23 23:40:23 +01:00
Richard Fitzgerald
64e0532150
ALSA: hda: Fix missing header dependencies
Add #includes of dependencies into hda_auto_parser.h and hda_generic.h

hda_auto_parser.h uses definitions in hda_local.h.

hda_generic.h uses definitions in hda_local.h and hda_auto_parser.h.
It also references struct hda_jack_callback, but only as a pointer.
This has been forward-declared so hda_jack.h only needs to be
included in source that actually uses it.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20230721132120.5523-11-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-23 23:40:22 +01:00
Kai Vehmanen
6d37a07fdc ALSA: hda: add HDMI codec ID for Intel LNL
Add HDMI codec ID for Intel Lunar Lake platform.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230721135722.31288-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-21 16:47:11 +02:00
Kai Vehmanen
3c851b6384 ALSA: hda/hdmi: keep codec entries in numerical order
Switch order of Intel MTL and RPL codec entries to keep the codec device
id list nicely ordered. Also use the opportunity to fix the naming
to the convention used elsewhere in the drivers.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230721135722.31288-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-21 16:47:03 +02:00
Takashi Iwai
157ac57073 ALSA: ice1712: Use the standard snd_ctl_add_followers() helper
Instead of open-code, use the new standard helper to manage vmaster
stuff for code simplification.

Also, handle the errors from the helper more properly instead of
silently ignoring.

The code changes the call order of snd_ctl_add() of the vmaster object
and its followers for avoiding the possible memory leaks at error
path.  But there should be no difference in the functionality.

Link: https://lore.kernel.org/r/20230721071643.3631-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-21 09:37:49 +02:00
Takashi Iwai
b7bb11fa36 ALSA: ca0106: Use the standard snd_ctl_add_followers() helper
Instead of open-code, use the new standard helper to manage vmaster
stuff for code simplification.

Also, handle the errors from the helper more properly instead of
silently ignoring.

Link: https://lore.kernel.org/r/20230721071643.3631-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-21 09:37:48 +02:00
Takashi Iwai
1caf64d91f ALSA: ac97: Use the standard snd_ctl_add_followers() helper
Instead of open-code, use the new standard helper to manage vmaster
stuff for code simplification.

Except for a debug print, there should be no functional change.

Link: https://lore.kernel.org/r/20230721071643.3631-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-21 09:37:48 +02:00
Takashi Iwai
ebc1bfebda ALSA: ac97: Simplify with snd_ctl_find_id_mixer()
Replace an open code with the new snd_ctl_find_id_mixer().
There is no functional change.

Link: https://lore.kernel.org/r/20230720082108.31346-12-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-21 09:11:24 +02:00
Takashi Iwai
b6ba0aa461 ALSA: cmipci: Simplify with snd_ctl_find_id_mixer()
Replace an open code with the new snd_ctl_find_id_mixer().
There is no functional change.

Link: https://lore.kernel.org/r/20230720082108.31346-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-21 09:10:44 +02:00
Takashi Iwai
a16ea09d22 ALSA: via82xx: Simplify with snd_ctl_find_id_mixer()
Replace an open code with the new snd_ctl_find_id_mixer().
There is no functional change.

Link: https://lore.kernel.org/r/20230720082108.31346-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-21 09:10:43 +02:00
Takashi Iwai
233913c0bc ALSA: maestro3: Simplify with snd_ctl_find_id_mixer()
Replace an open code with the new snd_ctl_find_id_mixer().
There is no functional change.

Link: https://lore.kernel.org/r/20230720082108.31346-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-21 09:10:42 +02:00
Takashi Iwai
171c983027 ALSA: ice1712: Simplify with snd_ctl_find_id_mixer()
Replace an open code with the new snd_ctl_find_id_mixer().
There is no functional change.

Also, add the missing NULL checks in psc724_set_jack_state() to deal
with error cases.

Link: https://lore.kernel.org/r/20230720082108.31346-7-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-21 09:10:41 +02:00
Takashi Iwai
5f2a937bd1 ALSA: es1968: Simplify with snd_ctl_find_id_mixer()
Replace an open code with the new snd_ctl_find_id_mixer().
There is no functional change.

Link: https://lore.kernel.org/r/20230720082108.31346-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-21 09:10:41 +02:00
Takashi Iwai
aa9e918065 ALSA: emu10k1: Simplify with snd_ctl_find_id_mixer()
Replace an open code with the new snd_ctl_find_id_mixer().
There is no functional change.

Link: https://lore.kernel.org/r/20230720082108.31346-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-21 09:10:40 +02:00
Takashi Iwai
f45828d464 ALSA: cs46xx: Simplify with snd_ctl_find_id_mixer()
Replace an open code with the new snd_ctl_find_id_mixer().
There is no functional change.

Link: https://lore.kernel.org/r/20230720082108.31346-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-21 09:10:39 +02:00
Takashi Iwai
7affe6fd2a ALSA: ca0106: Simplify with snd_ctl_find_id_mixer()
Replace an open code with the new snd_ctl_find_id_mixer().
There is no functional change.

Link: https://lore.kernel.org/r/20230720082108.31346-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-21 09:10:39 +02:00
Vitaly Rodionov
de90f5165b ALSA: hda/realtek: Add support for DELL Oasis 13/14/16 laptops
Adding support for new Dell laptops using Cirrus Logic CS35L41
smart amplifiers with Realtek codec.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230720082022.13033-2-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-20 11:12:23 +02:00
Vitaly Rodionov
f7b069cf08 ALSA: hda/realtek: Fix generic fixup definition for cs35l41 amp
Generic fixup for CS35L41 amplifies should not have vendor specific
chained fixup. For ThinkPad laptops with led issue, we can just add
specific fixup.

Fixes: a6ac60b36d (ALSA: hda/realtek: Fix mute led issue on thinkpad with cs35l41 s-codec)
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230720082022.13033-1-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-20 11:11:01 +02:00
Takashi Iwai
f056f2fef3 ALSA: Make control API taking controls_rwsem consistently
A few ALSA control API helpers like snd_ctl_rename(), snd_ctl_remove()
 and snd_ctl_find_*() suppose the callers taking card->controls_rwsem.
 But it's error-prone and fragile.  This patch set tries to change
 those API functions to take the card->controls>rwsem internally by
 themselves, so that the drivers don't need to take care of lockings.
 
 After applying this patch set, only a couple of places still touch
 card->controls_rwsem (which are OK-ish as they need for traversing the
 control linked list).
 
 Link: https://lore.kernel.org/r/20230718141304.1032-1-tiwai@suse.de
 Signed-off-by: Takashi Iwai <tiwai@suse.de>
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAmS46rUOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE8tZRAAh24GODlDoY+KWCEo9ENkzUssWkfat174A5xE
 NJvW1N7cP7NeN8lQUbqvfB5DLTulBDb9RS0s42RcuqOt7/uKDlTV9Nx0exgyXINC
 Xxr5MaCsYuZxzCHy/9AxHchxgcksMkDVxugIQ4RmOhfof3lRA9O3OxLIdE+aHYhQ
 UOtrqnsoXlZXWjbi3OaT1KE2ilAXE/5f2P+fgoQ09ZQwyxAu43izeCkWJpBtWDuF
 /bHftmwXvHOIgiggeSJ0S0zrCPX5cPYzIcYusyucwyztj7CYIwGMyBncGw8ucyUr
 TjNhxQIZNDEyE3w0mre4X8rB3JLPlqaszqLKu6GsX8dwoAle5t1LPeG/6RhZxnD1
 o6D9/HCu9VdVSSDFlQ87SZH81SV0ltqHFqUFX5XroAhYyBG9xe/z29AU5p2Qx2B4
 saR/la384Bxedu/QpBM7pkqDZceKy4iNIGKVZXKu+1yd8Q5xbHNguU/RlXLM83iX
 /mcnO7/SDfI9m+hSgEXUZEl1pBW7wOWnTATAfjbr4ANNSwgzoVyS8a/86g3QjdvJ
 SlHysXDP+w5nf5QZd4wTMzKo6wjD5EMLie0FTCF9QvD5IMtAwVqTHYYoJDW85Qr0
 gxovfYqjhZ05Aa87S+Gy154HUwLhRfhOaQp7wBpuHwlmYcFhw+0RnF6/RbZGEjMv
 VvP4PQ8=
 =V5+5
 -----END PGP SIGNATURE-----

Merge tag 'tags/ctl-lock-fixes-6.6' into for-next

ALSA: Make control API taking controls_rwsem consistently

A few ALSA control API helpers like snd_ctl_rename(), snd_ctl_remove()
and snd_ctl_find_*() suppose the callers taking card->controls_rwsem.
But it's error-prone and fragile.  This patch set tries to change
those API functions to take the card->controls>rwsem internally by
themselves, so that the drivers don't need to take care of lockings.

After applying this patch set, only a couple of places still touch
card->controls_rwsem (which are OK-ish as they need for traversing the
control linked list).

Link: https://lore.kernel.org/r/20230718141304.1032-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-20 10:05:19 +02:00
Takashi Iwai
3315cf9583 ALSA: emu10k1: Go back and simplify with snd_ctl_find_id()
Now that snd_ctl_find_id() takes the locking itself, we can get rid of
the messy locking in the caller side in snd_emu10k1_verify_controls().

Link: https://lore.kernel.org/r/20230718141304.1032-12-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-20 10:03:00 +02:00
Takashi Iwai
b1e055f676 ALSA: control: Introduce unlocked version for snd_ctl_find_*() helpers
For reducing the unnecessary use of controls_rwsem in the drivers,
this patch adds a new variant for snd_ctl_find_*() helpers:
snd_ctl_find_id_locked() and snd_ctl_find_numid_locked() look for a
kctl element inside the card->controls_rwsem -- that is, doing the
very same as what snd_ctl_find_id() and snd_ctl_find_numid() did until
now.  snd_ctl_find_id() and snd_ctl_find_numid() remain same,
i.e. still unlocked version, but they will be switched to locked
version once after all callers are replaced.

The patch also replaces the calls of snd_ctl_find_id() and
snd_ctl_find_numid() in a few places; all of those are places where we
know that the functions are called properly with controls_rwsem held.
All others are without rwsem (although they should have been).

After this patch, we'll turn on the locking in snd_ctl_find_id() and
snd_ctl_find_numid() to be more race-free.

Link: https://lore.kernel.org/r/20230718141304.1032-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-20 10:03:00 +02:00
Takashi Iwai
192c4cccd0 ALSA: control: Take controls_rwsem lock in snd_ctl_remove()
So far, snd_ctl_remove() requires its caller to take
card->controls_rwsem manually before the call for avoiding possible
races.  However, many callers don't care and miss the locking.

Basically it's cumbersome and error-prone to enforce it to each
caller.  Moreover, card->controls_rwsem is a field that should be used
only by internal or proper helpers, and it's not to be touched at
random external places.

This patch is an attempt to make those calls more consistent: now
snd_ctl_remove() takes the card->controls_rwsem internally, just like
other API functions for kctls.  Since a few callers already take the
controls_rwsem locks, the patch removes those locks at the same time,
too.

Link: https://lore.kernel.org/r/20230718141304.1032-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-20 10:01:27 +02:00
Luka Guzenko
0659400f18 ALSA: hda/realtek: Enable Mute LED on HP Laptop 15s-eq2xxx
The HP Laptop 15s-eq2xxx uses ALC236 codec and controls the mute LED using
COEF 0x07 index 1. No existing quirk covers this configuration.
Adds a new quirk and enables it for the device.

Signed-off-by: Luka Guzenko <l.guzenko@web.de>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230718161241.393181-1-l.guzenko@web.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-19 16:55:53 +02:00
Christoffer Sandberg
c250ef8954 ALSA: hda/realtek: Add quirk for Clevo NS70AU
Fixes headset detection on Clevo NS70AU.

Co-developed-by: Werner Sembach <wse@tuxedocomputers.com>
Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
Signed-off-by: Christoffer Sandberg <cs@tuxedo.de>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230718145722.10592-1-wse@tuxedocomputers.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-18 17:15:10 +02:00
Takashi Iwai
21634f0f30 Merge branch 'topic/hda-pci-ids' into for-next
Pull cleanup of HD-audio PCI IDs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-18 14:24:56 +02:00
Amadeusz Sławiński
e6232c80a5 ALSA: hda: Convert to PCI device IDs defines
Use PCI device IDs from pci_ids.h header and while at it to simplify
declarations change to using PCI_DEVICE_DATA() macro for Intel IDs and
PCI_VDEVICE() for all other that have defined vendor.

Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20230717114511.484999-11-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-18 14:22:21 +02:00
Amadeusz Sławiński
1b21bd7a56 ALSA: hda: Use global PCI match macro
Instead of using local macro to match PCI device, use global one. As
Apollolake is Broxton-P successor that made it to the market, be precise
and use APL shortcut.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20230717114511.484999-7-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-18 14:22:18 +02:00
Amadeusz Sławiński
97b7aeb2d9 ALSA: Remove unused Broxton PCI ID
Current code references 0x1a98 which is BXT-M (not -T as it is
commented) and it's an RVP, BXT-M B0 to be specific. From what we know
no BXT is available on market.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20230717114511.484999-5-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-18 14:22:16 +02:00
Oswald Buddenhagen
6d68d9cba1 ALSA: emu10k1: rework copyright statements
- Remove the "log-like" parts, following the same logic as the previous
  commit
- Unify format
- Add missing major contributors, including myself
- Sort entries in order of first contribution (Creative comes last for
  optical reasons; they don't appear to have directly contributed
  anyway)

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230715160839.326978-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-17 09:30:34 +02:00
Oswald Buddenhagen
9034ff1169 ALSA: emu10k1: clean up driver status comments
Empty BUGS and TODO sections don't really help anyone, so remove them.

Version information is chronically outdated, and not really useful in a
git world anyway, so remove it as well.

Also remove duplicated (and outdated, of course) status section from
p16v.h (the one in p16v.c is in better shape).

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230715160839.326978-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-17 09:29:36 +02:00
Oswald Buddenhagen
c960b012ec ALSA: emu10k1: track loss of external clock on E-MU cards
85;95;0c
This uses IRQs to track spontaneous changes to the word clock source
register.

FWIW, that this can happen in the first place is the reason why it is
futile to lock the clock source mixer setting while the device is open -
we can't consistently control the rate anyway. Though arguably, we
should reset any open streams when that happens, as they become
corrupted anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230715160738.326832-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-17 09:21:21 +02:00
Rob Herring
7e9f28398a ALSA: Explicitly include correct DT includes
The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it as merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230714175109.4066599-1-robh@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-16 14:50:56 +02:00
Kailang Yang
69ea4c9d02 ALSA: hda/realtek - remove 3k pull low procedure
This was the ALC283 depop procedure.
Maybe this procedure wasn't suitable with new codec.
So, let us remove it. But HP 15z-fc000 must do 3k pull low. If it
reboot with plugged headset,
it will have errors show don't find codec error messages. Run 3k pull
low will solve issues.
So, let AMD chipset will run this for workarround.

Fixes: 5aec989130 ("ALSA: hda/realtek - ALC236 headset MIC recording issue")
Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Reported-by: Joseph C. Sible <josephcsible@gmail.com>
Closes: https://lore.kernel.org/r/CABpewhE4REgn9RJZduuEU6Z_ijXNeQWnrxO1tg70Gkw=F8qNYg@mail.gmail.com/
Link: https://lore.kernel.org/r/4678992299664babac4403d9978e7ba7@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-14 07:59:21 +02:00
Oswald Buddenhagen
67192cc0f0 ALSA: emu10k1: remove superfluous IRQ enable state saving
The mixer, PCM prepare, MIDI, synth driver, and procfs callbacks are all
always invoked with IRQs enabled, so there is no point in saving the
state.

snd_emu1010_load_firmware_entry() is called from emu1010_firmware_work()
and snd_emu10k1_emu1010_init(); the latter from snd_emu10k1_create() and
snd_emu10k1_resume(), all of which have IRQs enabled.

The voice and memory functions are called from mixed contexts, so they
keep the state saving.

The low-level functions all keep the state saving, because it's not
feasible to keep track of what is called where.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230712145750.125086-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-13 10:30:06 +02:00
Oswald Buddenhagen
deb1200f6e ALSA: emu10k1: fix return value of snd_emu1010_adc_pads_put()
It returned zero even if the value had changed.

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

Link: https://lore.kernel.org/r/20230712145750.125086-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-13 07:57:30 +02:00
Oswald Buddenhagen
fbb64eedf5 ALSA: emu10k1: make E-MU dock monitoring interrupt-driven
... instead of using a one-second polling timer.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230710065956.1246364-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-10 16:56:59 +02:00
Luke D. Jones
5251605f4d ALSA: hda/realtek: Add quirk for ASUS ROG GZ301V
Adds the required quirk to enable the Cirrus amp and correct pins
on the ASUS ROG GZ301V series which uses an SPI connected Cirrus amp.

While this works if the related _DSD properties are made available, these
aren't included in the ACPI of these laptops (yet).

Signed-off-by: Luke D. Jones <luke@ljones.dev>
Link: https://lore.kernel.org/r/20230706223323.30871-2-luke@ljones.dev
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-07 08:07:49 +02:00
Luke D. Jones
72cea3a317 ALSA: hda/realtek: Whitespace fix
Remove an erroneous whitespace.

Fixes: 31278997ad ("ALSA: hda/realtek - Add headset quirk for Dell DT")
Signed-off-by: Luke D. Jones <luke@ljones.dev>
Link: https://lore.kernel.org/r/20230704044619.19343-6-luke@ljones.dev
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-04 08:41:40 +02:00
Luke D. Jones
33d7c9c3bf ALSA: hda/realtek: Add quirk for ASUS ROG G614Jx
Adds the required quirk to enable the Cirrus amp and correct pins
on the ASUS ROG G614J series which uses an SPI connected Cirrus amp.

While this works if the related _DSD properties are made available, these
aren't included in the ACPI of these laptops (yet).

Signed-off-by: Luke D. Jones <luke@ljones.dev>
Link: https://lore.kernel.org/r/20230704044619.19343-5-luke@ljones.dev
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-04 08:40:02 +02:00
Luke D. Jones
b759a5f097 ALSA: hda/realtek: Amend G634 quirk to enable rear speakers
Amends the last quirk for the G634 with 0x1caf subsys to enable the rear
speakers via pincfg.

Signed-off-by: Luke D. Jones <luke@ljones.dev>
Link: https://lore.kernel.org/r/20230704044619.19343-4-luke@ljones.dev
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-04 08:39:47 +02:00
Luke D. Jones
9abc77fb14 ALSA: hda/realtek: Add quirk for ASUS ROG GA402X
Adds the required quirk to enable the Cirrus amp and correct pins
on the ASUS ROG GA402X series which uses an I2C connected Cirrus amp.

While this works if the related _DSD properties are made available, these
aren't included in the ACPI of these laptops (yet).

Signed-off-by: Luke D. Jones <luke@ljones.dev>
Link: https://lore.kernel.org/r/20230704044619.19343-3-luke@ljones.dev
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-04 08:39:34 +02:00
Luke D. Jones
8cc87c055d ALSA: hda/realtek: Add quirk for ASUS ROG GX650P
Adds the required quirk to enable the Cirrus amp and correct pins
on the ASUS ROG GV601V series which uses an I2C connected Cirrus amp.

While this works if the related _DSD properties are made available, these
aren't included in the ACPI of these laptops (yet).

Signed-off-by: Luke D. Jones <luke@ljones.dev>
Link: https://lore.kernel.org/r/20230704044619.19343-2-luke@ljones.dev
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-04 08:39:23 +02:00
dengxiang
73f1c75d5e ALSA: hda/realtek: Add quirks for Unis H3C Desktop B760 & Q760
These models use NSIWAY amplifiers for internal speaker, but cannot put
sound outside from these amplifiers. So eapd verbs are needed to initialize
the amplifiers. They can be added during boot to get working sound out
of internal speaker.

Signed-off-by: dengxiang <dengxiang@nfschina.com>
Link: https://lore.kernel.org/r/20230703021751.2945750-1-dengxiang@nfschina.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-03 09:58:15 +02:00
Werner Sembach
22065e4214 ALSA: hda/realtek: Add quirk for Clevo NPx0SNx
This applies a SND_PCI_QUIRK(...) to the Clevo NPx0SNx barebones fixing the
microphone not being detected on the headset combo port.

Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230628155434.584159-1-wse@tuxedocomputers.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-29 08:42:57 +02:00
Takashi Iwai
d6048fdc87 ASoC: Updates for v6.5
A fairly quiet release from a core and framework point of view, but a
 very big one from the point of view of new drivers:
 
  - More refectoring from Morimoto-san, this time mainly around DAI
    links and how we control the ordering of trigger() callbacks.
  - Convert a lot of drivers to use maple tree based caches.
  - Lots of work on the x86 driver stack.
  - Compressed audio support for Qualcomm.
  - Support for AMD SoundWire, Analog Devices SSM3515, Google Chameleon,
    Ingenic X1000, Intel systems with various CODECs, Longsoon platforms,
    Maxim MAX98388, Mediatek MT8188, Nuvoton NAU8825C, NXP platforms with
    NAU8822, Qualcomm WSA884x, StarFive JH7110, Texas Instruments TAS2781.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmSZjIQACgkQJNaLcl1U
 h9Dm0wf/X1q4n6KSXLvSyoSUxS/RWzWgyDDX7a4iLcFiov3ehHpVwzhwI/+1xSzs
 SGhg6q2rud05SejFBh+2L7HMZfdXWSfW9ukaGz3UsCdqw3/7zAUFgY1RGtjZO4lA
 eH50vEME9RbkIDgyxzYe9eViaKGh2fNxIbQ2d9hx6+nIVNfuuSikvGz4K/9PD0DN
 2tBgzuIWwrPIbvMV2zHDCycmVG0lqScMWjIrdpDFxa63aPTr920YqYWSoQfOUR1s
 j9zlZWnclTjrqRl1GZHxnM8N70vmutZWXAB1WFjal6mmMd6lUG71CyYHvA5h5D0V
 ygNpn9B5REYlHBVzI43uT3nog+iS4Q==
 =dbjW
 -----END PGP SIGNATURE-----

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

ASoC: Updates for v6.5

A fairly quiet release from a core and framework point of view, but a
very big one from the point of view of new drivers:

 - More refectoring from Morimoto-san, this time mainly around DAI
   links and how we control the ordering of trigger() callbacks.
 - Convert a lot of drivers to use maple tree based caches.
 - Lots of work on the x86 driver stack.
 - Compressed audio support for Qualcomm.
 - Support for AMD SoundWire, Analog Devices SSM3515, Google Chameleon,
   Ingenic X1000, Intel systems with various CODECs, Longsoon platforms,
   Maxim MAX98388, Mediatek MT8188, Nuvoton NAU8825C, NXP platforms with
   NAU8822, Qualcomm WSA884x, StarFive JH7110, Texas Instruments TAS2781.
2023-06-26 15:38:02 +02:00
Takashi Iwai
a15b513756 Merge branch 'for-next' into for-linus
Pull the 6.5-devel branch for upstreaming.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-26 15:23:23 +02:00
Andy Chi
e94f1f96f1 ALSA: hda/realtek: Enable mute/micmute LEDs and limit mic boost on EliteBook
On HP EliteBook 835/845/845W G10, the audio LEDs can be enabled by
ALC285_FIXUP_HP_MUTE_LED. So use it accordingly.

Signed-off-by: Andy Chi <andy.chi@canonical.com>
Cc: <stable@vger.kernel.org>
Fixes: 3e10f6ca76 ("ALSA: hda/realtek: Add quirk for HP EliteBook G10 laptops")
Link: https://lore.kernel.org/r/20230626130301.301712-1-andy.chi@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-26 15:22:47 +02:00
Matthew Anderson
724418b84e ALSA: hda/realtek: Add quirks for ROG ALLY CS35l41 audio
This requires a patched ACPI table or a firmware from ASUS to work because
the system does not come with the _DSD field for the CSC3551.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=217550
Signed-off-by: Matthew Anderson <ruinairas1992@gmail.com>
Tested-by: Philip Mueller <philm@manjaro.org>
Link: https://lore.kernel.org/r/20230621161714.9442-1-ruinairas1992@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-21 18:22:40 +02:00
Luke D. Jones
82edd1bd7f ALSA: hda/realtek: Add quirk for ASUS ROG GV601V
Adds the required quirk to enable the Cirrus amp and correct pins
on the ASUS ROG GV601V series.

While this works if the related _DSD properties are made available, these
aren't included in the ACPI of these laptops (yet).

Signed-off-by: Luke D. Jones <luke@ljones.dev>
Link: https://lore.kernel.org/r/20230621085715.5382-1-luke@ljones.dev
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-21 13:33:01 +02:00
Luke D. Jones
555434fd5c ALSA: hda/realtek: Add quirk for ASUS ROG G634Z
Adds the required quirk to enable the Cirrus amp and correct pins
on the ASUS ROG G634Z series.

While this works if the related _DSD properties are made available, these
aren't included in the ACPI of these laptops (yet).

Signed-off-by: Luke D. Jones <luke@ljones.dev>
Link: https://lore.kernel.org/r/20230619060320.1336455-1-luke@ljones.dev
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-19 14:45:41 +02:00
Su Hui
79597c8bf6 ALSA: ac97: Fix possible NULL dereference in snd_ac97_mixer
smatch error:
sound/pci/ac97/ac97_codec.c:2354 snd_ac97_mixer() error:
we previously assumed 'rac97' could be null (see line 2072)

remove redundant assignment, return error if rac97 is NULL.

Fixes: da3cec35dd ("ALSA: Kill snd_assert() in sound/pci/*")
Signed-off-by: Su Hui <suhui@nfschina.com>
Link: https://lore.kernel.org/r/20230615021732.1972194-1-suhui@nfschina.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-15 08:41:40 +02:00
Oswald Buddenhagen
58cc6133cc ALSA: emu10k1: actually show some S/PDIF status in /proc for E-MU cards
The file is called spdif-in, but we abused it to show only sample rates
from various sources. Rectify it as far as possible (the FPGA doesn't
give us a lot of information).

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

Link: https://lore.kernel.org/r/20230612191325.1315854-10-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-13 07:47:34 +02:00
Oswald Buddenhagen
3ac251420b ALSA: emu10k1: add support for 12 kHz capture on Audigy
Fixes a tentative FIXME. Because we can.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230612191325.1315854-9-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-13 07:47:16 +02:00
Oswald Buddenhagen
ca533448a0 ALSA: emu10k1: fix timer for E-MU cards at 44.1 kHz word clock
The timer was presuming a fixed 48 kHz word clock, like the rest of the
code.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230612191325.1315854-8-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-13 07:46:58 +02:00
Oswald Buddenhagen
e68235c8aa ALSA: emu10k1: fix synthesizer pitch for E-MU cards at 44.1 kHz
This is only a very partial fix - the frequency-dependent envelope & LFO
register values aren't adjusted.

But I'm not sure they were even correct at 48 kHz to start with, as most
of them are precalculated by common code which assumes an EMU8K-specific
44.1 kHz word clock, and it seems somewhat unlikely that the hardware's
register interpretation was adjusted to compensate for the different
word clock.

In any case I'm not going to spend time on fixing that, as this code is
unlikely to be actually used by anyone today.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230612191325.1315854-6-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-13 07:42:08 +02:00
Oswald Buddenhagen
19b89d15fa ALSA: emu10k1: fix sample rates for E-MU cards at 44.1 kHz word clock
Now that we know the actual word clock, we can:
- Put the resulting rate into the hardware info
- At 44.1 kHz word clock shift the rate for the pitch calculations,
  which presume a 48 kHz word clock

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230612191325.1315854-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-13 07:41:43 +02:00
Oswald Buddenhagen
e73b597e63 ALSA: emu10k1: query rate of external clock sources on E-MU cards
The value isn't used yet; the subsequent commits will do that.

This ignores the existence of rates above 48 kHz, which is fine, as the
hardware will just switch to the fallback clock source when fed with a
rate which is incompatible with the base clock multiplier, which
currently is always x1.

The sample rate display in /proc spdif-in is adjusted to reflect our
understanding of the input rates.

This is tested only with an 0404b card without sync card, so there is a
lot of room for improvement.

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

Link: https://lore.kernel.org/r/20230612191325.1315854-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-13 07:41:07 +02:00
Oswald Buddenhagen
60985241bf ALSA: emu10k1: make available E-MU clock sources card-specific
The actually available clock sources depend on the available audio input
ports and dedicated clock input ports.

This includes refactoring the code to be data-driven to remain
manageable.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230612191325.1315854-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-13 07:40:51 +02:00
Oswald Buddenhagen
1359886227 ALSA: emu10k1: split off E-MU fallback clock from clock source
So far, we set the fallback as a side effect of setting the source. But
the fallback makes no sense at all when an internal clock is selected.
Defaulting to 48k for S/PDIF & ADAT makes sense, but as that is the
global default and we're not changing it automatically any more, it's
just fine to leave it entirely to the explicit setting.

This changes the name of the pre-existing control to something more
appropriate (regardless of the split), so users will need to adjust
their mixer settings.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230612191325.1315854-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-13 07:39:50 +02:00
Edson Juliano Drosdeck
a2a8714831 ALSA: hda/realtek: Add a quirk for Compaq N14JP6
Add a quirk for Compaq N14JP6 to fixup ALC897 headset MIC no sound.

Signed-off-by: Edson Juliano Drosdeck <edson.drosdeck@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230609201058.523499-1-edson.drosdeck@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-10 08:44:19 +02:00
Yanteng Si
a4d2b85378 ALSA: hda/intel: Workaround for WALLCLK register for loongson controller
On loongson controller, the value of WALLCLK register
is always 0, which is meaningless, so we return directly.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Signed-off-by: Yingkun Meng <mengyingkun@loongson.cn>
Acked-by: Huacai Chen <chenhuacai@loongson.cn>
Link: https://lore.kernel.org/r/185df71ef413ab190460eb377703214ee7288aeb.1686128807.git.siyanteng@loongson.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-07 12:42:14 +02:00
Yanteng Si
942ccdd834 ALSA: hda: Workaround for SDnCTL register on loongson
On loongson controller, after calling snd_hdac_stream_updateb()
to enable DMA engine, the SDnCTL.STRM will become to zero.  We
need to access SDnCTL in dword to keep SDnCTL.STRM is not changed.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Signed-off-by: Yingkun Meng <mengyingkun@loongson.cn>
Acked-by: Huacai Chen <chenhuacai@loongson.cn>
Link: https://lore.kernel.org/r/27aeddf5ebbe7c69631cec0e489c1b264be94990.1686128807.git.siyanteng@loongson.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-07 12:41:21 +02:00
Yanteng Si
cbc3e98acf ALSA: hda: Using polling mode for loongson controller by default
On loongson controller, RIRBSTS.RINTFL cannot be cleared,
azx_interrupt() is called all the time. We disable RIRB
interrupt, and use polling mode by default.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Signed-off-by: Yingkun Meng <mengyingkun@loongson.cn>
Acked-by: Huacai Chen <chenhuacai@loongson.cn>
Link: https://lore.kernel.org/r/d309a75424d438b958d90d797b4f1ba45468e090.1686128807.git.siyanteng@loongson.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-07 12:37:25 +02:00
Yanteng Si
28bd137a3c ALSA: hda: Add Loongson LS7A HD-Audio support
Add the new PCI ID 0x0014 0x7a07 and the new PCI ID 0x0014 0x7a37
Loongson HDA controller.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Acked-by: Huacai Chen <chenhuacai@loongson.cn>
Link: https://lore.kernel.org/r/993587483b9509796b29a416f257fcfb4b15c6ea.1686128807.git.siyanteng@loongson.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-07 12:36:38 +02:00
Chris Chiu
b752a385b5 ALSA: hda/realtek: Enable 4 amplifiers instead of 2 on a HP platform
In the commit 7bb6234095 ("ALSA: hda/realtek: fix speaker, mute/micmute
LEDs not work on a HP platform"), speakers and LEDs are fixed but only 2
CS35L41 amplifiers on SPI bus connected to Realtek codec are enabled. Need
the ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED to get all amplifiers working.

Signed-off-by: Chris Chiu <chris.chiu@canonical.com>
Fixes: 7bb6234095 ("ALSA: hda/realtek: fix speaker, mute/micmute LEDs not work on a HP platform")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230606145747.135966-1-chris.chiu@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 17:44:24 +02:00
Stefan Binding
ebcbfd8463 ALSA: hda/realtek: Delete cs35l41 component master during free
This ensures that the driver is properly cleaned up when freed.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230606103436.455348-4-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 14:32:05 +02:00
Stefan Binding
31dbb503f0 ALSA: hda: cs35l41: Fix endian conversions
Found during static analysis, ensure variables are correct
types before endian conversion.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230606103436.455348-3-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 14:32:05 +02:00
Stefan Binding
448425f05b ALSA: hda: cs35l41: Clean up Firmware Load Controls
Ensure Firmware Load control and Firmware Type control
returns 1 when the value changes.

Remove fw_mutex from firmware load control put, since it is
unnecessary, and prevents any possibility of mutex inversion.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230606103436.455348-2-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 14:32:04 +02:00
Takashi Iwai
5c219a3408 ALSA: hda: Fix kctl->id initialization
HD-audio core code replaces the kctl->id.index of SPDIF-related
controls after assigning via snd_ctl_add().  This doesn't work any
longer with the new Xarray lookup change.  The change of the kctl->id
content has to be done via snd_ctl_rename_id() helper, instead.

Fixes: c27e1efb61 ("ALSA: control: Use xarray for faster lookups")
Cc: <stable@vger.kernel.org>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230606093855.14685-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 14:31:18 +02:00
Takashi Iwai
f2f312ad88 ALSA: cmipci: Fix kctl->id initialization
cmipci driver replaces the kctl->id.device after assigning the kctl
via snd_ctl_add().  This doesn't work any longer with the new Xarray
lookup change.  It has to be set before snd_ctl_add() call instead.

Fixes: c27e1efb61 ("ALSA: control: Use xarray for faster lookups")
Cc: <stable@vger.kernel.org>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230606093855.14685-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 14:30:48 +02:00
Takashi Iwai
c9b83ae4a1 ALSA: ymfpci: Fix kctl->id initialization
ymfpci driver replaces the kctl->id.device after assigning the kctl
via snd_ctl_add().  This doesn't work any longer with the new Xarray
lookup change.  It has to be set before snd_ctl_add() call instead.

Fixes: c27e1efb61 ("ALSA: control: Use xarray for faster lookups")
Cc: <stable@vger.kernel.org>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230606093855.14685-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 14:30:27 +02:00
Jaroslav Kysela
b9a4efd61b ALSA: ice1712,ice1724: fix the kcontrol->id initialization
The new xarray lookup code requires to know complete kcontrol->id before
snd_ctl_add() call. Reorder the code to make the initialization properly.

Cc: stable@kernel.org # v5.19+
Reported-by: Martin Zidek <zidek@master.cz>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230606073122.597491-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 09:43:55 +02:00
Tim Crawford
da209f7a80 ALSA: hda/realtek: Add quirk for Clevo NS50AU
Fixes headset detection on Clevo NS50AU.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230605163834.24653-1-tcrawford@system76.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-05 19:12:42 +02:00
Stefan Binding
811dd426a9 ALSA: hda/realtek: Add quirks for Asus ROG 2024 laptops using CS35L41
Add support for Asus ROG 2024 models using CS35L41 SPI with Internal
Boost.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230605153308.448550-1-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-05 18:04:47 +02:00
Sayed, Karimuddin
1a93f10c5b ALSA: hda/realtek: Add "Intel Reference board" and "NUC 13" SSID in the ALC256
Add "Intel Reference boad" and "Intel NUC 13" SSID in the alc256.
  Enable jack headset volume buttons

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Sayed, Karimuddin <karimuddin.sayed@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602193812.66768-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-05 09:48:55 +02:00
RenHai
7ca4c8d4d3 ALSA: hda/realtek: Add Lenovo P3 Tower platform
Headset microphone on this platform does not work without
ALC897_FIXUP_HEADSET_MIC_PIN fixup.

Signed-off-by: RenHai <kean0048@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230602003604.975892-1-kean0048@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-05 09:48:10 +02:00
Ai Chao
527c356b51 ALSA: hda/realtek: Add a quirk for HP Slim Desktop S01
Add a quirk for HP Slim Desktop S01 to fixup headset MIC no presence.

Signed-off-by: Ai Chao <aichao@kylinos.cn>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230526094704.14597-1-aichao@kylinos.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-05 09:32:13 +02:00
Oswald Buddenhagen
db987421b5 ALSA: emu10k1: vastly improve usefulness of info in /proc
- Include the FX bus map, without which the already present send routing
  info would require looking up the documentation.
- Include the physical I/O channels as known to the driver
- Make the multi-channel capture map actually name the mapped input
  channels rather than "FXBUS" (Audigy) or even "???" (SbLive)
- The latter two are omitted for E-MU cards, as their physical I/O is
  routed through the FPGA
- While at it, make the "Card" field somewhat more useful

This includes de-duplicating the label tables between emuproc and emufx,
updating/improving the FX bus label table, and making the SB Live! 5.1
multi-track capture channel mapping hack data-driven.

Tested-by: Jonathan Dowland <jon@dow.land>
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230526101659.437969-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-05 09:26:45 +02:00
Oswald Buddenhagen
6ab13291ba ALSA: emu10k1: make E-MU FPGA register dump in /proc more useful
Include the routing information, which can be actually read back.

Somewhat as a drive-by, make the register dump format less obscure - the
previous one made no sense at all.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230526101659.437969-6-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-05 09:26:26 +02:00
Oswald Buddenhagen
ad326d4a13 ALSA: emu10k1: include FX send amounts in /proc output
It seems to make little sense to include the FX send routing, but not
the amounts.

This also simplifies the code somewhat, and lines up the output.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230526101659.437969-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-05 09:26:10 +02:00
Oswald Buddenhagen
6e91a93d1e ALSA: emu10k1: actually disassemble DSP instructions in /proc
fx8010_acode is supposed to be a human-readable representation; the
binary is already in fx8010_code.

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

Link: https://lore.kernel.org/r/20230529095504.559054-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-05 09:25:51 +02:00
Oswald Buddenhagen
67ff2add9e ALSA: emu10k1: fix writing 1st pointer-offset register set through /proc
The limits were appropriate only for the 2nd set.

FWIW, the channel count 4 for the 2nd set is suspicious as well - at
least P17V_PLAYBACK_FIFO_PTR actually has 8 channels, and comments on
HCFG2 hint at that as well. But all bitmasks are documented only for 4
channels. Anyway, rectifying that is out of scope for this patch.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230526101659.437969-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-05 09:25:22 +02:00
Oswald Buddenhagen
219153c6ed ALSA: emu10k1: hide absent 2nd pointer-offset register set from /proc
The 2nd register set belongs to the P16V chip (or embedded P17V module),
so there is nothing to show when no such part is present. Gen2 E-MU
cards have a P17V, but it's entirely unused, so we hide it there as
well.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230526101659.437969-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-05 09:25:02 +02:00
Uwe Kleine-König
c894ec016c ALSA: Switch i2c drivers back to use .probe()
After commit b8a1a4cd5a ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Link: https://lore.kernel.org/r/20230525203640.677826-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-05 09:22:45 +02:00
Mark Brown
b48aa6a357
ES8316 audio codec fixes on Rock5B
Merge series from Cristian Ciocaltea <cristian.ciocaltea@collabora.com>:

This patch series handles a few issues related to the ES8316 audio
codec, discovered while doing some testing on the Rock 5B board.
2023-05-30 20:41:29 +01:00
Bin Li
4ca110cab4 ALSA: hda/realtek: Enable headset onLenovo M70/M90
Lenovo M70/M90 Gen4 are equipped with ALC897, and they need
ALC897_FIXUP_HEADSET_MIC_PIN quirk to make its headset mic work.
The previous quirk for M70/M90 is for Gen3.

Signed-off-by: Bin Li <bin.li@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230524113755.1346928-1-bin.li@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-24 14:18:59 +02:00
Oswald Buddenhagen
0006fa2d3f ALSA: emu10k1: fix multi-channel capture config for E-MU cards
On SB cards the number of captured channels is derived from the voice
mask mixer control. But for E-MU cards this wasn't actually "wired up",
so changing the mask would simply mess up the recording.

We could fix that, but the channel routing through the FPGA makes the
masking redundant. So instead we hide the control, and let the user
specify the PCM channel count the traditional way.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230523200709.236059-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-24 12:13:02 +02:00
Oswald Buddenhagen
848ec6cf41 ALSA: emu10k1: don't restrict capture channel count to powers of two
The hardware can deal with primes up to 7 and power-of-two multiples
thereof; the limitation is reflected by the possible buffer sizes.

Note that setting the voice mask will not allow more than 16 channels
even on Sound Blaster Audigy anymore, as 32 seems a bit excessive (the
code overall appears to think so, just not in this case).

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230523200709.236059-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-24 12:13:01 +02:00
Oswald Buddenhagen
872e5b2b5e ALSA: emu10k1: fix support for 24 kHz capture
We need to specify that the hardware supports non-standard rates, as
otherwise the sound core creates a constraint which limits the rate to
the specified standard rates. That also made the rate constraint we were
already adding meaningless.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230523200709.236059-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-24 12:13:00 +02:00
Oswald Buddenhagen
d2baa153c3 ALSA: emu10k1: fix capture buffer size confusion
The buffer size register sets the size of the whole buffer, not just one
period. We actually handled it like that, except that the constraint was
set on the wrong parameter. The period size is implicitly constrained by
the buffer size and the fixed period count of 2.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230523200709.236059-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-24 12:12:59 +02:00
Oswald Buddenhagen
f4ab595039 ALSA: emu10k1: make channel count of multi-channel playback flexible
There is no reason to nail it to 16 channels.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230523200709.236023-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-24 12:10:30 +02:00
Oswald Buddenhagen
11ee59bdac ALSA: emu10k1: add synchronized start of multi-channel playback
We use independent voices for the channels, so we need to make an effort
to ensure that they are actually in sync.

The hardware doesn't provide atomicity, so we may need to retry a few
times, due to NMIs, PCI contention, and the wrong phase of the moon.

Solution inspired by kX-project.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230523200709.236023-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-24 12:10:29 +02:00
Oswald Buddenhagen
6dbecb9b51 ALSA: emu10k1: don't limit multi-channel playback to two periods
For unclear reasons, the extra voice was set up with half the buffer
size instead of the period size. Commit 27ae958cf6 ("emu10k1 driver -
add multichannel device hw:x,3 [2-8/8]") mentions half-loop interrupts,
so maybe this was an artifact of an earlier iteration of the patch.

While at it, also fix periods_min of the regular playback - one period
makes just no sense.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230523200709.236023-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-24 12:10:28 +02:00
Claudiu Beznea
2f3092e77f
ASoC: do not include pm_runtime.h if not used
Do not include pm_runtime.h header in files where APIs exported by
pm_runtime.h are not used.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com> # for omap-mcbsp-st.c
Link: https://lore.kernel.org/r/20230517094903.2895238-2-claudiu.beznea@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-05-23 13:55:55 +01:00
Oswald Buddenhagen
7195fb46da ALSA: emu10k1: pass raw FX send config to snd_emu10k1_pcm_init_voice()
... instead of passing in a high-level mixer struct. Let the
higher-level functions handle the differences between the voice types.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230523104612.198884-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-23 14:14:01 +02:00
Oswald Buddenhagen
f5192e3381 ALSA: emu10k1: introduce higher-level voice manipulation functions
This adds snd_emu10k1_pcm_init_{voices,extra_voice}() and
snd_emu10k1_playback_{un,}mute_voices() to slightly abstract by voice
function and potential stereo property.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230523104612.198884-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-23 14:13:38 +02:00
Niklas Schnelle
36a52ae64b ALSA: add HAS_IOPORT dependencies
In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. We thus need to add HAS_IOPORT as dependency for
those drivers using them.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230522105049.1467313-33-schnelle@linux.ibm.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-22 16:43:47 +02:00
Adam Stylinski
7843380d07 ALSA: hda/ca0132: add quirk for EVGA X299 DARK
This quirk is necessary for surround and other DSP effects to work
with the onboard ca0132 based audio chipset for the EVGA X299 dark
mainboard.

Signed-off-by: Adam Stylinski <kungfujesus06@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=67071
Link: https://lore.kernel.org/r/ZGopOe19T1QOwizS@eggsbenedict.adamsnet
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-22 08:26:01 +02:00
Gustavo A. R. Silva
4040fc51ca ALSA: mixart: Replace one-element arrays with simple object declarations
One-element arrays are deprecated, and we are replacing them with flexible
array members instead. However, in this case it seems those one-element
arrays have never actually been used as fake flexible arrays.

See this code that dates from Linux-2.6.12-rc2 initial git repository build
(commit 1da177e4c3 ("Linux-2.6.12-rc2")):

sound/pci/mixart/mixart_core.h:
 215 struct mixart_stream_state_req
 216 {
 217         u32                 delayed;
 218         u64                 scheduler;
 219         u32                 reserved4np[3];
 220         u32                 stream_count;  /* set to 1 for instance */
 221         struct mixart_flow_info  stream_info;   /* could be an array[stream_count] */
 222 } __attribute__((packed));

sound/pci/mixart/mixart.c:
 388
 389         memset(&stream_state_req, 0, sizeof(stream_state_req));
 390         stream_state_req.stream_count = 1;
 391         stream_state_req.stream_info.stream_desc.uid_pipe = stream->pipe->group_uid;
 392         stream_state_req.stream_info.stream_desc.stream_idx = stream->substream->number;
 393

So, taking the code above as example, replace multiple one-element
arrays with simple object declarations, and refactor the rest of the
code, accordingly.

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
routines on memcpy() and help us make progress towards globally
enabling -fstrict-flex-arrays=3 [1].

This results in no differences in binary output.

Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/296
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/ZGfiFjcL8+r3mayq@work
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-20 10:17:53 +02:00
Oswald Buddenhagen
a915d60426 ALSA: emu10k1: revamp playback voice allocator
Instead of separate voices, we now allocate non-interleaved channels,
which may in turn contain two interleaved voices each. The higher-level
code keeps only one pointer per channel. The channels are not allocated
in one block any more, as there is no reason to do that. As a
consequence of that, and because it is cleaner regardless, we now let
the allocator store these pointers at a specified location, rather than
returning only the first one and having the calling code deduce the
remaining ones.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140947.3725394-8-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-20 10:16:20 +02:00
Oswald Buddenhagen
b4fea2d3f2 ALSA: emu10k1: make snd_emu10k1_voice_alloc() assign voices' epcm
The voice allocator clearly knows about the field (it resets it), so
it's more consistent (and leads to less duplicated code) to have the
constructor take it as a parameter.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140947.3725394-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-20 10:16:03 +02:00
Oswald Buddenhagen
bdb3b567b8 ALSA: emu10k1: centralize freeing PCM voices
This saves some code duplication; no functional change.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230519184122.3808185-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-20 10:15:37 +02:00
Oswald Buddenhagen
82a9fa6e9e ALSA: emu10k1: make freeing untouched playback voices cheap
This allows us to drop the code that tries to preserve already allocated
voices upon repeated hw_param callback invocations. Getting it right for
multi-channel voices would otherwise get a bit hairy.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140947.3725394-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 16:55:56 +02:00
Oswald Buddenhagen
b840f8d8fc ALSA: emu10k1: improve voice status display in /proc
Eliminate the MIDI type, as there is no such thing - the MPU401 port
doesn't have anything to do with voices.

For clarity, differentiate between regular and extra voices.

Don't atomize the enum into bits in the table display.

Simplify/optimize the storage.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140947.3725394-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 16:49:09 +02:00
Oswald Buddenhagen
3eb5b1d0a1 ALSA: emu10k1: don't forget to reset reclaimed synth voices
The subsequent allocation may still fail after freeing some voices, so
we shouldn't leave them in their programmed state.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140947.3725394-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 16:49:08 +02:00
Oswald Buddenhagen
f26a4cf087 ALSA: emu10k1: simplify freeing synth voices
snd_emu10k1_voice_free() resets the hardware itself, so doing that
in the calling function as well is redundant.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140947.3725394-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 16:49:07 +02:00
Oswald Buddenhagen
fccd6f31a4 ALSA: emu10k1: enable bit-exact playback, part 4: send amounts
On Audigy, the send amounts are merely targets, presumably to avoid
sound distortion due to sudden changes, which the EMU8K docu explicitly
warns about.

However, that "soft-start" would prevent bit-for-bit reproduction, so
we now force the current send amounts to their final values at PCM
playback init.

One might want to do that for the MIDI synthesizer as well, though it
seems mostly pointless due to the attack phase each note has anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140339.3722279-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 16:41:59 +02:00
Oswald Buddenhagen
08e55ae996 ALSA: emu10k1: enable bit-exact playback, part 3: pitch
CPF_CURRENTPITCH starts swerving towards PTRX_PITCHTARGET as soon as
that is set. In practice this means that CPF_FRACADDRESS may acquire a
non-zero value before we manage to force CPF_CURRENTPITCH to the final
value, which would prevent bit-for-bit reproduction.

To avoid that this state persists, we now reset CPF_FRACADDRESS when
setting CPF_CURRENTPITCH, and to (mostly) avoid that it progresses too
far in the first place (possibly even reaching CCCA_CURRADDR), we write
PTRX and CPF in one critical section (though NMIs, etc. still make this
unreliable).

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140339.3722279-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 16:41:19 +02:00
Oswald Buddenhagen
5c2664cc09 ALSA: emu10k1: fix terminating synthesizer voices
Make terminate_voice() actually do at all what it's supposed to do:
instantly and completely shut down the note.

The bogus behavior was mostly harmless, as usually the voice is freed
right afterwards, which implicitly terminates it anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140339.3722308-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 16:40:22 +02:00
Oswald Buddenhagen
df335e9a8b ALSA: emu10k1: fix synthesizer sample playback position and caching
Compensate for the cache delay, and actually populate the cache.
Without these, the playback would start with garbage (which would be
(mostly?) masqueraded by the attack phase).

Unlike for the PCM voices, this doesn't try to compensate for the
interpolator read-ahead, because it's pointless to be super-exact here.

Note that this code is probably still broken for particularly short
samples, because we ignore the loop-related parts of CCR. But I'm not
going to reverse-engineer that now ...

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140339.3722308-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 16:39:46 +02:00
Tom Rix
816967d55f ALSA: emu10k1: set variables emu1010_routing_info and emu1010_pads_info storage-class-specifier to static
smatch reports
sound/pci/emu10k1/emumixer.c:519:39: warning: symbol
  'emu1010_routing_info' was not declared. Should it be static?
sound/pci/emu10k1/emumixer.c:859:36: warning: symbol
  'emu1010_pads_info' was not declared. Should it be static?

These variables are only used in their defining file, so it should be static

Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518123826.925752-1-trix@redhat.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 16:30:07 +02:00
Oswald Buddenhagen
46055699e5 ALSA: emu10k1: introduce and use snd_emu10k1_ptr_write_multiple()
While this nicely denoises the code, the real intent is being able to
write many registers pseudo-atomically, which will come in handy later.

Idea stolen from kX-project.

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

Link: https://lore.kernel.org/r/20230518093134.3697955-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 13:08:23 +02:00
Oswald Buddenhagen
6797400ef4 ALSA: emu10k1: fix handling of half-loop interrupts
We'd try to iterate the voices twice without resetting the pointer.
This went unnoticed, because the code isn't actually in use.

Amends 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/20230518093047.3697887-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 13:07:13 +02:00
Oswald Buddenhagen
9436f0151d ALSA: emu10k1: simplify interrupt handler, part 3
Handle the "timeout" (actually the retry counter) such that it's more
obvious and causes less cost in the normal case.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518093047.3697887-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 13:06:49 +02:00
Oswald Buddenhagen
016027741f ALSA: emu10k1: simplify interrupt handler, part 2
Remove weird INTE_* clearing code. The bits were a subset of the
actually handled interrupts, which kind of contradicted the stated
purpose. I suppose it would make sense to complete the set and negate
it, but interrupts being enabled out of the blue is neither something
that happens a lot, nor should it result in just one error message, IMO.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518093047.3697887-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 13:06:13 +02:00
Oswald Buddenhagen
583307bafb ALSA: emu10k1: simplify interrupt handler, part 1
IPR_CHANNELNUMBERMASK cannot be non-zero when IPR_CHANNELLOOP is unset,
so join marking them as handled.
This logically reverts part of commit f453e20d8a0 ("ALSA update
0.9.3a"), which made the inverse change with no explanation.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518093047.3697887-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 13:05:23 +02:00
Oswald Buddenhagen
0be0a62fd0 ALSA: emu10k1: fix PCM playback buffer size constraints
The period_bytes_min parameter and the buffer_bytes minimum constraint
made no sense at all, as they didn't reflect any hardware limitation.
Instead, apply a frame-based period_size minimum constraint, which is
derived from the cache size (it would be actually possible to go below
that, but it would require special handling, and it would be practically
impossible to keep up with the IRQ rate anyway).

Sync up the constraints of the EFX playback with those of the regular
playback, as there is no reason for them to diverge.

N.b., the maximum buffer size is actually arbitrary - the hardware could
go waay beyond 128 KiB.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518092224.3696958-9-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 13:04:05 +02:00
Oswald Buddenhagen
fa75064d92 ALSA: emu10k1: refactor PCM playback address handling
Pull the special handling of extra voices out of
snd_emu10k1_pcm_init_voice(), simplify snd_emu10k1_playback_pointer(),
and make the logic overall clearer. Also, add verbose comments.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230517174256.3657060-9-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 07:31:32 +02:00
Oswald Buddenhagen
9581128a21 ALSA: emu10k1: refactor PCM playback cache filling
Rename snd_emu10k1_playback_invalidate_cache() to the more apt
snd_emu10k1_playback_fill_cache(), and factor out
snd_emu10k1_playback_prepare_voices(), which calls the former for all
channels.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230517174256.3657060-8-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 07:31:01 +02:00
Oswald Buddenhagen
9e72666b9e ALSA: emu10k1: improve API of low-level voice manipulation functions
Originally, there was a 1:1 relationship between the PCM streams' and
the low-level voices' parameters. The addition of multi-channel playback
partially invalidated that, but didn't introduce proper layering, so
things kept working only by virtue of the multi-channel device never
having two channels (yet). The upcoming addition of 32-bit playback
would complete upending the relationships.

So this patch detaches the low-level parameters from the high-level
ones: we pass pre-calculated bit width and stereo flags to the low-level
manipulation functions instead of calculating them in-place from the
stream parameters.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230517174256.3657060-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 07:30:34 +02:00
Oswald Buddenhagen
5b1cd21f0f ALSA: emu10k1: fix PCM playback cache and interrupt handling
The cache causes a fixed delay regardless of stream parameters.
Consequently, all that "cache invalidate size" calculation stuff was
garbage (which can be traced right back to Creative's OSS driver).

This also removes the definitions of registers CD1..CDF, because they
are accessed only relative to CD0 anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230517174256.3657060-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 07:30:17 +02:00
Oswald Buddenhagen
cd6dceb197 ALSA: emu10k1: skip pointless cache setup for extra voices
Given that the data is going to be ignored anyway, and that the cache
does not influence interrupt timing (which is the purpose of the extra
voices), it's pointless to pre-fill the cache.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230517174256.3657060-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 07:30:06 +02:00
Oswald Buddenhagen
be3b7629e1 ALSA: emu10k1: remove pointless displacement of the extra voices
The idea is to make the extra voice lag behind the "real" voices, but
moving the buffer address around doesn't contribute to that, as the CCCA
write below uses the same address. The exact address is unimportant, as
the data is discarded anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230517174256.3657060-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 07:29:55 +02:00
Oswald Buddenhagen
1e5323bd77 Revert "ALSA: emu10k1 - delay the PCM interrupts (add pcm_irq_delay parameter)"
This workaround fails to address the underlying problem, which is
actually wholly self-made. Subsequent patches will fix it.

This reverts commit 56385a12d9.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230517174256.3657060-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 07:29:41 +02:00
Oswald Buddenhagen
af7fd0276e ALSA: emu10k1: pass frame instead of byte addresses
... to snd_emu10k1_pcm_init_voice(). This makes the code arguably less
convoluted.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230517174256.3657060-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-18 07:29:10 +02:00
Oswald Buddenhagen
9fe0731bc3 ALSA: emu10k1: remove runtime 64-bit divisions
32-bit platforms don't like these. As we're actually dealing with
constants, factor out the calculations and pass them in as additional
arguments. To keep the call sites clean, wrap the actual functions in
macros which generate the arguments.

Fixes: bb5ceb43b7 ("ALSA: emu10k1: fix non-zero mixer control defaults in highres mode")
Fixes: 1298bc978a ("ALSA: emu10k1: enable bit-exact playback, part 1: DSP attenuation")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202305171622.jKTovBvy-lkp@intel.com/
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Reported-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Closes: https://lore.kernel.org/r/CA+G9fYsShNP=LALHdMd-Btx3PBtO_CjyBNgpStr9fPGXNbRvdg@mail.gmail.com
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230517164800.3650699-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 22:10:57 +02:00
Oswald Buddenhagen
216abe45cf ALSA: emu10k1: make struct snd_emu1010 less wasteful
Shrink the {in,out}put_source arrays and their data type to what is
actually necessary.

To be still on the safe side, add some static asserts.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536508-11-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:07:59 +02:00
Oswald Buddenhagen
6f3609f8a3 ALSA: emu10k1: add explicit support for E-MU 0404
Unlike the other models, this is actually a distinct card, rather than
an E-MU 1010 with different "dongles". It is stereo only, and supports
no ADAT (there is no trace of ADAT in the manual, switching the output
mode to ADAT has no effect, and switching the input mode to ADAT just
breaks input (presumably ... my only ADAT source is the card's output)).

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536508-10-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:07:58 +02:00
Oswald Buddenhagen
f69d705d39 ALSA: emu10k1: improve mixer controls for E-MU 1010 rev2 card
This card has rather different inputs/outputs due to switching from the
AudioDock to the MicroDock.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536508-9-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:07:57 +02:00
Oswald Buddenhagen
97f1582e92 ALSA: emu10k1: make E-MU mixer control creation more data-driven
The more card models are handled separately, the more code duplication
this saves.

add_emu1010_source_mixers() is factored out the save duplication in a
later commit.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536508-8-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:07:56 +02:00
Oswald Buddenhagen
1fc710f06a ALSA: emu10k1: make E-MU I/O routing init data-driven
... and move it to the mixer init, as it's logically part of it.

As a side effect, this fixes the initial values of the input destination
mixer controls, which would have previously remained at "Silent" despite
different defaults. This didn't really matter, though, as ALSA state
restoration would hide that bug beyond first use.

Note that this completely does away with clearing the output routing
registers, as it was rather pointless - we just programmed the FPGA
(resetting it first if necessary), so everything is zeroed anyway
(that's documented by Xilinx, and as further evidence, some of the loops
terminated too early, and we didn't bother clearing the high channels of
the input routes at all, all with no observed adverse effects).

As a drive-by, this also fixes some capture channel defaults - any
EMU_SRC_*2 isn't a sensible value in 1x clock mode.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536508-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:07:55 +02:00
Oswald Buddenhagen
cc766807a2 ALSA: emu10k1: fix return value of snd_emu1010_dac_pads_put()
It returned zero even if the value had changed.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536508-6-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:07:55 +02:00
Oswald Buddenhagen
511cbe8f59 ALSA: emu10k1: un-hardcode E-MU mixer control callbacks somewhat
Instead of hard-coding the card-specific arrays and their sizes in each
function, use a more data-driven approach.

As a drive-by, also hide the unavailable I2S input destinations on the
1616 cardbus card.

Also as a drive-by, use more assignments at variable declaration for
brevity. This also removes the pointless masking of kctl.private_value.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536508-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:07:54 +02:00
Oswald Buddenhagen
536438f1de ALSA: emu10k1: make mixer control mass creation less wasteful
Define arrays of strings instead of snd_kcontrol_new.

While at it, move the E-MU source & destination enum defs next to their
hardware defs, which is a lot more logical and will come in handy in a
followup commit. And add some static asserts to verify that the array
sizes match.

This also applies the compactization from the previous commit to the
destination registers.
While reshuffling the arrays anyway, switch the order of the HAMOA_DAC
& HANA_SPDIF output destinations for the 1010 card, so they follow a
more regular pattern. This should have no functional impact.

The code is somewhat de-duplicated by the extraction of add_ctls().

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536508-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:07:53 +02:00
Oswald Buddenhagen
dc39bb3e4c ALSA: emu10k1: compactize E-MU routing source arrays
Use macros to avoid duplication. Arguably, this is somewhat less
legible, but future additions would grow this part of the file to
completely unmanageable dimensions.
The EMU*_COMMON_TEXTS macros will save duplication in a future commit;
I pulled them ahead to reduce churn.

While rewriting the tables anyway, rearrange them such that each card's
strings and registers are adjacent.

Also, add some static asserts to verify that the array sizes match.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536508-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:07:52 +02:00
Oswald Buddenhagen
9b00a1e9b1 ALSA: emu10k1: make some initializer arrays less wasteful
- Use bit fields in struct snd_emu_chip_details
- Use shorts in the E-MU routing register arrays

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536508-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:07:51 +02:00
Oswald Buddenhagen
51d652f458 ALSA: emu10k1: factor out snd_emu10k1_compose_audigy_sendamounts()
Saves a bit of code duplication.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536451-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:04:36 +02:00
Oswald Buddenhagen
77e067d0fa ALSA: emu10k1: skip needless setting of some voice registers
Many registers are meaningless for stereo slaves and the extra voices.
This patch cleans up these unnecessary register writes.

snd_emu10k1_playback_{trigger,stop}_voice() is not called for stereo
slaves any more.

snd_emu10k1_playback_prepare_voice() is renamed to
snd_emu10k1_playback_unmute_voice(), as this better reflects its
remaining function. It's not called for the extra voices any more.

Accordingly, snd_emu10k1_playback_mute_voice() is factored out from
snd_emu10k1_playback_stop_voice(), and is called selectively as well.

This doesn't add conditionals which would avoid initializing
sub-registers, as that wouldn't pull its weight.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536451-6-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:04:35 +02:00
Oswald Buddenhagen
35a60d1edf ALSA: emu10k1: rewire {en,dis}abling interrupts for PCM playback
We now enable ints even before triggering, and disable them only after
stopping - otherwise there is a race condition we may plausibly run into
when we pause/resume near the end of the buffer.

Updating the epcm->running flag is moved the same way, as it affects the
*_pointer() functions, which are called by the interrupt handler.

Also, factor these out to own functions, for clarity.

For multi-channel, the extra voice is now triggered after all regular
voices - we wouldn't want to receive an int before all channels have
passed the period boundary.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536451-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:04:34 +02:00
Oswald Buddenhagen
a61c695aee ALSA: emu10k1: remove useless resets of stop-on-loop-end bits
We initialize them at card init and don't touch them later, so there is
no need to reset them again at voice start.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536451-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:04:33 +02:00
Oswald Buddenhagen
94dabafea0 ALSA: emu10k1: cleanup envelope register init
We (rightfully) don't enable the envelope engine for PCM voices, so any
related setup is entirely pointless - the EMU8K documentation makes that
very clear, and the fact that the various open drivers all use different
values to no observable detriment pretty much confirms it.

The remaining initializations are regrouped for clarity.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536451-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:04:32 +02:00
Oswald Buddenhagen
155e3d3bf0 ALSA: emu10k1: straighten out FX send init
The mixer structures were filled in two places: on driver init, and when
the devices are opened. The latter made the former pointless, so we
remove the former. This implies that mixer dumps may now return all
zeroes, which is OK, as restoring them is meaningless as well.

Things were even weirder for the (generally unused) secondary sends:

Some of the initialization loops were forgotten when support for Audigy
was added, thus creating the technically illegal state of multiple sends
being routed to the same FX accumulator (though it apparently doesn't
matter when the amount is zero).

The global multi-channel init used some rather bizarre values for the
secondary sends, and the init on open actually forgot to re-initialize
them. We now use a not really more useful, but simpler formula.

The direct register init was also bogus. This doesn't really matter, as
the value is overwritten when a voice comes into use, but still.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536451-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 17:04:31 +02:00
Nikhil Mahale
dc4f2ccaed ALSA: hda: Add NVIDIA codec IDs a3 through a7 to patch table
These IDs are for AD102, AD103, AD104, AD106, and AD107 gpus with
audio functions that are largely similar to the existing ones.

Tested audio using gnome-settings, over HDMI, DP-SST and DP-MST
connections on AD106 gpu.

Signed-off-by: Nikhil Mahale <nmahale@nvidia.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230517090736.15088-1-nmahale@nvidia.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 16:57:43 +02:00
Arnd Bergmann
ccecefa4f8 ALSA: cs46xx: mark snd_cs46xx_download_image as static
snd_cs46xx_download_image() was originally called from dsp_spos.c, but
is now local to cs46xx_lib.c. Mark it as 'static' to avoid a warning
about it lacking a declaration, and '__maybe_unused' to avoid a warning
about it being unused when CONFIG_SND_CS46XX_NEW_DSP is disabled:

sound/pci/cs46xx/cs46xx_lib.c:534:5: error: no previous prototype for 'snd_cs46xx_download_image'

Fixes: 89f157d9e6 ("[ALSA] cs46xx - Fix PM resume")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230516195046.550584-1-arnd@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-17 16:56:00 +02:00
Takashi Iwai
3b44ec8c5c ALSA: hda: Fix Oops by 9.1 surround channel names
get_line_out_pfx() may trigger an Oops by overflowing the static array
with more than 8 channels.  This was reported for MacBookPro 12,1 with
Cirrus codec.

As a workaround, extend for the 9.1 channels and also fix the
potential Oops by unifying the code paths accessing the same array
with the proper size check.

Reported-by: Olliver Schinagl <oliver@schinagl.nl>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/64d95eb0-dbdb-cff8-a8b1-988dc22b24cd@schinagl.nl
Link: https://lore.kernel.org/r/20230516184412.24078-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-16 20:44:46 +02:00
Oswald Buddenhagen
bcdbd3b788 ALSA: emu10k1: enable bit-exact playback, part 2: voice attenuation
The voice volume is a raw fractional multiplier that can't actually
represent 1.0. To still enable real pass-through, we now set the volume
to 0.5 (which results in no loss of precision, as the FX bus provides
fractional values) and scale up the samples in DSP code.

To maintain backwards compatibility with existing configuration files,
we rescale the values in the mixer controls. The range is extended
upwards from 0xffff to 0x1fffd, which actually introduces the
possibility of specifying an amplification.

There is still a minor incompatibility with user space, namely if
someone loaded custom DSP code. They'll just get half the volume, so
this doesn't seem like a big deal.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230514170323.3408834-8-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-16 11:11:04 +02:00
Oswald Buddenhagen
1298bc978a ALSA: emu10k1: enable bit-exact playback, part 1: DSP attenuation
Fractional multiplication with the maximal value 2^31-1 causes some tiny
distortion. Instead, we want to multiply with the full 2^31. The catch
is of course that this cannot be represented in the DSP's signed 32 bit
registers.

One way to deal with this is to encode 1.0 as a negative number and
special-case it. As a matter of fact, the SbLive! code path already
contained such code, though the controls never actually exercised it.

A more efficient approach is to use negative values, which actually
extend to -2^31. Accordingly, for all the volume adjustments we now use
the MAC1 instruction which negates the X operand.

The range of the controls in highres mode is extended downwards, so -1
is the new zero/mute. At maximal excursion, real zero is not mute any
more, but I don't think anyone will notice this behavior change. ;-)

That also required making the min/max/values in the control structs
signed. This technically changes the user space interface, but it seems
implausible that someone would notice - the numbers were actually
treated as if they were signed anyway (and in the actual mixer iface
they _are_). And without this change, the min value didn't even make
sense in the first place (and no-one noticed, because it was always 0).

Tested-by: Jonathan Dowland <jon@dow.land>
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230514170323.3408834-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-15 22:06:21 +02:00
Oswald Buddenhagen
de0dc31070 ALSA: emu10k1: skip mic capture PCM for cards without AC97 codec
The microphone capture device is a feature of the AC97 codec, so its
availability should be coupled to the presence of that codec.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230514170323.3408834-6-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-15 22:06:20 +02:00
Oswald Buddenhagen
6175ccd1a9 ALSA: emu10k1: omit non-applicable mixer controls for E-MU cards
The E-MU cards don't try very hard to be Sound Blasters. All sound I/O
goes through the Hana FPGA, thus making the regular extin/out controls
useless. Still showing them just serves to clutter up the interface and
confuse the user.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230514170323.3408834-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-15 22:06:19 +02:00
Oswald Buddenhagen
1a38ae5796 ALSA: emu10k1: validate min/max values of translated controls
User space could pass arbitrary ranges, which were uncritically
accepted. This could lead to table lookups out of range.

I don't think that this is a security issue, as it only allowed someone
with CAP_SYS_ADMIN to crash the kernel, but still.

Setting an invalid translation mode will also be rejected now. That did
no harm, but it's still better to detect errors.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230514170323.3408834-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-15 22:06:19 +02:00
Oswald Buddenhagen
bb5ceb43b7 ALSA: emu10k1: fix non-zero mixer control defaults in highres mode
The default value needs to be scaled.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230514170323.3408834-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-15 22:06:18 +02:00
Oswald Buddenhagen
a746516d75 ALSA: emu10k1: polish audigy GPR allocation
- Pull ahead all fixed allocations, so we don't rely on the semi-
  dynamic ones not crossing the arbitrarily determined limit
- Use an enum for the fixed allocations
- Stop arbitrarily wasting registers on unexplained "reservations"
- Don't reserve two regs for the master volume control - it's mono

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230514170323.3408834-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-15 22:06:17 +02:00
Oswald Buddenhagen
2e9bd50f11 ALSA: emu10k1: optimize mask calculation in snd_emu10k1_ptr_read()
Unlike in snd_emu10k1_ptr_write(), we don't need to keep the value's
bits in place, so we can save one shift.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230514170323.3408798-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-15 22:00:56 +02:00
Oswald Buddenhagen
2093dcfc04 ALSA: emu10k1: merge common paths in snd_emu10k1_ptr_{read,write}()
Avoids some code duplication.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230514170323.3408798-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-15 22:00:56 +02:00
Oswald Buddenhagen
3676cd4bc8 ALSA: emu10k1: validate parameters of snd_emu10k1_ptr_{read,write}()
Rather than applying masks to the provided values, make assertions
about them being valid - otherwise we'd just try to paper over bugs.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230514170323.3408798-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-15 22:00:55 +02:00
Kai-Heng Feng
9dc68a4fe7 ALSA: hda/realtek: Fix mute and micmute LEDs for yet another HP laptop
There's yet 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/20230512083417.157127-1-kai.heng.feng@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-12 11:04:44 +02:00
Ryan C. Underwood
92553ee031 ALSA: hda/realtek: Apply HP B&O top speaker profile to Pavilion 15
The Pavilion 15 line has B&O top speakers similar to the x360 and
applying the same profile produces good sound.  Without this, the
sound would be tinny and underpowered without either applying
model=alc295-hp-x360 or booting another OS first.

Signed-off-by: Ryan Underwood <nemesis@icequake.net>
Fixes: 563785edfc ("ALSA: hda/realtek - Add quirk entry for HP Pavilion 15")
Link: https://lore.kernel.org/r/ZF0mpcMz3ezP9KQw@icequake.net
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-12 10:26:20 +02:00
Oswald Buddenhagen
59f038a09c ALSA: emu10k1: simplify tone control switch DSP code
Instead of using lots of instructions to mix wet and dry signals,
simply skip over the whole code block if tone control is disabled.
This also allows us doing away with the "shadow" playback channels.

Tested-by: Jonathan Dowland <jon@dow.land>
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230510173917.3073107-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-12 09:17:38 +02:00
Oswald Buddenhagen
f549466b8b ALSA: emu10k1: apply channel delay hack to all E-MU cards
Evidently, the channel delay bug exists in all E-MU cards; it's in the
Hana FPGA program, and was never fixed.

Note that the implementation is somewhat lazy - to localize the code
paths, we actually waste a GPR and a DSP instruction by keeping two
delay registers for the same physical source.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230510173917.3073107-6-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-12 09:17:18 +02:00
Oswald Buddenhagen
4c7bfbcf75 ALSA: emu10k1: simplify snd_emu10k1_audigy_dsp_convert_32_to_2x16()
Instead of spending lots of instructions on masking and transplanting
the sign bit, sidestep the issue by replacing the last bit shift with
a wrapping addition to self.

Solution stolen from kX-project, after I pondered other ideas first.

Also, the function really doesn't need to return a constant int value.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230510173917.3073107-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-12 09:17:04 +02:00
Oswald Buddenhagen
4102ac2975 ALSA: emu10k1: fix+optimize E-MU stereo capture DSP code
Presumably, JDC added the seemingly superfluous indirection over the
temporary register because without it he'd get only zero readings.
However, switching the X and Y operands (or using EMU32 as the A
operand in the temporary load) works just fine. Presumably a DSP bug?

The original code was also actually buggy, though: both channels used
the left volume control.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230510173917.3073107-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-12 09:16:54 +02:00
Oswald Buddenhagen
8cabf83c7a ALSA: emu10k1: roll up loops in DSP setup code for Audigy
There is no apparent reason for the massive code duplication.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230510173917.3073107-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-12 09:16:40 +02:00
Oswald Buddenhagen
2a3fa40aef ALSA: emu10k1: make tone control switch mono
It controls the whole surround set, so stereo can't work. As a
consequence, only the left channel was paid attention to.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230510173917.3073107-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-12 09:16:31 +02:00
Oswald Buddenhagen
a8661af513 ALSA: emu10k1: don't create regular S/PDIF controls for E-MU cards
These ports are unused on these cards.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230510173722.3072439-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-12 08:58:41 +02:00
Alexandru Sorodoc
4b963ae1df ALSA: hda/realtek: Add quirks for ASUS GU604V and GU603V
These models use 2 CS35L41 amplifiers using SPI for down-facing
speakers.

alc285_fixup_speaker2_to_dac1 is needed to fix volume control of the
down-facing speakers.

Pin configs are needed to enable headset mic detection.

Note that these models lack the ACPI _DSD properties needed to
initialize the amplifiers. They can be added during boot to get working
sound out of the speakers:
  https://gist.github.com/lamperez/862763881c0e1c812392b5574727f6ff

Signed-off-by: Alexandru Sorodoc <ealex95@gmail.com>
Link: https://lore.kernel.org/r/20230511161510.315170-1-ealex95@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-11 18:59:34 +02:00
Vitaly Rodionov
3e10f6ca76 ALSA: hda/realtek: Add quirk for HP EliteBook G10 laptops
Add support for HP EliteBook 835/845/845W/865 G10 laptops
with CS35L41 amplifiers on I2C/SPI 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/20230510142227.32945-1-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-11 18:02:41 +02:00
Oswald Buddenhagen
946233bb23 ALSA: emu10k1: minor E-MU naming fixups
- Fix mixer source port names. These will require some users to
  re-adjust their mixer settings, which seems acceptable:
  - The S/PDIF port is on the main 1010 card, not the 0202 daughter card
  - The 1616m CardBus card has all inputs on the dock, so there is
    no point in specifying it
  - Conversely, the 1010 card has "dispersed" inputs, so say where the
    ADAT port is, consistently with the S/PDIF port
- The 1616m CardBus card is actually named E-MU 02 (due to the headphone
  output jack it has)
- Fix capitalization of "E-MU"

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230428095941.1706335-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-08 09:33:08 +02:00