From: Damien Horsley <Damien.Horsley@imgtec.com>
To: Mark Brown <broonie@kernel.org>
Cc: <alsa-devel@alsa-project.org>, 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>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Jyri Sarha <jsarha@ti.com>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
James Hartley <james.hartley@imgtec.com>
Subject: Re: [alsa-devel] [PATCH 2/2] ASoC: pcm3168a: Add driver for pcm3168a codec
Date: Mon, 30 Nov 2015 16:49:30 +0000 [thread overview]
Message-ID: <565C7E1A.1000104@imgtec.com> (raw)
In-Reply-To: <20151127125411.GR1929@sirena.org.uk>
On 27/11/15 12:54, Mark Brown wrote:
> On Tue, Nov 24, 2015 at 02:43:44PM +0000, Damien Horsley wrote:
>> From: "Damien.Horsley" <Damien.Horsley@imgtec.com>
>>
>> Add driver for Texas Instruments pcm3168a codec
>
> Please try to keep your CC lists reasonable - only CC people who have an
> interest in the patch you're posting. The CC list you have here is far
> too broad, I can't figure out why a lot of the people there ended up
> there. If you've got 10 people that's generally a warning sign.
>
The list was generated by scripts/get_maintainer.pl when used on the
patches. I will remove some that look like they don't need to be there.
> Overall this looks good but there are a few smallish issues below:
>
>> + if ((!slave_mode || (fmt & PCM3168A_FMT_DSP_MASK)) &&
>> + (format == SNDRV_PCM_FORMAT_S24_3LE)) {
>> + dev_err(codec->dev, "48-bit frames not supported in master mode or slave mode using DSP(A/B)\n");
>
> You've got a lot of weird indentation with the second line of multi-line
> if conditionals massively further indented than I'd expect. These
> conditionals all also seem more complex than they should be - the fact
> that you're using so many !slave_modes makes me think that you should
> have a flag for master mode and...
>
>> + if ((!slave_mode || ((fmt != PCM3168A_FMT_RIGHT_J) &&
>> + (fmt != PCM3168A_FMT_LEFT_J))) &&
>> + (format == SNDRV_PCM_FORMAT_S16)) {
>
> ...especially with things like this the indentation makes it hard to
> tell what bits go together.
>
Ok
>> + val = slave_mode ? 0 : ((i + 1) << shift);
>
> Please write normal if statements unless there's a strong reason to use
> the ternery operator.
>
Ok
>> + /*
>> + * Justification has no effect for S32 and S16 as the whole frame
>> + * is filled with the samples, but the register field
>> + * must be set to a specific value for correct operation
>> + */
>> + if ((fmt == PCM3168A_FMT_RIGHT_J) &&
>> + (format == SNDRV_PCM_FORMAT_S32)) {
>> + fmt = PCM3168A_FMT_LEFT_J;
>> + } else if (format == SNDRV_PCM_FORMAT_S16) {
>> + fmt = PCM3168A_FMT_RIGHT_J_16;
>> + }
>
> Being in right justified mode *does* have an effect - it changes where
> the audio data starts relative to LRCLK. It is true that if the frame
> has exactly the right number of clocks left and right justified are
> identical but extra clocks are in general permitted so it looks like
> your right justified case above just isn't something the device really
> supports.
>
Should the value returned by snd_soc_params_to_frame_size be treated as
the minimum frame size?
>> + pcm3168a->scki = devm_clk_get(dev, "scki");
>> + if (IS_ERR(pcm3168a->scki)) {
>> + if (PTR_ERR(pcm3168a->scki) != -EPROBE_DEFER)
>> + dev_err(dev, "failed to acquire clock 'scki'\n");
>
> Please print the error code as well, it may help people understand the
> problem.
>
Ok
>> + ret = snd_soc_register_codec(dev, &pcm3168a_driver, pcm3168a_dais,
>> + ARRAY_SIZE(pcm3168a_dais));
>> + if (ret) {
>> + dev_err(dev, "failed to register codec: %d\n", ret);
>> + goto err_regulator;
>> + }
>> +
>> + pm_runtime_set_active(dev);
>> + pm_runtime_enable(dev);
>> + pm_runtime_idle(dev);
>
> You should enable runtime PM before registering the CODEC since the core
> can do runtime PM operations and if it tries before runtime PM is
> enabled things will get unbalanced.
>
Ok
>> +#define PCM3168A_DOUBLE_STS(xname, reg, shift_left, shift_right, max, invert) \
>> +{ \
>> + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
>> + .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
>> + .put = snd_soc_put_volsw, \
>> + .access = SNDRV_CTL_ELEM_ACCESS_READ | \
>> + SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
>> + .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
>> + max, invert, 0) \
>> +}
>
> This doesn't look like it should be driver specific - what's driver
> specific about it?
>
There is nothing driver specific. I will add this to include/sound/soc.h
as SOC_DOUBLE_STS
next prev parent reply other threads:[~2015-11-30 16:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1448376224-23964-3-git-send-email-Damien.Horsley@imgtec.com>
2015-11-27 12:54 ` [alsa-devel] [PATCH 2/2] ASoC: pcm3168a: Add driver for pcm3168a codec Mark Brown
2015-11-30 16:49 ` Damien Horsley [this message]
2015-12-01 17:59 ` Mark Brown
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=565C7E1A.1000104@imgtec.com \
--to=damien.horsley@imgtec.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=james.hartley@imgtec.com \
--cc=jsarha@ti.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=perex@perex.cz \
--cc=robh+dt@kernel.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