From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Stephen Warren <swarren@wwwdotorg.org>
Cc: Oder Chiou <oder_chiou@realtek.com>,
alsa-devel@alsa-project.org, Stephen Warren <swarren@nvidia.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Bard Liao <bardliao@realtek.com>, Flove <flove@realtek.com>
Subject: Re: [PATCH] ASoC: add RT5640 CODEC driver
Date: Wed, 27 Mar 2013 23:07:30 +0000 [thread overview]
Message-ID: <20130327230730.GA18316@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <515377AD.9080704@wwwdotorg.org>
[-- Attachment #1.1: Type: text/plain, Size: 4949 bytes --]
On Wed, Mar 27, 2013 at 04:50:21PM -0600, Stephen Warren wrote:
> On 03/26/2013 07:15 PM, Mark Brown wrote:
> > On Tue, Mar 26, 2013 at 05:35:38PM -0600, Stephen Warren wrote:
> >> +/* IN1/IN2 Input Type */ +static const char * const
> >> rt5640_input_mode[] = { + "Single ended", "Differential"};
> > This looks like platform data.
> I thought the idea was to expose all the CODEC's configuration/routing
> through DAPM, and then let everything get set up through controls at
Given that changing between single ended and differential generally
involves a modification of the circuit this is something we know at
build time in the same way we know how the microphone biases are wired
up. Changing it would generally need to be coordinated with some
external circuit (eg, flipping an analouge switch to reroute the
signals) and hence done from the machine driver.
> run-time? Looking at the WM8903 driver, it seems like it has the exact
> same kind of option.
Older drivers aren't always good examples of this stuff.
> >> +/* DMIC */ +static const char * const rt5640_dmic_mode[] =
> >> {"Disable", "DMIC1", "DMIC2"}; + +static const
> >> SOC_ENUM_SINGLE_DECL(rt5640_dmic_enum, 0, 0, rt5640_dmic_mode);
> > DAPM?
> I'm not sure what change you're asking for here; isn't this defining a
> control that influences the DAPM routing?
It looks like just a plain old enum to me.
> Perhaps the issue is that the enum above feeds into a snd_kcontrol,
> rather than being an snd_soc_dapm_route that's conditional upon one of
> the values in that list?
Probably, or a mux or something.
> I'm not really sure what MIC1/MIC2 are meant to represent...
I think they're supposed to represent the microphones someone might
connect to the inputs but that should be done in the machine driver.
> > Shouldn't the DMIC CLK widget be handling the clock enables/muxes
> > from the DMIC event above?
> Oh right, so you mean:
> * Add a SND_SOC_DAPM_OUTPUT() for the "DMIC CLK".
No need for that, it can just be handled as a supply within the device
since it's an integral part of the DMIC interface.
> * Add routing table entries where "DMIC1 *" are each fed from "DMIC
> CLK", with "conditions" based on which DMIC is "on":
> {"DMIC L1" "DMIC1" "DMIC CLK"},
> {"DMIC R1" "DMIC1" "DMIC CLK"},
> {"DMIC L2" "DMIC2" "DMIC CLK"},
> {"DMIC R2" "DMIC2" "DMIC CLK"},
> or something like that?
Pretty much.
> >> +static int get_sdp_info(struct snd_soc_codec *codec, int
> >> dai_id)
> >> + bclk_ms = frame_size > 32 ? 1 : 0;
> > Grumble.
> Sorry, I don't understand the issue here. (through lack of familiarity
> with the issue; I'm not saying there isn't one).
I don't like the ternery operator where it's not especially idiomatic,
if I wanted to read line noise I'd be working with perl.
> >> +static int rt5640_prepare(struct snd_pcm_substream *substream, +
> >> struct snd_soc_dai *dai) +{ + struct snd_soc_pcm_runtime *rtd =
> >> substream->private_data; + struct snd_soc_codec *codec =
> >> rtd->codec; + struct rt5640_priv *rt5640 =
> >> snd_soc_codec_get_drvdata(codec); + + rt5640->aif_pu = dai->id; +
> >> return 0; +}
> > This looks like only one DAI can be active at once, shouldn't there
> > be some sort of checking for busy here?
> I haven't read the spec through in explicit detail, but I didn't see
> anything to indicate that only one DAI could be active at once. In
> fact the diagrams in the documentation make it look at least somewhat
> cross-bar-like.
> It looks like rt5640->aif_pu is used solely by set_dmic_clk() to
> somehow derive the DMIC CLK from the DAI LRCLK based on which DAI is
> actually active. I assume "which DAI is actually active" should be
> implemented as "which DAI is routed from the DMICs". I guess this
> should be implemented in a very different way then?
Probably, yes. This code really doesn't look like it'll work properly
if the two interfaces are running at once, especially if they are
started simultaneously.
> I wonder if this all shouldn't be explicitly represented by DAPM
> widgets/routes, but the diagrams and text in the documentation aren't
> particularly clear on what this third thing is that the code seems to
> support:-(
Yes, putting it all into DAPM seems like the way forward.
> >> +static int rt5640_resume(struct snd_soc_codec *codec) +{ + int
> >> ret = 0 ; + + codec->cache_sync = 1; + ret =
> >> snd_soc_cache_sync(codec); + if (ret) { + dev_err(codec->dev,
> >> "Failed to sync cache: %d\n", ret); + return ret; + } +
> >> rt5640_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
> > We also sync the cache in the bias management code.
> In other words, I should just remove the call to
> snd_soc_cache_sync(codec) here, since it's redundant?
Or remove it from the bias management since there's no regulator or
other code I can see which cuts the power or otherwise resets the device
so restoring the cache outside of suspend is probably a waste of time at
the minute.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2013-03-27 23:07 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1364340938-17175-1-git-send-email-swarren@wwwdotorg.org>
2013-03-27 1:15 ` [PATCH] ASoC: add RT5640 CODEC driver Mark Brown
2013-03-27 22:50 ` Stephen Warren
2013-03-27 23:07 ` Mark Brown [this message]
[not found] ` <1121E117AD4ECE49880A389A396215BB8718BB370D@rtitmbs7.realtek.com.tw>
[not found] ` <516DD0D4.5070409@wwwdotorg.org>
2013-04-17 14:01 ` Mark Brown
2013-04-17 15:18 ` Stephen Warren
2013-04-17 15:28 ` Mark Brown
2013-04-17 16:25 ` Stephen Warren
2013-04-17 18:52 ` Mark Brown
2013-04-17 18:56 ` Stephen Warren
2013-04-17 19:13 ` Mark Brown
[not found] <1366121437-19396-1-git-send-email-bardliao@realtek.com>
[not found] ` <20130416143807.GJ26958@opensource.wolfsonmicro.com>
2013-04-22 7:03 ` Bard
2013-04-22 14:06 ` Mark Brown
[not found] <1369983899-13580-1-git-send-email-bardliao@realtek.com>
2013-06-03 15:35 ` Mark Brown
2013-06-04 6:39 ` Bard Liao
2013-06-04 9:53 ` Mark Brown
[not found] ` <1121E117AD4ECE49880A389A396215BB8A8969924B@rtitmbs7.realtek.com.tw>
2013-06-03 15:48 ` Stephen Warren
2013-06-04 6:23 ` Bard Liao
2013-06-04 21:51 ` Stephen Warren
2013-06-04 22:05 ` Stephen Warren
2013-06-05 10:02 ` Bard Liao
[not found] <1370927416-12216-1-git-send-email-bardliao@realtek.com>
2013-06-11 9:12 ` Mark Brown
2013-06-11 17:36 ` Stephen Warren
2013-06-12 7:47 ` Bard Liao
2013-06-11 17:41 ` Stephen Warren
2013-06-12 7:56 ` Bard Liao
2013-06-12 15:31 ` Mark Brown
2013-06-11 20:43 ` Stephen Warren
2013-06-12 16:42 ` 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=20130327230730.GA18316@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=bardliao@realtek.com \
--cc=flove@realtek.com \
--cc=lgirdwood@gmail.com \
--cc=oder_chiou@realtek.com \
--cc=swarren@nvidia.com \
--cc=swarren@wwwdotorg.org \
/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.