[PATCH v4 1/4] ASoC: rockchip: add support for i2s-tdm controller
Mark Brown
broonie at kernel.org
Wed Sep 15 07:05:02 PDT 2021
On Sat, Sep 04, 2021 at 01:15:33AM +0200, Nicolas Frattaroli wrote:
A few fairly small issues here, nothing too major:
> @@ -0,0 +1,1832 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * ALSA SoC Audio Layer - Rockchip I2S/TDM Controller driver
Please write the entire comment as a C++ one so it looks more
itentional.
> + xfer_mask = (tx ? I2S_XFER_TXS_START : 0) |
> + (rx ? I2S_XFER_RXS_START : 0);
> + xfer_val = (tx ? I2S_XFER_TXS_STOP : 0) |
> + (rx ? I2S_XFER_RXS_STOP : 0);
Please write normal conditional statements to improve legibility.
> + spin_lock_irqsave(&i2s_tdm->lock, flags);
> + if (on) {
> + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> + rockchip_enable_tde(i2s_tdm->regmap);
> + else
> + rockchip_enable_rde(i2s_tdm->regmap);
> +
> + if (atomic_inc_return(&i2s_tdm->refcount) == 1) {
Why do we need to use atomics here given that we're inside a spinlock?
Surely the spinlock is already providing adequate concurrency
protection. I can't see any other points where we don't have the
spinlock already, and I'd be worried if we did. This looks like it
could just be regular variables.
> + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
> + case SND_SOC_DAIFMT_CBS_CFS:
Please use the modern SOF_DAI_FMT_CBC_CFC defines.
> + delta = (ppm < 0) ? -1 : 1;
Again, please write normal condiditional statements for legibility.
> +static int rockchip_i2s_tdm_clk_compensation_put(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + return ret;
> +}
This should return 1 if the value changed.
> +static int __maybe_unused rockchip_i2s_tdm_resume(struct device *dev)
> +{
> + struct rk_i2s_tdm_dev *i2s_tdm = dev_get_drvdata(dev);
> + int ret;
> +
> + ret = pm_runtime_get_sync(dev);
> + if (ret < 0)
> + return ret;
> + ret = regcache_sync(i2s_tdm->regmap);
> + pm_runtime_put(dev);
Runtime resume also does a regcache sync so why are we doing another one
here?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-rockchip/attachments/20210915/42b783e9/attachment.sig>
More information about the Linux-rockchip
mailing list