From: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org, Saeed Bishara <saeed@marvell.com>,
Martin Michlmayr <tbm@cyrius.com>,
Liam Girdwood <lrg@slimlogic.co.uk>
Subject: Re: [patch 1/3] ASoC: add support for alc562[123] codecs
Date: Wed, 13 Oct 2010 19:58:03 +0200 [thread overview]
Message-ID: <871v7ux9ec.fsf@lechat.rtp-net.org> (raw)
In-Reply-To: <20101012171602.GG30933@rakim.wolfsonmicro.main> (Mark Brown's message of "Tue\, 12 Oct 2010 18\:16\:02 +0100")
Mark Brown <broonie@opensource.wolfsonmicro.com> writes:
Hi,
> On Tue, Oct 12, 2010 at 11:44:54AM +0200, Arnaud Patard wrote:
>
>> This patch is adding support for alc562[123] codecs. It's based
>> on the source code available in HP source code and other places.
>
> Looks very good - a few minor things below but they should be fairly
> easy to fix up.
>
>> +static int amp_mixer_event(struct snd_soc_dapm_widget *w,
>> + struct snd_kcontrol *kcontrol, int event)
>> +{
>> + /* index 0x46: class-d internal register */
>> + snd_soc_write(w->codec, ALC5623_HID_CTRL_INDEX, 0x46);
>
> This is a bit magic; some comments would help.
ok. I've added a comment. The aim is to power on/off the class-d amp
parts and to do that one has to write to index-46h reg and to do that
one has to write 0x46 to ALC5623_HID_CTRL_INDEX and then the value into
ALC5623_HID_CTRL_DATA.
>
>> + if (pll_id == ALC5623_PLL_FR_MCLK) {
>> + for (i = 0; i < ARRAY_SIZE(codec_master_pll_div); i++) {
>> + if (codec_master_pll_div[i].pll_in == freq_in
>> + && codec_master_pll_div[i].pll_out == freq_out) {
>> + /* PLL source from MCLK */
>> + pll_div = codec_master_pll_div[i].regvalue;
>> + break;
>> + }
>> + }
>> + } else {
>> + for (i = 0; i < ARRAY_SIZE(codec_slave_pll_div); i++) {
>
> I'd expect a switch statement here.
ok.
>
>> + coeff = get_coeff(codec, rate);
>> + if (coeff >= 0) {
>> + coeff = coeff_div[coeff].regvalue;
>> + dev_dbg(codec->dev, "%s: sysclk=%d,rate=%d,coeff=0x%04x\n",
>> + __func__, alc5623->sysclk, rate, coeff);
>> + snd_soc_write(codec, ALC5623_STEREO_AD_DA_CLK_CTRL, coeff);
>> + }
>
> Shouldn't we be returning an error if we can't get coefficients?
I was hoping that current value of the ALC5623_STEREO_AD_DA_CLK_CTRL
would be ok but you're probably right. It should be safer to return an
error.
>
>> + switch (level) {
>> + case SND_SOC_BIAS_ON:
>> + enable_power_depop(codec);
>> + break;
>
> enable_power_depop() takes a rather long time - about 500ms - which is
> surprising for _ON. Are you sure it should be done here?
It was there in the original driver and when working on this driver, I
didn't see any reason for moving it elsewhere. tbh, if I have to move it
elsewhere, I don't know where I'll put it.
>
>> +static int alc5623_suspend(struct snd_soc_codec *codec, pm_message_t mesg)
>> +{
>> + /* we only need to suspend if we are a valid card */
>> + if (!codec->card)
>> + return 0;
>
> This isn't needed any more, this won't get called if there isn't a card.
ok. removed.
>
>> + /* charge alc5623 caps */
>> + if (codec->suspend_bias_level == SND_SOC_BIAS_ON) {
>> + alc5623_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
>> + codec->bias_level = SND_SOC_BIAS_ON;
>> + schedule_delayed_work(&codec->delayed_work,
>> + msecs_to_jiffies(caps_charge));
>> + }
>
> Just go directly to the bias level you want, don't use delayed work.
> ASoC will already do resume out of line with the main system so there's
> no need to do this and it will disrupt audio operation just after resume
> if you do it.
ok.
Arnaud
next prev parent reply other threads:[~2010-10-13 17:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-12 9:44 [patch 0/3] ALC562[123] / t5325 sound support - try 2 Arnaud Patard
2010-10-12 9:44 ` [patch 1/3] ASoC: add support for alc562[123] codecs Arnaud Patard
2010-10-12 17:16 ` Mark Brown
2010-10-13 17:58 ` Arnaud Patard [this message]
2010-10-13 18:03 ` Mark Brown
2010-10-13 18:22 ` Arnaud Patard
2010-10-12 9:44 ` [patch 2/3] kirkwood: Add audio support to hp t5325 thin clients Arnaud Patard
2010-10-12 17:17 ` Mark Brown
2010-10-12 9:44 ` [patch 3/3] t5325: add audio support Arnaud Patard
2010-10-12 17:18 ` Mark Brown
2010-10-13 18:01 ` Arnaud Patard
2010-10-13 18:06 ` Mark Brown
2010-10-13 18:25 ` Arnaud Patard
2010-10-13 18:43 ` Mark Brown
-- strict thread matches above, loose matches on Subject: below --
2010-09-07 7:01 [patch 0/3] ASoC: t5325 " Arnaud Patard
2010-09-07 7:01 ` [patch 1/3] ASoC: add support for alc562[123] codecs Arnaud Patard
2010-09-07 10:21 ` Mark Brown
2010-09-07 13:23 ` Arnaud Patard
2010-09-08 10:08 ` 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=871v7ux9ec.fsf@lechat.rtp-net.org \
--to=arnaud.patard@rtp-net.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=lrg@slimlogic.co.uk \
--cc=saeed@marvell.com \
--cc=tbm@cyrius.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.