All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaud Pouliquen <arnaud.pouliquen@st.com>
To: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com
Subject: Re: [PATCH v2 7/9] ASoC: Codec: Add sti platform codec
Date: Mon, 1 Jun 2015 19:41:54 +0200	[thread overview]
Message-ID: <556C9962.4040508@st.com> (raw)
In-Reply-To: <20150525130124.GS21391@sirena.org.uk>



On 05/25/2015 03:01 PM, Mark Brown wrote:
>> +static int  stih407_sas_dac_supply(struct snd_soc_dapm_widget *w,
>> +				   struct snd_kcontrol *kcontrol, int event) {
>> +	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
>> +	struct sti_sas_data *drvdata = dev_get_drvdata(codec->dev);
>> +	struct sti_dac_audio *dac = &drvdata->dac;
>> +	int ret = 0;
>> +
>> +	switch (event) {
>> +	case SND_SOC_DAPM_PRE_PMU:
>> +		/* Enable analog */
>> +		ret = regmap_field_write(dac->field[STIH407_DAC_STANDBY_ANA],
>> +					 0);
>> +		/* Disable standby */
>> +		if (!ret)
>> +			ret = regmap_field_write(
>> +				dac->field[STIH407_DAC_STANDBY], 0);
>> +		break;
>
> These event functions all look very similar and I can't help but think
> that they look awfully like the sort of register write sequences that
> DAPM normally generates anyway.  Is there any great reason for not doing
> these by registering multiple widgets with routes between them rather
> than with custom code?
>
I need to respect the sequence for power up /power down. for sure I 
could manage it using 3 DAPMs with routes, but how to ensure sequence?
Moreover, i will need to implement a cpu dai DAPM to manage 
uniperipheral clock. This clock need to be enabled/disabled before/after 
DAC to avoid plop. So would prefer to manage the DAC sequence in a 
single function...

>> +static int sti_sas_hw_params(struct snd_pcm_substream *substream,
>> +			     struct snd_pcm_hw_params *params,
>> +			     struct snd_soc_dai *dai)
>> +{
>> +	struct snd_soc_codec *codec = dai->codec;
>> +	struct snd_soc_pcm_runtime *rtd = substream->private_data;
>> +	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
>> +	int div;
>> +
>> +	div = sti_sas_dai_clk_div[dai->id];
>> +	if (cpu_dai->driver->ops->set_clkdiv)
>> +		return cpu_dai->driver->ops->set_clkdiv(cpu_dai,
>> +							SND_SOC_CLOCK_OUT, div);
>> +	dev_warn(codec->dev, "WARN: CPU DAI not support sysclk div");
>
> This is worrying, we shouldn't be peering inside the CPU DAI like this.
> I'd expect this to either be done autonomously by the CPU DAI or handled
> in a machine driver.
>
I think i misunderstand your remark in V1...but i still not understand 
how you want that i implement it, if i can't neither use 
snd_soc_dai_set_clkdiv (except implement it in simple_card).
Please could you precise how you would like that i implement the feature?

I'm kind surprise that nobody else have this kind of setup. I know at 
least one codec that should need this kind of service: AK4628.
For this codec, depending on runtime frequency, a division value should 
be apply between MCLK and SCLK...

  reply	other threads:[~2015-06-01 17:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-18 12:12 [PATCH v2 0/9] asoc: Add audio for sti platforms Arnaud Pouliquen
2015-05-18 12:12 ` [PATCH v2 1/9] ASoC: sti: add binding for ASoc driver Arnaud Pouliquen
2015-05-22 12:43   ` Mark Brown
2015-05-22 13:24     ` Arnaud Pouliquen
2015-05-25 12:14       ` Mark Brown
2015-05-18 12:12 ` [PATCH v2 2/9] ASoC: sti: Add uniperipheral header file Arnaud Pouliquen
2015-05-18 12:12 ` [PATCH v2 3/9] ASoC: sti: Add CPU DAI driver for playback Arnaud Pouliquen
2015-05-25 12:37   ` Mark Brown
2015-05-26 13:51     ` Arnaud Pouliquen
2015-05-18 12:12 ` [PATCH v2 4/9] ASoC: sti: Add CPU DAI driver for capture Arnaud Pouliquen
2015-05-25 12:39   ` Mark Brown
2015-05-18 12:12 ` [PATCH v2 5/9] ASoC: sti: Add platform driver Arnaud Pouliquen
2015-05-25 12:50   ` Mark Brown
2015-05-27  8:48     ` Arnaud Pouliquen
2015-05-27 12:06       ` Lars-Peter Clausen
2015-05-18 12:12 ` [PATCH v2 6/9] ASoC: Add ability to build sti drivers Arnaud Pouliquen
2015-05-25 12:50   ` Mark Brown
2015-05-18 12:12 ` [PATCH v2 7/9] ASoC: Codec: Add sti platform codec Arnaud Pouliquen
2015-05-25 13:01   ` Mark Brown
2015-06-01 17:41     ` Arnaud Pouliquen [this message]
2015-06-02 19:12       ` Mark Brown
2015-05-18 12:12 ` [PATCH v2 8/9] ASoC: sti: Add clock adjustement control Arnaud Pouliquen
2015-05-25 14:37   ` Mark Brown
2015-05-18 12:12 ` [PATCH v2 9/9] ASoC: sti: Add IEC control Arnaud Pouliquen
2015-05-25 14:36   ` 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=556C9962.4040508@st.com \
    --to=arnaud.pouliquen@st.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@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.