All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Arnaud Patard <arnaud.patard@rtp-net.org>
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: Tue, 12 Oct 2010 18:16:02 +0100	[thread overview]
Message-ID: <20101012171602.GG30933@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <20101012100036.605541759@rtp-net.org>

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.

> +	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.

> +	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?

> +	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?

> +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.

> +	/* 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.

> +/*
> + * rt5623.h  --  audio driver for ALC5623
> + *

Bitrot here.

  reply	other threads:[~2010-10-12 17:16 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 [this message]
2010-10-13 17:58     ` Arnaud Patard
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=20101012171602.GG30933@rakim.wolfsonmicro.main \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnaud.patard@rtp-net.org \
    --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.