From: <Codrin.Ciubotariu@microchip.com>
To: mirq-linux@rere.qmqm.pl
Cc: alsa-devel@alsa-project.org, alexandre.belloni@bootlin.com,
tiwai@suse.com, lgirdwood@gmail.com,
Ludovic.Desroches@microchip.com, broonie@kernel.org,
perex@perex.cz, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/5] ASoC: atmel_ssc_dai: rework DAI format configuration
Date: Wed, 24 Jul 2019 12:54:27 +0000 [thread overview]
Message-ID: <e8ed52a8-bfca-9466-2981-07fd2a0a42b8@microchip.com> (raw)
In-Reply-To: <20190724111533.GA23736@qmqm.qmqm.pl>
On 24.07.2019 14:15, mirq-linux@rere.qmqm.pl wrote:
> External E-Mail
>
>
> On Wed, Jul 24, 2019 at 10:35:29AM +0000, Codrin.Ciubotariu@microchip.com wrote:
>> On 22.07.2019 21:27, Michał Mirosław wrote:
>>> Rework DAI format calculation in preparation for adding more formats
>>> later.
>>>
>>> Note: this changes FSEDGE to POSITIVE for I2S CBM_CFS mode as the TXSYN
>>> interrupt is not used anyway.
>>>
>>> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
>>> ---
>>> sound/soc/atmel/atmel_ssc_dai.c | 283 +++++++++-----------------------
>>> 1 file changed, 79 insertions(+), 204 deletions(-)
>>>
>>> diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
>>> index 6f89483ac88c..b2992496e52f 100644
>>> --- a/sound/soc/atmel/atmel_ssc_dai.c
>>> +++ b/sound/soc/atmel/atmel_ssc_dai.c
> [...]
>>> + if (atmel_ssc_cbs(ssc_p)) {
>>> + /*
>>> + * SSC provides BCLK
>>> + *
>>> + * The SSC transmit and receive clocks are generated from the
>>> + * MCK divider, and the BCLK signal is output
>>> + * on the SSC TK line.
>>> + */
>>> + rcmr |= SSC_BF(RCMR_CKS, SSC_CKS_DIV)
>>> + | SSC_BF(RCMR_CKO, SSC_CKO_NONE);
>>> +
>>> + tcmr |= SSC_BF(TCMR_CKS, SSC_CKS_DIV)
>>> + | SSC_BF(TCMR_CKO, SSC_CKO_CONTINUOUS);
>>> + } else {
>>> + rcmr |= SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
>>> + SSC_CKS_PIN : SSC_CKS_CLOCK)
>>> + | SSC_BF(RCMR_CKO, SSC_CKO_NONE);
>>> +
>>> + tcmr |= SSC_BF(TCMR_CKS, ssc->clk_from_rk_pin ?
>>> + SSC_CKS_CLOCK : SSC_CKS_PIN)
>>> + | SSC_BF(TCMR_CKO, SSC_CKO_NONE);
>>> + }
>>> +
>>> + rcmr |= SSC_BF(RCMR_PERIOD, rcmr_period)
>>> + | SSC_BF(RCMR_CKI, SSC_CKI_RISING);
>>
>> You can also add here SSC_BF(RCMR_CKO, SSC_CKO_NONE) and remove it from
>> the if-else above;
>
> I left it to keep symmetry between TX and RX code. I can pull it here if
> you prefer that way.
Right, you can leave it then.
>
>>> +
>>> + tcmr |= SSC_BF(TCMR_PERIOD, tcmr_period)
>>> + | SSC_BF(TCMR_CKI, SSC_CKI_FALLING);
>>> +
>>> + rfmr = SSC_BF(RFMR_FSLEN_EXT, fslen_ext)
>>> + | SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
>>> + | SSC_BF(RFMR_FSOS, fs_osync)
>>> + | SSC_BF(RFMR_FSLEN, fslen)
>>> + | SSC_BF(RFMR_DATNB, (channels - 1))
>>> + | SSC_BIT(RFMR_MSBF)
>>> + | SSC_BF(RFMR_LOOP, 0)
>>> + | SSC_BF(RFMR_DATLEN, (bits - 1));
>>> +
>>> + tfmr = SSC_BF(TFMR_FSLEN_EXT, fslen_ext)
>>> + | SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
>>> + | SSC_BF(TFMR_FSDEN, 0)
>>> + | SSC_BF(TFMR_FSOS, fs_osync)
>>> + | SSC_BF(TFMR_FSLEN, fslen)
>>> + | SSC_BF(TFMR_DATNB, (channels - 1))
>>> + | SSC_BIT(TFMR_MSBF)
>>> + | SSC_BF(TFMR_DATDEF, 0)
>>> + | SSC_BF(TFMR_DATLEN, (bits - 1));
>>> +
>>> + if (fslen_ext && !ssc->pdata->has_fslen_ext) {
>>> + dev_err(dai->dev, "sample size %d is too large for SSC device\n",
>>> + bits);
>>> + return -EINVAL;
>>> + }
>>> +
>>> pr_debug("atmel_ssc_hw_params: "
>>> "RCMR=%08x RFMR=%08x TCMR=%08x TFMR=%08x\n",
>>> rcmr, rfmr, tcmr, tfmr);
>>>
>>
>> You are adding support for SND_SOC_DAIFMT_DSP_A |
>> SND_SOC_DAIFMT_CBM_CFS. If this is intended, please make a separate
>> patch. If not, then:
>>
>> printk(KERN_WARNING "atmel_ssc_dai: unsupported DAI format 0x%x\n",
>> ssc_p->daifmt);
>> return -EINVAL;
>
> Hmm. I guess this is actually a good side effect. I can't see a way to
> contain this change that doesn't involve adding code that's immediately
> removed in next patch. So would you agree to just mentioning this in
> commit message?
I prefer a separate patch, for clarity mostly, but I don't have a strong
opinion on this. Later, it might prove trickier to investigate a bug
this case and review this patch. Also, we should test and see that this
format works indeed...
Best regards,
Codrin
next prev parent reply other threads:[~2019-07-24 12:54 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-22 18:27 [PATCH 0/5] ASoC: atmel: extend SSC support Michał Mirosław
2019-07-22 18:27 ` [PATCH 1/5] ASoC: atmel: enable SSC_PCM_DMA in Kconfig Michał Mirosław
2019-07-23 13:36 ` Codrin.Ciubotariu
2019-07-23 16:43 ` mirq-linux
2019-07-23 17:27 ` Codrin.Ciubotariu
2019-07-23 18:39 ` Alexandre Belloni
2019-07-23 23:25 ` mirq-linux
2019-07-25 15:25 ` Codrin.Ciubotariu
2019-08-23 15:09 ` Alexandre Belloni
2019-07-23 17:18 ` Mark Brown
2019-07-22 18:27 ` [PATCH 5/5] ASoC: atmel_ssc_dai: Enable shared FSYNC source in frame-slave mode Michał Mirosław
2019-07-25 15:02 ` Codrin.Ciubotariu
2019-07-25 18:24 ` mirq-linux
2019-07-26 10:33 ` Codrin.Ciubotariu
2019-07-26 12:08 ` mirq-linux
2019-07-22 18:27 ` [PATCH 4/5] ASoC: atmel_ssc_dai: split TX/RX FS constants Michał Mirosław
2019-07-25 13:28 ` Codrin.Ciubotariu
2019-07-22 18:27 ` [PATCH 2/5] ASoC: atmel_ssc_dai: rework DAI format configuration Michał Mirosław
2019-07-24 10:35 ` Codrin.Ciubotariu
2019-07-24 11:15 ` mirq-linux
2019-07-24 12:54 ` Codrin.Ciubotariu [this message]
2019-07-22 18:27 ` [PATCH 3/5] ASoC: atmel_ssc_dai: implement left-justified data mode Michał Mirosław
2019-07-25 13:15 ` Codrin.Ciubotariu
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=e8ed52a8-bfca-9466-2981-07fd2a0a42b8@microchip.com \
--to=codrin.ciubotariu@microchip.com \
--cc=Ludovic.Desroches@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mirq-linux@rere.qmqm.pl \
--cc=perex@perex.cz \
--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