summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/aw88261.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2026-08-18 08:35:39 +0200
committerTakashi Iwai <tiwai@suse.de>2026-08-18 08:35:39 +0200
commitb2b82ce1478eddd614a727e000180de95c53520d (patch)
tree7ee06997947dc08dc26bdaeb4b0901e5e7a6df50 /sound/soc/codecs/aw88261.c
parentff722d025853a33a15b080459e4c52be28d44b6e (diff)
parent0c7aeb0f5eceb95b5887bd8e83fef865e5a49a13 (diff)
Merge tag 'asoc-v7.3' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Updates for v7.3 A very busy release, a combination of a lot of new device work and more people than usual doing various subsystem wide improvements in the code. The main subsystem level change is the work Morimoto-san has been doing to get automatic DAI format selection more widely deployed, and even that is largely changes in the drivers to enable use of the feature rather than framework work. - Conversions of a lot of drivers to use the automatic DAI format selection code from Morimoto-san. - Many fixes and code improvements from bui duc phuc and Morimoto-san. - Fixes for ordering problems in register default tables from Peter Ujfalusi. - Changes to use auto-cleanup for firmware to improve robustness from Takashi Iwai. - Support for firmware on more Awinc devices. - Many changes in the Qualcomm driver stack, mostly around new platform support. - Support for AMD ACP7.B/F, Cirrus Logic CS35L62, Loongson 2K0300, Meson GX formatter and interface, Qualcomm LPI MI2S, SM8475 and WSA855 and Realtek RT1321 VA1/2 and RT766/7.
Diffstat (limited to 'sound/soc/codecs/aw88261.c')
-rw-r--r--sound/soc/codecs/aw88261.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/sound/soc/codecs/aw88261.c b/sound/soc/codecs/aw88261.c
index 549783d3e75e..b8d06534bc8f 100644
--- a/sound/soc/codecs/aw88261.c
+++ b/sound/soc/codecs/aw88261.c
@@ -8,6 +8,7 @@
// Author: Weidong Wang <wangweidong.a@awinic.com>
//
+#include <linux/cleanup.h>
#include <linux/i2c.h>
#include <linux/firmware.h>
#include <linux/bitops.h>
@@ -206,10 +207,10 @@ static int aw88261_dev_check_sysst(struct aw_device *aw_dev)
return ret;
check_val = reg_val & (~AW88261_BIT_SYSST_CHECK_MASK)
- & AW88261_BIT_SYSST_CHECK;
- if (check_val != AW88261_BIT_SYSST_CHECK) {
+ & AW88261_BIT_PLL_CHECK;
+ if (check_val != AW88261_BIT_PLL_CHECK) {
dev_dbg(aw_dev->dev, "check sysst fail, reg_val=0x%04x, check:0x%x",
- reg_val, AW88261_BIT_SYSST_CHECK);
+ reg_val, AW88261_BIT_PLL_CHECK);
usleep_range(AW88261_2000_US, AW88261_2000_US + 10);
} else {
return 0;
@@ -960,11 +961,10 @@ static int aw88261_profile_set(struct snd_kcontrol *kcontrol,
int ret;
/* pa stop or stopping just set profile */
- mutex_lock(&aw88261->lock);
+ guard(mutex)(&aw88261->lock);
ret = aw88261_dev_set_profile_index(aw88261->aw_pa, ucontrol->value.integer.value[0]);
if (ret) {
dev_dbg(codec->dev, "profile index does not change");
- mutex_unlock(&aw88261->lock);
return 0;
}
@@ -973,8 +973,6 @@ static int aw88261_profile_set(struct snd_kcontrol *kcontrol,
aw88261_start(aw88261);
}
- mutex_unlock(&aw88261->lock);
-
return 1;
}
@@ -1038,7 +1036,7 @@ static int aw88261_playback_event(struct snd_soc_dapm_widget *w,
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component);
- mutex_lock(&aw88261->lock);
+ guard(mutex)(&aw88261->lock);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
aw88261_start(aw88261);
@@ -1049,7 +1047,6 @@ static int aw88261_playback_event(struct snd_soc_dapm_widget *w,
default:
break;
}
- mutex_unlock(&aw88261->lock);
return 0;
}
@@ -1152,7 +1149,7 @@ static int aw88261_dev_init(struct aw88261 *aw88261, struct aw_container *aw_cfg
static int aw88261_request_firmware_file(struct aw88261 *aw88261)
{
- const struct firmware *cont = NULL;
+ const struct firmware *cont __free(firmware) = NULL;
struct aw_container *aw_cfg;
const char *fw_name;
int ret;
@@ -1172,13 +1169,11 @@ static int aw88261_request_firmware_file(struct aw88261 *aw88261)
fw_name, cont ? cont->size : 0);
aw_cfg = devm_kzalloc(aw88261->aw_pa->dev, struct_size(aw_cfg, data, cont->size), GFP_KERNEL);
- if (!aw_cfg) {
- release_firmware(cont);
+ if (!aw_cfg)
return -ENOMEM;
- }
+
aw_cfg->len = (int)cont->size;
memcpy(aw_cfg->data, cont->data, cont->size);
- release_firmware(cont);
aw88261->aw_cfg = aw_cfg;
@@ -1188,12 +1183,12 @@ static int aw88261_request_firmware_file(struct aw88261 *aw88261)
return ret;
}
- mutex_lock(&aw88261->lock);
- /* aw device init */
- ret = aw88261_dev_init(aw88261, aw88261->aw_cfg);
- if (ret)
- dev_err(aw88261->aw_pa->dev, "dev init failed");
- mutex_unlock(&aw88261->lock);
+ scoped_guard(mutex, &aw88261->lock) {
+ /* aw device init */
+ ret = aw88261_dev_init(aw88261, aw88261->aw_cfg);
+ if (ret)
+ dev_err(aw88261->aw_pa->dev, "dev init failed");
+ }
return ret;
}