From: Nicolas Boichat <drinkcat@chromium.org>
To: Mark Brown <broonie@kernel.org>
Cc: Oder Chiou <oder_chiou@realtek.com>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
Takashi Iwai <tiwai@suse.de>, Liam Girdwood <lgirdwood@gmail.com>,
"koro.chen@mediatek.com" <koro.chen@mediatek.com>,
Bard Liao <bardliao@realtek.com>
Subject: Re: [PATCH v2 1/3] ASoC: rt5645: Simplify rt5645_enable_push_button_irq
Date: Wed, 15 Jul 2015 09:05:30 +0800 [thread overview]
Message-ID: <20150715010530.GA10273@google.com> (raw)
In-Reply-To: <20150714102833.GP11162@sirena.org.uk>
On Tue, Jul 14, 2015 at 6:28 PM, Mark Brown <broonie@kernel.org> wrote:
> On Tue, Jul 14, 2015 at 10:09:44AM +0000, Bard Liao wrote:
>
>> Thanks for the review. I think what we need is something like
>> + snd_soc_dapm_force_enable_pin(dapm, "ADC L power");
>> + snd_soc_dapm_force_enable_pin(dapm, "ADC R power");
>> + snd_soc_dapm_sync(dapm);
>> + if (!codec->component.card->instantiated) {
>> + regmap_update_bits(rt5645->regmap, RT5645_PWR_DIG1,
>> + RT5645_PWR_ADC_L_BIT | RT5645_PWR_ADC_R_BIT,
>> + RT5645_PWR_ADC_L_BIT | RT5645_PWR_ADC_R_BIT);
>> + }
>
> Yes, that's more what I'd expect. You could probably just do the regmap
> update unconditionally since it shouldn't make any difference but it's a
> bit neater this way.
rt5645_enable_push_button_irq (where this code is added), is only called
from rt5645_jack_detect, where this kind of pattern is currently common:
if (codec->component.card->instantiated)
snd_soc_dapm_force_enable_pin(dapm, ...)
else
regmap_update_bits(...)
Not saying this is right, but if we fix this one we should fix them all.
The problem that I'm trying to solve with this series, is that rt5645->codec
might still be null when rt5645_jack_detect and rt5645_enable_push_button_irq
are first called, so in some cases we do not have a valid dapm pointer yet,
and the test above is modified in 3/3 of the series...
If you look at patch 3/3 of the series, I do something like this, early in
the function:
+ struct snd_soc_dapm_context *dapm = NULL;
+
+ if (rt5645->codec && rt5645->codec->component.card->instantiated) {
+ dapm = snd_soc_codec_get_dapm(rt5645->codec);
+ }
and then use this pattern:
if (dapm)
snd_soc_dapm_force_enable_pin(dapm, ...)
else
regmap_update_bits(...)
If guess something like this might be preferable:
if (rt5645->codec) {
dapm = snd_soc_codec_get_dapm(rt5645->codec);
}
and then:
if (dapm)
snd_soc_dapm_force_enable_pin(dapm, ...)
regmap_update_bits(...)
Does that make sense?
Is there a better way to communicate my intent in this series? Maybe
patch 1/3 should convert everyhing to this pattern:
snd_soc_dapm_force_enable_pin(dapm, ...)
regmap_update_bits(...)
And then 3/3 would add the if (dapm) tests?
Thanks for the feedback.
next prev parent reply other threads:[~2015-07-15 1:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-14 6:51 [PATCH v2 0/3] ASoC: rt5645: Remove codec dependency in workqueue handler Nicolas Boichat
2015-07-14 6:51 ` [PATCH v2 1/3] ASoC: rt5645: Simplify rt5645_enable_push_button_irq Nicolas Boichat
2015-07-14 9:48 ` Bard Liao
2015-07-14 9:52 ` Mark Brown
2015-07-14 10:09 ` Bard Liao
2015-07-14 10:28 ` Mark Brown
2015-07-15 1:05 ` Nicolas Boichat [this message]
2015-07-15 8:50 ` Mark Brown
2015-07-15 11:50 ` Nicolas Boichat
2015-07-15 11:56 ` Mark Brown
2015-07-15 13:03 ` Bard Liao
2015-07-16 3:05 ` Nicolas Boichat
2015-07-14 6:51 ` [PATCH v2 2/3] ASoC: rt5645: Remove irq_jack_detection function Nicolas Boichat
2015-07-15 11:55 ` Applied "ASoC: rt5645: Remove irq_jack_detection function" to the asoc tree Mark Brown
2015-07-14 6:51 ` [PATCH v2 3/3] ASoC: rt5645: Remove codec dependency in workqueue handler Nicolas Boichat
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=20150715010530.GA10273@google.com \
--to=drinkcat@chromium.org \
--cc=alsa-devel@alsa-project.org \
--cc=bardliao@realtek.com \
--cc=broonie@kernel.org \
--cc=koro.chen@mediatek.com \
--cc=lgirdwood@gmail.com \
--cc=oder_chiou@realtek.com \
--cc=tiwai@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).