linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Chris Brandt <chris.brandt@renesas.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	alsa-devel@alsa-project.org,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Chris Paterson <Chris.Paterson2@renesas.com>,
	Biju Das <biju.das@bp.renesas.com>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v3 2/3] sound: soc: sh: Add RZ/G2L SSIF-2 driver
Date: Thu, 5 Aug 2021 16:34:20 +0100	[thread overview]
Message-ID: <20210805153420.GQ26252@sirena.org.uk> (raw)
In-Reply-To: <20210729172311.31111-3-biju.das.jz@bp.renesas.com>

[-- Attachment #1: Type: text/plain, Size: 2532 bytes --]

On Thu, Jul 29, 2021 at 06:23:10PM +0100, Biju Das wrote:

> +config SND_SOC_RZ
> +	tristate "RZ/G2L series SSIF-2 support"
> +	depends on ARCH_R9A07G044 || COMPILE_TEST
> +	select SND_SIMPLE_CARD
> +	help

Why is the DAI selecting a specific sound card, and if it must then why
would it use simple-card and not the more modern audio-graph-card?  The
select should almost certainly just be removed entirely, this is not
something DAI drivers do - cards use DAIs, not the other way around.

> +++ b/sound/soc/sh/rz-ssi.c
> @@ -0,0 +1,871 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Renesas RZ/G2L ASoC Serial Sound Interface (SSIF-2) Driver
> + *
> + * Copyright (C) 2021 Renesas Electronics Corp.

Please make the entire comment a C++ one so things look more
intentional.

> +static int rz_ssi_stream_init(struct rz_ssi_priv *ssi,
> +			      struct rz_ssi_stream *strm,
> +			      struct snd_pcm_substream *substream)
> +{
> +	struct snd_pcm_runtime *runtime = substream->runtime;
> +
> +	strm->substream = substream;

> +	if (runtime->sample_bits != 16) {
> +		dev_err(ssi->dev, "Unsupported sample width: %d\n",
> +			runtime->sample_bits);
> +		strm->substream = NULL;
> +		return -EINVAL;
> +	}
> +
> +	if (runtime->frame_bits != 32) {
> +		dev_err(ssi->dev, "Unsupported frame width: %d\n",
> +			runtime->sample_bits);
> +		strm->substream = NULL;
> +		return -EINVAL;
> +	}
> +
> +	if (runtime->channels != 2) {
> +		dev_err(ssi->dev, "Number of channels not matched\n");
> +		strm->substream = NULL;
> +		return -EINVAL;
> +	}

Why are we only validating these here which is called from...

> +	switch (cmd) {
> +	case SNDRV_PCM_TRIGGER_START:
> +		/* Soft Reset */
> +		rz_ssi_reg_mask_setl(ssi, SSIFCR, 0, SSIFCR_SSIRST);
> +		rz_ssi_reg_mask_setl(ssi, SSIFCR, SSIFCR_SSIRST, 0);
> +		udelay(5);
> +
> +		ret = rz_ssi_stream_init(ssi, strm, substream);
> +		if (ret)
> +			goto done;

...trigger.  This stuff should be being validated when we set
parameters in hw_params() and can usefully report the error.

> +static int rz_ssi_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
> +{
> +	struct rz_ssi_priv *ssi = snd_soc_dai_get_drvdata(dai);
> +
> +	/* set master/slave audio interface */
> +	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
> +	case SND_SOC_DAIFMT_CBS_CFS:
> +		asm("nop"); /* codec is slave */
> +		break;

That asm("nop") looks interesting...  I can't think why that'd be
needed?  Please also use the modern versions of these defines, consumer
and provider rather than slave and master.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-08-05 15:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29 17:23 [PATCH v3 0/3] Add RZ/G2L Sound support Biju Das
2021-07-29 17:23 ` [PATCH v3 1/3] ASoC: dt-bindings: Document RZ/G2L bindings Biju Das
2021-07-29 17:23 ` [PATCH v3 2/3] sound: soc: sh: Add RZ/G2L SSIF-2 driver Biju Das
2021-08-05 15:34   ` Mark Brown [this message]
2021-08-05 19:11     ` Biju Das
2021-07-29 17:23 ` [PATCH v3 3/3] sound: sh: rz-ssi: Add SSI DMAC support Biju Das
2021-08-05 14:44 ` [PATCH v3 0/3] Add RZ/G2L Sound support Mark Brown
2021-08-05 15:09   ` Biju Das

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=20210805153420.GQ26252@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=Chris.Paterson2@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=biju.das@bp.renesas.com \
    --cc=chris.brandt@renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=krzk@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=perex@perex.cz \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=rdunlap@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).