All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Ladislav Michl <ladis@linux-mips.org>
Cc: alsa-devel@alsa-project.org,
	Charles Keepax <ckeepax@opensource.cirrus.com>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	anish kumar <yesanishhere@gmail.com>
Subject: Re: [PATCH 6/7] ASoC: max9867: Fix BSEL value in master mode.
Date: Wed, 28 Feb 2018 11:00:54 +0100	[thread overview]
Message-ID: <20180228100054.GJ1479@piout.net> (raw)
In-Reply-To: <20180227190338.GB1961@lenoch>

On 27/02/2018 at 20:03:38 +0100, Ladislav Michl wrote:
> On Tue, Feb 27, 2018 at 06:23:09PM +0100, Alexandre Belloni wrote:
> > This also needs a proper commit message.
> 
> Meanwhile more patches for this driver accumulated, so I'll send simple ones
> first and those I'm uncertain of later.
> 
> Now few questions:
> - should hw_params emit any error message when asked to set for example
>   unsupported sample rate? Many drivers do so, but it seems strange.

I would thin that is correct because then the eror goes up to userspace
and it knows it has to resample.

> - table used in this driver is overkill, frequencies can be calculated
>   directly (patch ready), but that brings question about
>   SNDRV_PCM_RATE_CONTINUOUS: what does it exactly mean? What if codec is
>   able to set "any" rate, but there are rounding errors?
> 

That is a good question I can't answer.

> > On 30/01/2018 at 12:10:33 +0100, Ladislav Michl wrote:
> > > Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> > > ---
> > >  Note: It should be reconsidered where BSEL should be set.
> > > 
> > >  sound/soc/codecs/max9867.c | 43 +++----------------------------------------
> > >  1 file changed, 3 insertions(+), 40 deletions(-)
> > > 
> > > diff --git a/sound/soc/codecs/max9867.c b/sound/soc/codecs/max9867.c
> > > index 026b7cf94910..6272cf5df4a9 100644
> > > --- a/sound/soc/codecs/max9867.c
> > > +++ b/sound/soc/codecs/max9867.c
> > > @@ -148,46 +148,6 @@ static int max9867_dai_hw_params(struct snd_pcm_substream *substream,
> > >  			MAX9867_RAPID_LOCK, MAX9867_RAPID_LOCK);
> > >  		regmap_update_bits(max9867->regmap, MAX9867_AUDIOCLKHIGH,
> > >  			MAX9867_PLL, MAX9867_PLL);
> > > -	} else {
> > > -		unsigned long int bclk_rate, pclk_bclk_ratio;
> > > -		int bclk_value;
> > > -
> > > -		bclk_rate = params_rate(params) * 2 * params_width(params);
> > > -		pclk_bclk_ratio = max9867->pclk/bclk_rate;
> > > -		switch (params_width(params)) {
> > > -		case 8:
> > > -		case 16:
> > > -			switch (pclk_bclk_ratio) {
> > > -			case 2:
> > > -				bclk_value = MAX9867_IFC1B_PCLK_2;
> > > -				break;
> > > -			case 4:
> > > -				bclk_value = MAX9867_IFC1B_PCLK_4;
> > > -				break;
> > > -			case 8:
> > > -				bclk_value = MAX9867_IFC1B_PCLK_8;
> > > -				break;
> > > -			case 16:
> > > -				bclk_value = MAX9867_IFC1B_PCLK_16;
> > > -				break;
> > > -			default:
> > > -				dev_err(codec->dev,
> > > -					"unsupported sampling rate\n");
> > > -				return -EINVAL;
> > > -			}
> > > -			break;
> > > -		case 24:
> > > -			bclk_value = MAX9867_IFC1B_24BIT;
> > > -			break;
> > > -		case 32:
> > > -			bclk_value = MAX9867_IFC1B_32BIT;
> > > -			break;
> > > -		default:
> > > -			dev_err(codec->dev, "unsupported sampling rate\n");
> > > -			return -EINVAL;
> > > -		}
> > > -		regmap_update_bits(max9867->regmap, MAX9867_IFC1B,
> > > -			MAX9867_IFC1B_BCLK_MASK, bclk_value);
> > >  	}
> > >  	return 0;
> > >  }
> > > @@ -244,6 +204,9 @@ static int max9867_set_dai_sysclk(struct snd_soc_dai *codec_dai,
> > >  	value &= ~MAX9867_FREQ_MASK;
> > >  	regmap_update_bits(max9867->regmap, MAX9867_SYSCLK,
> > >  			MAX9867_PSCLK_MASK, value);
> > > +	regmap_update_bits(max9867->regmap, MAX9867_IFC1B,
> > > +			MAX9867_IFC1B_BCLK_MASK, 0x010);
> > 
> > This magic value has to be defined somewhere.
> > 
> > > +
> > >  	return 0;
> > >  }
> > >  
> > > -- 
> > > 2.15.1
> > > 
> > 
> > -- 
> > Alexandre Belloni, Bootlin (formerly Free Electrons)
> > Embedded Linux and Kernel engineering
> > https://bootlin.com

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2018-02-28 10:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30 11:06 [PATCH 0/7] Let Atmel use simple-audio-card Ladislav Michl
2018-01-30 11:06 ` [PATCH 1/7] ASoC: atmel: Remove redundant dev_err() call in probe function Ladislav Michl
2018-02-27 16:54   ` Alexandre Belloni
2018-02-27 17:13     ` Nicolas Ferre
2018-03-01 18:06   ` Applied "ASoC: atmel: Remove redundant dev_err() call in probe function" to the asoc tree Mark Brown
2018-01-30 11:08 ` [PATCH 2/7] ASoC: atmel_ssc_dai: Fix TCMR settings in I2S slave mode Ladislav Michl
2018-02-27 17:09   ` Alexandre Belloni
2018-02-27 18:50     ` Ladislav Michl
2018-01-30 11:08 ` [PATCH 3/7] ASoC: simple_card_utils: Set clock frequency Ladislav Michl
2018-02-27 17:19   ` Alexandre Belloni
2018-01-30 11:09 ` [PATCH 4/7] ASoC: max9867: Show Kconfig entry Ladislav Michl
2018-03-01 18:06   ` Applied "ASoC: max9867: Show Kconfig entry" to the asoc tree Mark Brown
2018-01-30 11:10 ` [PATCH 5/7] ASoC: max9867: Calculate LRCLK divider Ladislav Michl
2018-01-30 11:10 ` [PATCH 6/7] ASoC: max9867: Fix BSEL value in master mode Ladislav Michl
2018-02-27 17:23   ` Alexandre Belloni
2018-02-27 19:03     ` Ladislav Michl
2018-02-28 10:00       ` Alexandre Belloni [this message]
2018-02-28 10:23         ` Ladislav Michl
2018-02-28 10:28           ` Alexandre Belloni
2018-01-30 11:11 ` [PATCH 7/7] ASoC: max9867: Take chip out of shutdown Ladislav Michl

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=20180228100054.GJ1479@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=ladis@linux-mips.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=yesanishhere@gmail.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.