All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com
Subject: Re: [PATCH 7/7] ASoc: Codec: add sti platform codec
Date: Mon, 20 Apr 2015 21:33:28 +0100	[thread overview]
Message-ID: <20150420203328.GF14892@sirena.org.uk> (raw)
In-Reply-To: <5534C337.9080009@st.com>


[-- Attachment #1.1: Type: text/plain, Size: 2121 bytes --]

On Mon, Apr 20, 2015 at 11:13:27AM +0200, Arnaud Pouliquen wrote:
> On 04/18/2015 03:09 PM, Mark Brown wrote:

> Register definitions are already part of the driver data structure
> (stih407_data  or stih416_data) .
> Your point is that i should delete this structure?
> And then use  separate regmap_field  tables (dynamically allocated) for for
> register map
> and declare registers struct like this
> static struct reg_field sti_sas_dac_stih416[STIH416_DAC_MAX_RF] = {
>     /*STIH416_DAC_MODE*/
>     {REG_FIELD(STIH416_AUDIO_DAC_CTRL, 1, 2)},
> ...
> }

Yes, basically.

> >>+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 ret, div;
> >>+
> >>+	div = sti_sas_dai_clk_div[dai->id];
> >>+	ret = snd_soc_dai_set_clkdiv(cpu_dai, SND_SOC_CLOCK_OUT, div);
> >>+	if (ret)

> >set_clkdiv() is an external API, you shouldn't be calling it within the
> >driver - probably you should just not implement it and inline the
> >functionality here.

> how to do it properly?

Like I say probably you should just inline the functionality here.  It's
not like anything else can usefully call set_clkdiv() if the driver is
just going to do it itself anyawy.

> My point is that cpu codecs have a constraint on MCLK_FS division.
> So i need to provide it to the CPU_DAI that generates MCLK.
> I checked simple driver
> priv->mclk_fs exists but is only used to set codec dai not CPU dai...
> should i add call in simple card?

Possibly.  In general it is better to add missing functionality to
generic code rather than bodge around the generic code.  However in this
case I expect that any user of the driver (not just simple card) may
need the same configuration.  If that is the case then the driver should
just always do the configuration without needing the machine driver to
do anything so this just doesn't need to be visible outside the driver.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



      reply	other threads:[~2015-04-20 20:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-14 13:35 [PATCH 0/7] asoc: Add audio for sti platforms Arnaud Pouliquen
2015-04-14 13:35 ` [PATCH 1/7] ASoC: sti: add binding for ASoc driver Arnaud Pouliquen
2015-04-18 13:12   ` Mark Brown
2015-04-14 13:35 ` [PATCH 2/7] Asoc: sti: add uniperipheral header file Arnaud Pouliquen
2015-07-10 18:08   ` Applied "ASoC: sti: Add uniperipheral header file" to the asoc tree Mark Brown
2015-04-14 13:35 ` [PATCH 3/7] Asoc: sti: add CPU DAI driver for playback Arnaud Pouliquen
2015-04-24 18:15   ` Mark Brown
2015-04-27 13:58     ` Arnaud Pouliquen
2015-04-27 19:46       ` Mark Brown
2015-04-14 13:35 ` [PATCH 4/7] Asoc: sti: add CPU DAI driver for capture Arnaud Pouliquen
2015-04-24 18:20   ` Mark Brown
2015-04-27 14:53     ` Arnaud Pouliquen
2015-04-27 20:00       ` Mark Brown
2015-04-14 13:35 ` [PATCH 5/7] Asoc: sti: Add platform driver Arnaud Pouliquen
2015-04-14 13:35 ` [PATCH 6/7] ASoc: Add ability to build sti drivers Arnaud Pouliquen
2015-04-14 13:35 ` [PATCH 7/7] ASoc: Codec: add sti platform codec Arnaud Pouliquen
2015-04-18 13:09   ` Mark Brown
2015-04-20  9:13     ` Arnaud Pouliquen
2015-04-20 20:33       ` Mark Brown [this message]

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=20150420203328.GF14892@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnaud.pouliquen@st.com \
    --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.