[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180529121746.GH23509@sirena.org.uk>
Date: Tue, 29 May 2018 13:17:46 +0100
From: Mark Brown <broonie@...nel.org>
To: Steven Eckhoff <steven.eckhoff.opensource@...il.com>
Cc: alsa-devel@...a-project.org, Liam Girdwood <lgirdwood@...il.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, linux-kernel@...r.kernel.org
Subject: Re: [alsa-devel][PATCH v1] ASoC: TSCS454: Add Support
On Tue, May 29, 2018 at 05:52:00AM -0500, Steven Eckhoff wrote:
> +static char const * const in_bst_txt[] = {
> + "0 dB", "10 dB", "20 dB", "30 dB"};
> +
This looks like just a regular volume control, it should be a normal
SOC_SINGLE_TLV().
> + SOC_SINGLE("Input Channel 1 Mute En",
> + R_ICTL0, FB_ICTL0_IN1MUTE, 1, 0),
All these En controls (I'm guessing Enable?) are just simple on/off
controls and should end in Switch as per ControlNames.txt.
> + /* R_ICH0VOL PG 1 ADDR 0x12 */
> + SOC_SINGLE_TLV("Input Channel 0", R_ICH0VOL,
> + FB_ICHVOL_ICHVOL, FM_ICHVOL_ICHVOL, 0, in_vol_tlv_arr),
All volume controls should end in Volume.
> +static int tscs454_hw_params(struct snd_pcm_substream *substream,
> + struct snd_pcm_hw_params *params,
> + struct snd_soc_dai *dai)
> +{
> + struct snd_soc_component *component = dai->component;
> + struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component);
> + unsigned int fs = params_rate(params);
> + mutex_lock(&aif->lock);
> + config_aif = aif->users == 0;
> + aif->users++;
> + mutex_unlock(&aif->lock);
> +
> + if (!config_aif)
> + return 0;
We silently ignore attempts to configure the parameters? That's broken,
userspace won't know. You should be setting more of the symmetry flags
on the DAIs (for things that are relevant) and returning an error if
there's an attempt to configure an incompatible parameter.
> + mutex_lock(&tscs454->active_aifs_lock);
> + res_ir_pll = tscs454->active_aifs == 0;
Please write normal if statements, these comparisons within assignments
are easy to miss and look like attempts to combine multiple
initializations in a single line due to the mix of = and ==.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists