mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Li <nick.li@foursemi.com>
To: Mark Brown <broonie@kernel.org>
Cc: lgirdwood@gmail.com, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, perex@perex.cz, tiwai@suse.com,
	xiaoming.yang@foursemi.com, danyang.zheng@foursemi.com,
	like.xy@foxmail.com, linux-sound@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/4] ASoC: codecs: Add FourSemi FS2104/5S audio amplifier driver
Date: Thu, 10 Jul 2025 16:57:03 +0800	[thread overview]
Message-ID: <61B23934F28A9F2C+aG-AXznikkHb2_jR@foursemi.com> (raw)
In-Reply-To: <aG5Smt_DErSq5WjE@finisterre.sirena.org.uk>

On Wed, Jul 09, 2025 at 12:29:30PM +0100, Mark Brown wrote:
> On Tue, Jul 08, 2025 at 07:29:01PM +0800, Nick Li wrote:
> 
> > The FS2104/5S are FourSemi digital audio amplifiers
> > with I2C control. They are Inductor-Less, Stereo, Closed-Loop,
> > Digital Input Class-D Power Amplifiers with Enhanced Signal Processing.
> 
> This looks broadly OK - there's a few more fairly small issues below in
> addition to those that Krzysztof flagged.
> 
> > +static int fs210x_set_pcm_volume(struct fs210x_priv *fs210x)
> > +{
> > +	u16 vol[2];
> > +	int ret;
> > +
> > +	if (fs210x->devid == FS2105S_DEVICE_ID) {
> 
> A swtich statement is better style here, it makes it easier to add more
> variants.

Good idea.

> 
> > +	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
> 
> _CLOCK_PROVIDER_MASK
> 
> > +	case SND_SOC_DAIFMT_CBC_CFC:
> > +		/* Only supports slave mode */
> 
> consumer mode.

You had metioned in v1, will fix next version.

> 
> > +		dev_err(fs210x->dev, "Only supports slave mode\n");
> 
> consumer mode.

Got it.

> 
> > +static int fs210x_dai_hw_params(struct snd_pcm_substream *substream,
> > +				struct snd_pcm_hw_params *params,
> > +				struct snd_soc_dai *dai)
> > +{
> > +	struct fs210x_priv *fs210x;
> > +	int chn_num;
> > +	int ret;
> > +
> > +	if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
> > +		return 0;
> 
> There's no configuration for capture?  Should the driver be setting
> symmetric_rates and then not reconfiguring if active instead, it looks a
> lot like the driver is relying on userspace starting playback before
> capture to configure?

In capture path:
The device can output EC reference signal for AEC,
it can't output the signal without playing audio(start device in playback).
We had set symmetric_rates = 1 in fs210x_dai

> 
> > +static int fs210x_pcm_volume_put(struct snd_kcontrol *kcontrol,
> > +				 struct snd_ctl_elem_value *ucontrol)
> > +{
> 
> > +	fs210x->vol[0] = (u16)*pval;
> > +	fs210x->vol[1] = (u16)*(pval + 1);
> > +	dev_dbg(fs210x->dev, "Set volume: %d-%d\n",
> > +		fs210x->vol[0], fs210x->vol[1]);
> > +
> 
> The driver should return 1 if there's a change in the values and 0
> otherwise (plus it can skip a bunch of work if there's nothing to do).
> 
> The mixer-test test will spot this for you.

BTW, what's the mixer-test? We tested it by using alsamixer and amixer.

> 
> > +static int fs210x_effect_scene_put(struct snd_kcontrol *kcontrol,
> > +				   struct snd_ctl_elem_value *ucontrol)
> > +{
> 
> > +	ret = fs210x_set_scene(fs210x, scene_id);
> > +	if (ret)
> > +		dev_err(fs210x->dev, "Failed to set scene: %d\n", ret);
> > +
> > +	mutex_unlock(&fs210x_mutex);
> > +
> > +	return ret;
> 
> Same issue with flagging changes.

Got it, we will update what you mentioned in here and previous mail,
the next version may need to test for a few days, I'm sorry for my late response.

Thanks.

Best regards,
Nick




  reply	other threads:[~2025-07-10  8:58 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-03  3:56 [PATCH v1 0/4] ASoC: codecs: Add support for FourSemi FS2104/5S Nick
2025-07-03  3:56 ` [PATCH v1 1/4] ASoC: codecs: Add library for FourSemi audio amplifiers Nick
2025-07-03  3:56 ` [PATCH v1 2/4] ASoC: codecs: Add FourSemi FS2104/5S audio amplifier driver Nick
2025-07-03 14:59   ` Mark Brown
2025-07-04 11:12     ` Nick Li
2025-07-04 14:37       ` Mark Brown
2025-07-07  8:34         ` Nick Li
2025-07-07 20:42           ` Mark Brown
2025-07-03  3:56 ` [PATCH v1 3/4] ASoC: dt-bindings: Add dt bindings for FS2104/5S audio amplifiers Nick
2025-07-03  5:48   ` Rob Herring (Arm)
2025-07-03  6:36   ` Krzysztof Kozlowski
2025-07-04  6:00     ` Nick Li
2025-07-03  7:10   ` Krzysztof Kozlowski
2025-07-03  7:15     ` Krzysztof Kozlowski
2025-07-04  7:26       ` Nick Li
2025-07-04  7:18     ` Nick Li
2025-07-03  3:56 ` [PATCH v1 4/4] dt-bindings: vendor-prefixes: Add Shanghai FourSemi Semiconductor Co.,Ltd Nick
2025-07-03  5:48   ` Rob Herring (Arm)
2025-07-08 11:28 ` [PATCH v2 0/4] ASoC: codecs: Add support for FourSemi FS2104/5S Nick Li
2025-07-08 11:28   ` [PATCH v2 1/4] dt-bindings: vendor-prefixes: Add Shanghai FourSemi Semiconductor Co.,Ltd Nick Li
2025-07-09 10:36     ` Krzysztof Kozlowski
2025-07-08 11:28   ` [PATCH v2 2/4] ASoC: dt-bindings: Add schema for FS2104/5S audio amplifiers Nick Li
2025-07-09 10:40     ` Krzysztof Kozlowski
2025-07-10  8:11       ` Nick Li
2025-07-10  8:27         ` Krzysztof Kozlowski
2025-07-10  9:26           ` Nick Li
2025-07-09 10:42     ` Krzysztof Kozlowski
2025-07-10  8:02       ` Nick Li
2025-07-08 11:29   ` [PATCH v2 3/4] ASoC: codecs: Add library for FourSemi " Nick Li
2025-07-08 11:29   ` [PATCH v2 4/4] ASoC: codecs: Add FourSemi FS2104/5S audio amplifier driver Nick Li
2025-07-09 10:55     ` Krzysztof Kozlowski
2025-07-10  7:56       ` Nick Li
2025-07-10  8:27         ` Krzysztof Kozlowski
2025-07-10 11:20           ` Nick Li
2025-07-09 11:29     ` Mark Brown
2025-07-10  8:57       ` Nick Li [this message]
2025-07-10  9:29         ` Mark Brown

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=61B23934F28A9F2C+aG-AXznikkHb2_jR@foursemi.com \
    --to=nick.li@foursemi.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=danyang.zheng@foursemi.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=like.xy@foxmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --cc=tiwai@suse.com \
    --cc=xiaoming.yang@foursemi.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

all inboxes | Powered by JetHome®