Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: dchristensen8 <dchristensen8@proton.me>
Cc: "tiwai@suse.com" <tiwai@suse.com>,
	"perex@perex.cz" <perex@perex.cz>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"linux-sound@vger.kernel.org" <linux-sound@vger.kernel.org>
Subject: Re: [PATCH v2] ALSA: hda/ca0132: Add Sound BlasterX AE-5 external RGB LED strip support
Date: Fri, 02 Oct 2026 16:31:42 +0200	[thread overview]
Message-ID: <87ik3kyy0h.wl-tiwai@suse.de> (raw)
In-Reply-To: <I690osvh2wujN3P04R4abtKFqOqtIiC-qin2ZEFs9q8kKU7-qfIg2cya4BuHS7Vg83Wkon6BCJGtVIxeJVfRZ8nG07laTUlv-fJjELMgp1Y=@proton.me>

On Fri, 02 Oct 2026 03:41:50 +0200,
dchristensen8 wrote:
> 
> 
> Takashi,
> 
> Thank you for your assistance on this! I updated it to use CLASS
> (snd_hda_power_pm, pm)(codec) for the power management call, which cleaned up
> all the manual power-down error exits nicely.
> 
> Attached is the proper v2 patch for upstreaming.

Now reviewing further in details, and some issues found:

> --- a/sound/hda/codecs/ca0132.c
> +++ b/sound/hda/codecs/ca0132.c
> @@ -35,6 +35,8 @@
>  #include <sound/tlv.h>
>  #endif
>  
> +#include <linux/dma-mapping.h>

Let's move this into the block with other header file inclusions.
Not needed to be alone here.


> +static struct hdac_stream *ae5_strip_find_stream(struct hda_codec *codec)
> +{
> +	struct ca0132_spec *spec = codec->spec;
> +	struct hdac_bus *bus = &codec->bus->core;
> +	struct hdac_stream *s, *dsp = NULL, *first = NULL;
> +
> +	guard(spinlock_irqsave)(&bus->reg_lock);
> +	list_for_each_entry(s, &bus->stream_list, list) {
> +		if (s->direction != SNDRV_PCM_STREAM_PLAYBACK)
> +			continue;
> +		if (s->running || s->locked)
> +			continue;

It should also check s->opened, too.

> +	for (;;) {
> +		hstr = ae5_strip_find_stream(codec);
> +		if (!hstr) {
> +			if (--retries <= 0) {
> +				codec_warn(codec, "AE5 strip: no free azx stream after retries\n");
> +				return -EBUSY;
> +			}
> +			usleep_range(5000, 10000);
> +			continue;
> +		}
> +
> +		stream_tag = snd_hdac_dsp_prepare(hstr, format, AE5_STRIP_DMA_SIZE, &dmab);

The function needs CONFIG_SND_HDA_DSP_LOADER, and it's not always
selected.  Although the compile would works, it makes no sense to keep
the code without the support code.


> +static int ae5_strip_ctl_put(struct snd_kcontrol *kcontrol,
> +			     struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
> +	struct ca0132_spec *spec = codec->spec;
> +	u32 colors[AE5_STRIP_MAX_LEDS];
> +	int i, num_leds;
> +
> +	guard(mutex)(&spec->ae5_strip_mutex);
> +	num_leds = spec->ae5_strip_cur_num_leds;
> +	for (i = 0; i < num_leds; i++) {
> +		u8 r = ucontrol->value.bytes.data[i * 3 + 0];
> +		u8 g = ucontrol->value.bytes.data[i * 3 + 1];
> +		u8 b = ucontrol->value.bytes.data[i * 3 + 2];
> +
> +		colors[i] = ((u32)g << 16) | ((u32)r << 8) | (u32)b;
> +	}
> +	memcpy(spec->ae5_strip_cur_colors, colors, sizeof(u32) * num_leds);
> +	ae5_strip_send_frame(codec, colors, num_leds);
> +	return 0;

In general, the put callback should return 1 if the values are
modified.


thanks,

Takashi

  reply	other threads:[~2026-10-02 14:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02  1:41 [PATCH v2] ALSA: hda/ca0132: Add Sound BlasterX AE-5 external RGB LED strip support dchristensen8
2026-10-02 14:31 ` Takashi Iwai [this message]
2026-10-03  1:41   ` dchristensen8
2026-10-04 18:26     ` 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=87ik3kyy0h.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=dchristensen8@proton.me \
    --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