From: Takashi Iwai <tiwai@suse.de>
To: Nick Weihs <nick.weihs@gmail.com>
Cc: tiwai@suse.com, lsa-devel@alsa-project.org,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: hda/realtek: Implement sound init sequence for Samsung Galaxy Book3 Pro 360
Date: Mon, 22 Jul 2024 14:57:42 +0200 [thread overview]
Message-ID: <87zfq9oa7t.wl-tiwai@suse.de> (raw)
In-Reply-To: <CAGKKx0-FRCbeS5CTQfoe3Zqw9BH6Wws1ch_XhyzxaP_s2z+OqA@mail.gmail.com>
On Mon, 22 Jul 2024 02:10:59 +0200,
Nick Weihs wrote:
>
> Samsung Galaxy Book3 Pro 360 sends a large amount of data to the codec
> through hda processing coefficients. This data was captured using a
> modified version of QEMU, but the actual content of the data remains
> opaque to me. Elliding any part of the data seems to cause sound to
> not work.
>
> Signed-off-by: Nick Weihs <nick.weihs@gmail.com>
Thanks for the patch. However, the patch isn't cleanly applicable as
your mailer seems breaking spaces. Please try to fix the mailer setup
(at best use git-send-email) or use attachment as the last resort.
About the code change:
> +static inline void alc298_samsung_write_coef_pack2(struct hda_codec *codec,
> + const unsigned short coefs[4])
Passing the fixed size array as an argument is hard to read and
error-prone. Better to define a struct instead?
> +{
> + int i;
> +
> + for (i = 0; i < 100; i++) {
> + if ((alc_read_coef_idx(codec, 0x26) & 0x0010) == 0)
> + break;
> + }
This loop looks unreliable. Usually this kind of loop should have
some delay and/or timeout as the break out condition.
> +static void alc298_fixup_samsung_amp2(struct hda_codec *codec,
> + const struct hda_fixup *fix, int action)
> +{
> + int i;
> + static const struct alc298_samsung_coeff_fixup_desc fixups1[] = {
> + { 0x99, 0x8000 }, { 0x82, 0x4408 }, { 0x32, 0x3f00 }, { 0x0e, 0x6f80 },
> + { 0x10, 0x0e21 }, { 0x55, 0x8000 }, { 0x08, 0x2fcf }, { 0x08, 0x2fcf },
> + { 0x2d, 0xc020 }, { 0x19, 0x0017 }, { 0x50, 0x1000 }, { 0x0e, 0x6f80 },
> + { 0x08, 0x2fcf }, { 0x80, 0x0011 }, { 0x2b, 0x0c10 }, { 0x2d, 0xc020 },
> + { 0x03, 0x0042 }, { 0x0f, 0x0062 }, { 0x08, 0x2fcf },
> + };
> +
> + static const unsigned short amp_0x38[][4] = {
> + { 0x2000, 0x0000, 0x0001, 0xB011 }, { 0x23FF, 0x0000, 0x0000, 0xB011 },
> + { 0x203A, 0x0000, 0x0080, 0xB011 }, { 0x23E1, 0x0000, 0x0000, 0xB011 },
(snip)
Such a bulk of data is usually put into another file, and included
from patch_realtek.c. Otherwise the code becomes too clumsy.
See sound/pci/hda/*_helper.c files as examples.
Also, we prefer the lower alphabet for hex numbers.
> + ///// First set of fixups
Too many slashes. Just use '//'.
Last but not least, try to fix coding-style issues reported by
scripts/checkpatch.pl.
thanks,
Takashi
prev parent reply other threads:[~2024-07-22 12:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-22 0:10 [PATCH] ALSA: hda/realtek: Implement sound init sequence for Samsung Galaxy Book3 Pro 360 Nick Weihs
2024-07-22 12:57 ` Takashi Iwai [this message]
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=87zfq9oa7t.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=lsa-devel@alsa-project.org \
--cc=nick.weihs@gmail.com \
--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