From: Zidan Wang <b50113@freescale.com>
To: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Zidan Wang <zidan.wang@freescale.com>,
timur@tabi.org, Xiubo.Lee@gmail.com, lgirdwood@gmail.com,
broonie@kernel.org, perex@perex.cz, tiwai@suse.de,
alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Subject: Re: [alsa-devel][PATCH 2/3] ASoC: fsl_sai: Add support for tdm slots operation
Date: Thu, 22 Jan 2015 14:20:06 +0800 [thread overview]
Message-ID: <20150122062004.GA7046@b50113> (raw)
In-Reply-To: <20150122054409.GA7748@Asurada>
On Wed, Jan 21, 2015 at 09:44:10PM -0800, Nicolin Chen wrote:
> On Thu, Jan 22, 2015 at 12:55:35PM +0800, Zidan Wang wrote:
> > On Wed, Jan 21, 2015 at 10:08:03AM -0800, Nicolin Chen wrote:
> > > On Tue, Jan 20, 2015 at 08:21:19PM +0800, Zidan Wang wrote:
> > > > @@ -369,10 +380,25 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
> > > > u32 word_width = snd_pcm_format_width(params_format(params));
> > > > u32 val_cr4 = 0, val_cr5 = 0;
> > > > int ret;
> > > > + u32 bclk;
> > > > +
> > > > + if (channels == 1)
> > > > + channels = 2;
> > > > +
> > > > + if (!sai->slots || sai->slots % channels)
> > > > + sai->slots = channels;
> > > > +
> > > > + sai->slots = sai->slots / channels;
> > > > +
> > > > + if (sai->slot_width < word_width || sai->is_dsp_mode)
> > > > + sai->slot_width = word_width;
> > >
> > > Could you pls explain a bit what's this overriding for?
> > > Or it might be better to put into a comment.
> > >
> > In machine driver, we should use snd_soc_dai_set_tdm_slot to set slots
> > and slot width. In my opinion, slots in machine driver means the slot
> > number of all channels. But in sai driver, the slots means the slot number
> > of one channel. So snd_soc_calc_bclk use fs*sample_size*channels*tdm_slots
> > to caculate bclk.
>
> Could you pls use the standard way as you described for slot number
> in machine driver instead of defining some other meanings? That one
> is really confusing, not to mention a code without any comment.
>
> You can add some extra local variables with extinguished names and
> calculate the slot number and channels you want without changing
> the original sai->slots and channels in the hw_params(). As you said,
> you only need that new slot number and channels for snd_soc_calc_bclk
> call. So you may also put this code right before the call -- a normal
> routine doesn't need to recalculate the special slots and channels,
> right?
>
> Nicolin
Actually i don't kown which meaning is the standard way. Because i found
in wm8993 and wm8904 codec driver, they also use slots/channels to set
tdm_slots in set_tdm_slot function.
Best Regards,
Zidan
WARNING: multiple messages have this Message-ID (diff)
From: Zidan Wang <b50113@freescale.com>
To: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: alsa-devel@alsa-project.org, timur@tabi.org,
Zidan Wang <zidan.wang@freescale.com>,
Xiubo.Lee@gmail.com, tiwai@suse.de, linux-kernel@vger.kernel.org,
lgirdwood@gmail.com, perex@perex.cz, broonie@kernel.org,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [alsa-devel][PATCH 2/3] ASoC: fsl_sai: Add support for tdm slots operation
Date: Thu, 22 Jan 2015 14:20:06 +0800 [thread overview]
Message-ID: <20150122062004.GA7046@b50113> (raw)
In-Reply-To: <20150122054409.GA7748@Asurada>
On Wed, Jan 21, 2015 at 09:44:10PM -0800, Nicolin Chen wrote:
> On Thu, Jan 22, 2015 at 12:55:35PM +0800, Zidan Wang wrote:
> > On Wed, Jan 21, 2015 at 10:08:03AM -0800, Nicolin Chen wrote:
> > > On Tue, Jan 20, 2015 at 08:21:19PM +0800, Zidan Wang wrote:
> > > > @@ -369,10 +380,25 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
> > > > u32 word_width = snd_pcm_format_width(params_format(params));
> > > > u32 val_cr4 = 0, val_cr5 = 0;
> > > > int ret;
> > > > + u32 bclk;
> > > > +
> > > > + if (channels == 1)
> > > > + channels = 2;
> > > > +
> > > > + if (!sai->slots || sai->slots % channels)
> > > > + sai->slots = channels;
> > > > +
> > > > + sai->slots = sai->slots / channels;
> > > > +
> > > > + if (sai->slot_width < word_width || sai->is_dsp_mode)
> > > > + sai->slot_width = word_width;
> > >
> > > Could you pls explain a bit what's this overriding for?
> > > Or it might be better to put into a comment.
> > >
> > In machine driver, we should use snd_soc_dai_set_tdm_slot to set slots
> > and slot width. In my opinion, slots in machine driver means the slot
> > number of all channels. But in sai driver, the slots means the slot number
> > of one channel. So snd_soc_calc_bclk use fs*sample_size*channels*tdm_slots
> > to caculate bclk.
>
> Could you pls use the standard way as you described for slot number
> in machine driver instead of defining some other meanings? That one
> is really confusing, not to mention a code without any comment.
>
> You can add some extra local variables with extinguished names and
> calculate the slot number and channels you want without changing
> the original sai->slots and channels in the hw_params(). As you said,
> you only need that new slot number and channels for snd_soc_calc_bclk
> call. So you may also put this code right before the call -- a normal
> routine doesn't need to recalculate the special slots and channels,
> right?
>
> Nicolin
Actually i don't kown which meaning is the standard way. Because i found
in wm8993 and wm8904 codec driver, they also use slots/channels to set
tdm_slots in set_tdm_slot function.
Best Regards,
Zidan
WARNING: multiple messages have this Message-ID (diff)
From: Zidan Wang <b50113@freescale.com>
To: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Zidan Wang <zidan.wang@freescale.com>, <timur@tabi.org>,
<Xiubo.Lee@gmail.com>, <lgirdwood@gmail.com>,
<broonie@kernel.org>, <perex@perex.cz>, <tiwai@suse.de>,
<alsa-devel@alsa-project.org>, <linuxppc-dev@lists.ozlabs.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [alsa-devel][PATCH 2/3] ASoC: fsl_sai: Add support for tdm slots operation
Date: Thu, 22 Jan 2015 14:20:06 +0800 [thread overview]
Message-ID: <20150122062004.GA7046@b50113> (raw)
In-Reply-To: <20150122054409.GA7748@Asurada>
On Wed, Jan 21, 2015 at 09:44:10PM -0800, Nicolin Chen wrote:
> On Thu, Jan 22, 2015 at 12:55:35PM +0800, Zidan Wang wrote:
> > On Wed, Jan 21, 2015 at 10:08:03AM -0800, Nicolin Chen wrote:
> > > On Tue, Jan 20, 2015 at 08:21:19PM +0800, Zidan Wang wrote:
> > > > @@ -369,10 +380,25 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
> > > > u32 word_width = snd_pcm_format_width(params_format(params));
> > > > u32 val_cr4 = 0, val_cr5 = 0;
> > > > int ret;
> > > > + u32 bclk;
> > > > +
> > > > + if (channels == 1)
> > > > + channels = 2;
> > > > +
> > > > + if (!sai->slots || sai->slots % channels)
> > > > + sai->slots = channels;
> > > > +
> > > > + sai->slots = sai->slots / channels;
> > > > +
> > > > + if (sai->slot_width < word_width || sai->is_dsp_mode)
> > > > + sai->slot_width = word_width;
> > >
> > > Could you pls explain a bit what's this overriding for?
> > > Or it might be better to put into a comment.
> > >
> > In machine driver, we should use snd_soc_dai_set_tdm_slot to set slots
> > and slot width. In my opinion, slots in machine driver means the slot
> > number of all channels. But in sai driver, the slots means the slot number
> > of one channel. So snd_soc_calc_bclk use fs*sample_size*channels*tdm_slots
> > to caculate bclk.
>
> Could you pls use the standard way as you described for slot number
> in machine driver instead of defining some other meanings? That one
> is really confusing, not to mention a code without any comment.
>
> You can add some extra local variables with extinguished names and
> calculate the slot number and channels you want without changing
> the original sai->slots and channels in the hw_params(). As you said,
> you only need that new slot number and channels for snd_soc_calc_bclk
> call. So you may also put this code right before the call -- a normal
> routine doesn't need to recalculate the special slots and channels,
> right?
>
> Nicolin
Actually i don't kown which meaning is the standard way. Because i found
in wm8993 and wm8904 codec driver, they also use slots/channels to set
tdm_slots in set_tdm_slot function.
Best Regards,
Zidan
next prev parent reply other threads:[~2015-01-22 6:20 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-20 12:21 [PATCH 0/3] Add master mode, tmd and right-j mode support Zidan Wang
2015-01-20 12:21 ` [alsa-devel][PATCH " Zidan Wang
2015-01-20 12:21 ` Zidan Wang
2015-01-20 12:21 ` [alsa-devel][PATCH 1/3] SoC: fsl_sai: add sai master " Zidan Wang
2015-01-20 12:21 ` Zidan Wang
2015-01-20 12:21 ` Zidan Wang
2015-01-21 6:07 ` Nicolin Chen
2015-01-21 6:07 ` Nicolin Chen
2015-01-21 9:25 ` [PATCH " Zidan Wang
2015-01-21 9:25 ` [alsa-devel][PATCH " Zidan Wang
2015-01-21 9:25 ` Zidan Wang
2015-01-21 17:36 ` Nicolin Chen
2015-01-21 17:36 ` Nicolin Chen
2015-01-20 12:21 ` [PATCH 2/3] ASoC: fsl_sai: Add support for tdm slots operation Zidan Wang
2015-01-20 12:21 ` [alsa-devel][PATCH " Zidan Wang
2015-01-20 12:21 ` Zidan Wang
2015-01-21 18:08 ` Nicolin Chen
2015-01-21 18:08 ` Nicolin Chen
2015-01-22 4:55 ` Zidan Wang
2015-01-22 4:55 ` Zidan Wang
2015-01-22 4:55 ` Zidan Wang
2015-01-22 5:44 ` Nicolin Chen
2015-01-22 5:44 ` Nicolin Chen
2015-01-22 6:20 ` Zidan Wang [this message]
2015-01-22 6:20 ` Zidan Wang
2015-01-22 6:20 ` Zidan Wang
2015-01-22 23:50 ` Nicolin Chen
2015-01-22 23:50 ` Nicolin Chen
2015-01-23 2:55 ` [PATCH " Zidan Wang
2015-01-23 2:55 ` [alsa-devel][PATCH " Zidan Wang
2015-01-23 2:55 ` Zidan Wang
2015-01-23 8:27 ` Nicolin Chen
2015-01-23 8:27 ` Nicolin Chen
2015-01-20 12:21 ` [PATCH 3/3] ASoC: fsl_sai: Add support for Right-J mode Zidan Wang
2015-01-20 12:21 ` [alsa-devel][PATCH " Zidan Wang
2015-01-20 12:21 ` Zidan Wang
2015-01-21 18:53 ` Nicolin Chen
2015-01-21 18:53 ` Nicolin Chen
2015-01-22 5:13 ` Zidan Wang
2015-01-22 5:13 ` Zidan Wang
2015-01-22 5:13 ` Zidan Wang
2015-01-22 5:46 ` Nicolin Chen
2015-01-22 5:46 ` Nicolin Chen
2015-01-21 1:15 ` [alsa-devel] [PATCH 0/3] Add master mode, tmd and right-j mode support Fabio Estevam
2015-01-21 1:15 ` Fabio Estevam
2015-01-21 6:29 ` Nicolin Chen
2015-01-21 6:29 ` Nicolin Chen
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=20150122062004.GA7046@b50113 \
--to=b50113@freescale.com \
--cc=Xiubo.Lee@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nicoleotsuka@gmail.com \
--cc=perex@perex.cz \
--cc=timur@tabi.org \
--cc=tiwai@suse.de \
--cc=zidan.wang@freescale.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.