From: "Cássio Gabriel" <cassiogabrielcontato@gmail.com>
To: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
"Cássio Gabriel" <cassiogabrielcontato@gmail.com>
Subject: [PATCH v2 2/3] ALSA: tea6330t: add mixer state restore helper
Date: Tue, 07 Apr 2026 12:35:42 -0300 [thread overview]
Message-ID: <20260407-alsa-interwave-pm-v2-2-8dd96c6129e9@gmail.com> (raw)
In-Reply-To: <20260407-alsa-interwave-pm-v2-0-8dd96c6129e9@gmail.com>
The InterWave STB variant uses a TEA6330T mixer on its private
I2C bus. The mixer state is cached in software, but there is no
helper to push that register image back to hardware after system
resume.
Add a small restore helper that reapplies the cached TEA6330T
register image to the device so board drivers can restore the
external mixer state as part of their PM resume path.
Take snd_i2c_lock() around the full device lookup and restore
sequence so the bus device list traversal is also protected.
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
---
include/sound/tea6330t.h | 1 +
sound/i2c/tea6330t.c | 39 ++++++++++++++++++++++++++++++++++++++-
2 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/include/sound/tea6330t.h b/include/sound/tea6330t.h
index 1c77b78f6533..3a34033d2aa3 100644
--- a/include/sound/tea6330t.h
+++ b/include/sound/tea6330t.h
@@ -12,5 +12,6 @@
int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer);
int snd_tea6330t_update_mixer(struct snd_card *card, struct snd_i2c_bus *bus,
int equalizer, int fader);
+int snd_tea6330t_restore_mixer(struct snd_i2c_bus *bus);
#endif /* __SOUND_TEA6330T_H */
diff --git a/sound/i2c/tea6330t.c b/sound/i2c/tea6330t.c
index 5341907b85d1..39c5e87c6ab0 100644
--- a/sound/i2c/tea6330t.c
+++ b/sound/i2c/tea6330t.c
@@ -356,5 +356,42 @@ int snd_tea6330t_update_mixer(struct snd_card *card,
snd_i2c_device_free(device);
return err;
}
-
EXPORT_SYMBOL(snd_tea6330t_update_mixer);
+
+int snd_tea6330t_restore_mixer(struct snd_i2c_bus *bus)
+{
+ struct snd_i2c_device *device;
+ struct tea6330t *tea;
+ unsigned char bytes[7];
+ unsigned int idx;
+ int err;
+
+ if (!bus)
+ return -EINVAL;
+
+ snd_i2c_lock(bus);
+ list_for_each_entry(device, &bus->devices, list) {
+ if (device->addr != TEA6330T_ADDR)
+ continue;
+
+ tea = device->private_data;
+ if (!tea) {
+ err = -EINVAL;
+ goto unlock;
+ }
+
+ bytes[0] = TEA6330T_SADDR_VOLUME_LEFT;
+ for (idx = 0; idx < 6; idx++)
+ bytes[idx + 1] = tea->regs[idx];
+ err = snd_i2c_sendbytes(device, bytes, 7);
+ err = err < 0 ? err : 0;
+ goto unlock;
+ }
+
+ err = -ENODEV;
+
+unlock:
+ snd_i2c_unlock(bus);
+ return err;
+}
+EXPORT_SYMBOL(snd_tea6330t_restore_mixer);
--
2.53.0
next prev parent reply other threads:[~2026-04-07 15:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 15:35 [PATCH v2 0/3] ALSA: add suspend/resume support for InterWave ISA cards Cássio Gabriel
2026-04-07 15:35 ` [PATCH v2 1/3] ALSA: tea6330t: move snd_tea6330t_detect() EXPORT_SYMBOL Cássio Gabriel
2026-04-07 15:35 ` Cássio Gabriel [this message]
2026-04-07 15:35 ` [PATCH v2 3/3] ALSA: interwave: add ISA and PnP suspend and resume callbacks Cássio Gabriel
2026-04-08 8:51 ` [PATCH v2 0/3] ALSA: add suspend/resume support for InterWave ISA cards Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260407-alsa-interwave-pm-v2-2-8dd96c6129e9@gmail.com \
--to=cassiogabrielcontato@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox