All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ashish Chavan <ashish.chavan@kpitcummins.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel <alsa-devel@alsa-project.org>,
	"kuninori.morimoto.gx" <kuninori.morimoto.gx@renesas.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	David@alsa-project.org, Chen <david.chen@diasemi.com>,
	lrg <lrg@ti.com>
Subject: Re: [PATCH v2] ASoC: da7210: Add support for PLL and SRM
Date: Mon, 23 Jan 2012 17:39:21 +0530	[thread overview]
Message-ID: <1327320561.31594.23.camel@matrix> (raw)
In-Reply-To: <20120123112142.GA29465@opensource.wolfsonmicro.com>

On Mon, 2012-01-23 at 11:21 +0000, Mark Brown wrote:
> On Mon, Jan 23, 2012 at 03:37:21PM +0530, Ashish Chavan wrote:
> 
> > +/* PLL out frequency values */
> > +#define FOUT_2822400		2822400
> > +#define FOUT_3072000		3072000
> 
> It's difficult to see what these defines are adding.

Yes, true. Anyways, converting if-else in to switch will make them
unnecessary.

> 
> > +static const u32 da7210_fout_2822400_div[][DIV_CNT + 1] = {
> > +	{ 12000000, 0xE8, 0x6C, 0x2, },		/* MCLK=12Mhz    Fs=44.1Khz */
> 
> You're still using magic numbers to find the dividers, and clearly the
> same rate comment should apply to the whole table not specific entries.

OK, will define a new constant for column count and update comment.

> 
> > +		/* In PLL master mode, use master mode PLL dividers */
> > +		if (fout == FOUT_2822400) {
> 
> 
> > +		} else if (fout == FOUT_3072000) {
> 
> This looks like a switch statement and...

Yes, will make it a switch instead of if-else.
> 
> > +			for (row_idx = 0; row_idx < FREF_CNT; row_idx++) {
> 
> ARRAY_SIZE()
> 
> > +				if (fref == da7210_fout_3072000_div[row_idx]
> > +								[FREF_IDX]) {
> > +					pll_div1 =
> > +						da7210_fout_3072000_div[row_idx]
> > +						[DIV1_IDX];
> 
> ...this code is shared between both branches (as well as the SRM case)
> and should be factored out between them.
> 
We are picking values from three different tables in three cases. Even
if we factor out this code, we will need a switch or if-else to identify
correct table. As we are already checking those conditions, I put the
code there. Can you please elaborate a bit, in case if I misunderstood
your point?

  reply	other threads:[~2012-01-23 11:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-23 10:07 [PATCH v2] ASoC: da7210: Add support for PLL and SRM Ashish Chavan
2012-01-23 11:21 ` [alsa-devel] " Mark Brown
2012-01-23 12:09   ` Ashish Chavan [this message]
2012-01-23 12:03     ` Mark Brown
2012-01-23 12:03       ` [alsa-devel] " Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2012-04-17 12:34 Ashish Chavan
2012-04-17 13:43 ` [alsa-devel] " Mark Brown
2012-04-17 14:21   ` Ashish Chavan
2012-04-17 14:11     ` 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=1327320561.31594.23.camel@matrix \
    --to=ashish.chavan@kpitcummins.com \
    --cc=David@alsa-project.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=david.chen@diasemi.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.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.