From: Mark Brown <broonie@kernel.org>
To: Simran Rai <simran.rai@broadcom.com>
Cc: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>, Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Simran Rai <ssimran@broadcom.com>,
Lori Hikichi <lhikichi@broadcom.com>,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
bcm-kernel-feedback-list@broadcom.com,
linux-kernel@vger.kernel.org,
Arun Parameswaran <arunp@broadcom.com>,
alsa-devel@alsa-project.org
Subject: Re: [PATCH resend v5 2/3] ASoC: cygnus: Add Cygnus audio DAI driver
Date: Tue, 29 Mar 2016 15:16:34 -0700 [thread overview]
Message-ID: <20160329221634.GQ2350@sirena.org.uk> (raw)
In-Reply-To: <1459277192-10942-3-git-send-email-simran.rai@broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 2596 bytes --]
On Tue, Mar 29, 2016 at 11:46:31AM -0700, Simran Rai wrote:
A few issues here, a lot of them are stylistic though there's what look
like a couple of small bugs here too.
> +static int cygnus_ssp_set_clocks(struct cygnus_aio_port *aio,
> + struct cygnus_audio *cygaud)
> +{
> + u32 value, i = 0;
> + u32 mask = 0xf;
> + u32 sclk;
> + bool found = false;
> + const struct _ssp_clk_coeff *p_entry = NULL;
> +
> + if ((!aio->lrclk) || (!aio->bit_per_frame)) {
> + dev_err(aio->cygaud->dev, "First set up port through hw_params()\n");
> + return -EINVAL;
> + }
This function is only ever called from one site in hw_prams(). What is
this defending against? A check like this seems very worrying, if it
ever goes off that seems to indicate either something is seriously wrong
or we should be recording something then coming back and trying again
later.
> + for (i = 0; i < ARRAY_SIZE(ssp_clk_coeff); i++) {
> + p_entry = &ssp_clk_coeff[i];
> + if ((p_entry->rate == aio->lrclk) &&
> + (p_entry->sclk_rate == aio->bit_per_frame) &&
> + (p_entry->mclk == aio->mclk)) {
Why the strange indentation here?
> + /* Set sclk rate */
> + if (aio->port_type == PORT_TDM) {
switch statment here for extensibility.
> + /* Configure channels as mono or stereo */
> + if (params_channels(params) == 1) {
> + value = readl(aio->cygaud->audio +
> + aio->regs.bf_sourcech_cfg);
> + value |= BIT(BF_SRC_CFGX_SAMPLE_CH_MODE);
> + value &= ~BIT(BF_SRC_CFGX_BUFFER_PAIR_ENABLE);
> + writel(value, aio->cygaud->audio +
> + aio->regs.bf_sourcech_cfg);
> + } else {
> + value = readl(aio->cygaud->audio +
> + aio->regs.bf_sourcech_cfg);
> + value &= ~BIT(BF_SRC_CFGX_SAMPLE_CH_MODE);
> + writel(value, aio->cygaud->audio +
> + aio->regs.bf_sourcech_cfg);
> + }
Either this should be a switch statement or the comment should say we
support more than stereo. It's also not clear to me how
BUFFER_PAIR_ENABLE gets set again if we go from mono to stereo.
> + if (!aio->is_slave) {
> + if (aio->clk_trace.cap_clk_en)
> + clk_prepare_enable(aio->cygaud->
> + audio_clk[aio->pll_clk_num]);
Should check the return value of clk_prepare_enable().
> + .playback = {
> + .channels_min = 2,
> + .channels_max = 2,
> + .rates = CYGNUS_TDM_RATE | SNDRV_PCM_RATE_88200 |
> + SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |
> + SNDRV_PCM_RATE_192000,
> + .formats = SNDRV_PCM_FMTBIT_S16_LE |
> + SNDRV_PCM_FMTBIT_S32_LE,
According to hw_params() the driver also supports S8 and S24.
> + if (port_type == PORT_TDM) {
> + } else { /* SPDIF case */
switch statement...
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-03-29 22:17 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-29 18:46 [PATCH resend v5 0/3] ASoC: cygnus: Add audio support for Broadcom Cygnus SoC Simran Rai
2016-03-29 18:46 ` [PATCH resend v5 1/3] ASoC: cygnus: Add DT bindings for Broadcom Cygnus audio Simran Rai
2016-03-31 14:13 ` Rob Herring
2016-03-31 18:14 ` Simran Rai
2016-03-31 18:23 ` Mark Brown
2016-05-31 17:45 ` Applied "ASoC: cygnus: Add DT bindings for Broadcom Cygnus audio" to the asoc tree Mark Brown
2016-03-29 18:46 ` [PATCH resend v5 2/3] ASoC: cygnus: Add Cygnus audio DAI driver Simran Rai
2016-03-29 22:16 ` Mark Brown [this message]
2016-03-31 0:09 ` Simran Rai
2016-03-29 18:46 ` [PATCH resend v5 3/3] ASoC: cygnus: Add Cygnus audio DMA driver Simran Rai
2016-03-29 22:23 ` Mark Brown
2016-05-31 17:45 ` Applied "ASoC: cygnus: Add Cygnus audio DMA driver" to the asoc tree Mark Brown
2016-03-29 19:09 ` [PATCH resend v5 0/3] ASoC: cygnus: Add audio support for Broadcom Cygnus SoC Mark Brown
2016-03-29 19:20 ` Florian Fainelli
2016-03-29 19:46 ` Mark Brown
2016-03-30 15:35 ` Takashi Iwai
2016-03-30 15:51 ` Mark Brown
2016-03-30 15:54 ` Takashi Iwai
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=20160329221634.GQ2350@sirena.org.uk \
--to=broonie@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=arunp@broadcom.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=lgirdwood@gmail.com \
--cc=lhikichi@broadcom.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=perex@perex.cz \
--cc=rjui@broadcom.com \
--cc=robh+dt@kernel.org \
--cc=sbranden@broadcom.com \
--cc=simran.rai@broadcom.com \
--cc=ssimran@broadcom.com \
--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
all inboxes | Powered by JetHome®