From: Nicolin Chen <nicoleotsuka@gmail.com>
To: "S.j. Wang" <shengjiu.wang@nxp.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"timur@kernel.org" <timur@kernel.org>,
"Xiubo.Lee@gmail.com" <Xiubo.Lee@gmail.com>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"tiwai@suse.com" <tiwai@suse.com>,
"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
"broonie@kernel.org" <broonie@kernel.org>,
"festevam@gmail.com" <festevam@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [alsa-devel] [PATCH] ASoC: fsl_asrc: refine the setting of internal clock divider
Date: Thu, 24 Oct 2019 23:54:34 -0700 [thread overview]
Message-ID: <20191025065433.GA4632@Asurada> (raw)
In-Reply-To: <VE1PR04MB6479AC63FFE5D57B4E2C33D2E3650@VE1PR04MB6479.eurprd04.prod.outlook.com>
On Fri, Oct 25, 2019 at 05:33:17AM +0000, S.j. Wang wrote:
> > > > > + pair_err("The divider can't be used for non ideal mode\n");
> > > > > + return -EINVAL;
> > > > > + }
> > > > > +
> > > > > + /* Divider range is [1, 1024] */
> > > > > + div[IN] = min_t(u32, 1024, div[IN]);
> > > > > + div[OUT] = min_t(u32, 1024, div[OUT]);
> > > >
> > > > Hmm, this looks like we want to allow ideal ratio cases and p2p
> > > > cases to operate any way, even if the divider wasn't within the
> > > > range to get the in/out rates from the output clock?
> > >
> > > Yes. We still allow the p2p = true, ideal = false. Note that p2p is
> > > not Equal to ideal.
> >
> > Got it.
> >
> > Overall, I feel it's better to have a naming to state the purpose of using
> > ideal configurations without the IDEAL_RATIO_RATE setup.
> > bool use_ideal_rate;
> > And we can put into the asrc_config structure if there's no major problem.
> >
>
> Asrc_config may exposed to user, I don't think user need to care about
> The using of ideal rate or not.
Given that M2M could use output rate instead of ideal ratio rate
as well, it could be a configuration from my point of view. Yet,
we may just add it as a function parameter like you did, for now
to ease the situation, until we have such a need someday.
>
> > So the condition check for the calculation would be:
> > + if (ideal && config->use_ideal_rate)
> > + rem[OUT] = do_div(clk_rate, IDEAL_RATIO_RATE);
> > + else
> > + rem[OUT] = do_div(clk_rate, outrate);
> > + div[OUT] = clk_rate;
> >
> > And for that if (!ideal && div[IN]....rem[OUT]), I feel it would be clear to
> > have them separately, as the existing "div[IN] == 0"
> > and "div[OUT] == 0" checks, so that we can tell users which side of the
> > divider is out of range and what the sample rate and clock rate are.
> >
> Do you mean need to combine this judgement with "div[IN] == 0"
> Or "div[OUT] == 0"?
Not necessarily. Could put in the else path so its error message
would be more ideal ratio configuration specific.
Thanks
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
WARNING: multiple messages have this Message-ID (diff)
From: Nicolin Chen <nicoleotsuka@gmail.com>
To: "S.j. Wang" <shengjiu.wang@nxp.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"timur@kernel.org" <timur@kernel.org>,
"Xiubo.Lee@gmail.com" <Xiubo.Lee@gmail.com>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"tiwai@suse.com" <tiwai@suse.com>,
"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
"perex@perex.cz" <perex@perex.cz>,
"broonie@kernel.org" <broonie@kernel.org>,
"festevam@gmail.com" <festevam@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ASoC: fsl_asrc: refine the setting of internal clock divider
Date: Thu, 24 Oct 2019 23:54:34 -0700 [thread overview]
Message-ID: <20191025065433.GA4632@Asurada> (raw)
In-Reply-To: <VE1PR04MB6479AC63FFE5D57B4E2C33D2E3650@VE1PR04MB6479.eurprd04.prod.outlook.com>
On Fri, Oct 25, 2019 at 05:33:17AM +0000, S.j. Wang wrote:
> > > > > + pair_err("The divider can't be used for non ideal mode\n");
> > > > > + return -EINVAL;
> > > > > + }
> > > > > +
> > > > > + /* Divider range is [1, 1024] */
> > > > > + div[IN] = min_t(u32, 1024, div[IN]);
> > > > > + div[OUT] = min_t(u32, 1024, div[OUT]);
> > > >
> > > > Hmm, this looks like we want to allow ideal ratio cases and p2p
> > > > cases to operate any way, even if the divider wasn't within the
> > > > range to get the in/out rates from the output clock?
> > >
> > > Yes. We still allow the p2p = true, ideal = false. Note that p2p is
> > > not Equal to ideal.
> >
> > Got it.
> >
> > Overall, I feel it's better to have a naming to state the purpose of using
> > ideal configurations without the IDEAL_RATIO_RATE setup.
> > bool use_ideal_rate;
> > And we can put into the asrc_config structure if there's no major problem.
> >
>
> Asrc_config may exposed to user, I don't think user need to care about
> The using of ideal rate or not.
Given that M2M could use output rate instead of ideal ratio rate
as well, it could be a configuration from my point of view. Yet,
we may just add it as a function parameter like you did, for now
to ease the situation, until we have such a need someday.
>
> > So the condition check for the calculation would be:
> > + if (ideal && config->use_ideal_rate)
> > + rem[OUT] = do_div(clk_rate, IDEAL_RATIO_RATE);
> > + else
> > + rem[OUT] = do_div(clk_rate, outrate);
> > + div[OUT] = clk_rate;
> >
> > And for that if (!ideal && div[IN]....rem[OUT]), I feel it would be clear to
> > have them separately, as the existing "div[IN] == 0"
> > and "div[OUT] == 0" checks, so that we can tell users which side of the
> > divider is out of range and what the sample rate and clock rate are.
> >
> Do you mean need to combine this judgement with "div[IN] == 0"
> Or "div[OUT] == 0"?
Not necessarily. Could put in the else path so its error message
would be more ideal ratio configuration specific.
Thanks
WARNING: multiple messages have this Message-ID (diff)
From: Nicolin Chen <nicoleotsuka@gmail.com>
To: "S.j. Wang" <shengjiu.wang@nxp.com>
Cc: "timur@kernel.org" <timur@kernel.org>,
"Xiubo.Lee@gmail.com" <Xiubo.Lee@gmail.com>,
"festevam@gmail.com" <festevam@gmail.com>,
"broonie@kernel.org" <broonie@kernel.org>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
"perex@perex.cz" <perex@perex.cz>,
"tiwai@suse.com" <tiwai@suse.com>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ASoC: fsl_asrc: refine the setting of internal clock divider
Date: Thu, 24 Oct 2019 23:54:34 -0700 [thread overview]
Message-ID: <20191025065433.GA4632@Asurada> (raw)
In-Reply-To: <VE1PR04MB6479AC63FFE5D57B4E2C33D2E3650@VE1PR04MB6479.eurprd04.prod.outlook.com>
On Fri, Oct 25, 2019 at 05:33:17AM +0000, S.j. Wang wrote:
> > > > > + pair_err("The divider can't be used for non ideal mode\n");
> > > > > + return -EINVAL;
> > > > > + }
> > > > > +
> > > > > + /* Divider range is [1, 1024] */
> > > > > + div[IN] = min_t(u32, 1024, div[IN]);
> > > > > + div[OUT] = min_t(u32, 1024, div[OUT]);
> > > >
> > > > Hmm, this looks like we want to allow ideal ratio cases and p2p
> > > > cases to operate any way, even if the divider wasn't within the
> > > > range to get the in/out rates from the output clock?
> > >
> > > Yes. We still allow the p2p = true, ideal = false. Note that p2p is
> > > not Equal to ideal.
> >
> > Got it.
> >
> > Overall, I feel it's better to have a naming to state the purpose of using
> > ideal configurations without the IDEAL_RATIO_RATE setup.
> > bool use_ideal_rate;
> > And we can put into the asrc_config structure if there's no major problem.
> >
>
> Asrc_config may exposed to user, I don't think user need to care about
> The using of ideal rate or not.
Given that M2M could use output rate instead of ideal ratio rate
as well, it could be a configuration from my point of view. Yet,
we may just add it as a function parameter like you did, for now
to ease the situation, until we have such a need someday.
>
> > So the condition check for the calculation would be:
> > + if (ideal && config->use_ideal_rate)
> > + rem[OUT] = do_div(clk_rate, IDEAL_RATIO_RATE);
> > + else
> > + rem[OUT] = do_div(clk_rate, outrate);
> > + div[OUT] = clk_rate;
> >
> > And for that if (!ideal && div[IN]....rem[OUT]), I feel it would be clear to
> > have them separately, as the existing "div[IN] == 0"
> > and "div[OUT] == 0" checks, so that we can tell users which side of the
> > divider is out of range and what the sample rate and clock rate are.
> >
> Do you mean need to combine this judgement with "div[IN] == 0"
> Or "div[OUT] == 0"?
Not necessarily. Could put in the else path so its error message
would be more ideal ratio configuration specific.
Thanks
next prev parent reply other threads:[~2019-10-25 6:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-25 5:33 [alsa-devel] [PATCH] ASoC: fsl_asrc: refine the setting of internal clock divider S.j. Wang
2019-10-25 5:33 ` S.j. Wang
2019-10-25 5:33 ` S.j. Wang
2019-10-25 6:54 ` Nicolin Chen [this message]
2019-10-25 6:54 ` Nicolin Chen
2019-10-25 6:54 ` Nicolin Chen
-- strict thread matches above, loose matches on Subject: below --
2019-10-23 6:25 [alsa-devel] " S.j. Wang
2019-10-23 19:10 ` Nicolin Chen
2019-10-17 6:21 Shengjiu Wang
2019-10-17 21:54 ` 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=20191025065433.GA4632@Asurada \
--to=nicoleotsuka@gmail.com \
--cc=Xiubo.Lee@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=festevam@gmail.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=shengjiu.wang@nxp.com \
--cc=timur@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 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.