Re: [alsa-devel][PATCH v1] ASoC: TSCS454: Add Support
From: Mark Brown
Date: Tue May 29 2018 - 08:18:04 EST
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 ==.
Attachment:
signature.asc
Description: PGP signature