public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
From: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
To: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org, garlic.tseng@mediatek.com,
	linux-mediatek@lists.infradead.org, chipeng.chang@mediatek.com,
	wsd_upstream@mediatek.com
Subject: Re: [PATCH v2 1/5] ASoC: add mt6351 codec driver
Date: Thu, 19 Apr 2018 09:58:17 +0800	[thread overview]
Message-ID: <1524103097.3290.14.camel@mtksdaap41> (raw)
In-Reply-To: <20180418164040.GG10061@sirena.org.uk>

On Wed, 2018-04-18 at 17:40 +0100, Mark Brown wrote:
Wants to clarify a few comment here, others will be update in next patch

> > +static int mt6351_codec_probe(struct snd_soc_codec *codec)
> > +{
> > +	struct mt6351_priv *priv = snd_soc_codec_get_drvdata(codec);
> > +
> > +	/* add codec controls */
> > +	snd_soc_add_codec_controls(codec,
> > +				   mt6351_snd_controls,
> > +				   ARRAY_SIZE(mt6351_snd_controls));
> > +	snd_soc_add_codec_controls(codec,
> > +				   mt6351_snd_ul_controls,
> > +				   ARRAY_SIZE(mt6351_snd_ul_controls));
> > +
> > +	mt6351_codec_init_reg(codec);
> > +
> > +	priv->ana_gain[AUDIO_ANALOG_VOLUME_HPOUTL] = 8;
> > +	priv->ana_gain[AUDIO_ANALOG_VOLUME_HPOUTR] = 8;
> > +	priv->ana_gain[AUDIO_ANALOG_VOLUME_MICAMP1] = 3;
> > +	priv->ana_gain[AUDIO_ANALOG_VOLUME_MICAMP2] = 3;
> > +
> > +	return 0;
> > +}
> 
> Can we read the configuration of the device back from the hardware?
> It's better to just use the defaults rather than set things up for a
> particular use case, that way there's a standard that can be agreed even
> if it's not good for every use case.
> 

mt6351_codec_init_reg(), regs bit in here are not govern by DAPM,
and is not optimal for low power in hardware default state.
so fixed those reg bit in optimal state by init its reg.

> > +static struct snd_soc_codec_driver mt6351_soc_codec_driver = {
> > +	.probe = mt6351_codec_probe,
> > +	.get_regmap = mt6351_get_regmap,
> 
> We're just about to remove CODEC drivers entirely and replace them with
> components - nothing else is using the get_regmap() callback.  Do you
> really need that callback, if you do we should just add it to the
> component interface?
> 
> > +	priv->regmap = dev_get_regmap(pdev->dev.parent, NULL);
> > +	if (IS_ERR(priv->regmap))
> > +		return PTR_ERR(priv->regmap);
> 
> This should be the default behaviour so I'm guessing you don't need the
> callback?

the regmap is obtain from parent dev, i assume i can use
snd_soc_component_init_regmap() as alternative for
get_regmap().callback?

Thanks

  reply	other threads:[~2018-04-19  1:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16  0:32 [PATCH v2 0/5] ASoC: mediatek: add support for mt6797 SoC KaiChieh Chuang
     [not found] ` <20180416003252.4177-1-kaichieh.chuang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2018-04-16  0:32   ` [PATCH v2 1/5] ASoC: add mt6351 codec driver KaiChieh Chuang
2018-04-18 16:40     ` Mark Brown
2018-04-19  1:58       ` KaiChieh Chuang [this message]
2018-04-19 14:41         ` Mark Brown
2018-04-20  6:54           ` KaiChieh Chuang
2018-04-20 23:49       ` KaiChieh Chuang
2018-04-23 11:39         ` Mark Brown
2018-04-16  0:32   ` [PATCH v2 2/5] ASoC: mt6797: add structure define and clock control function for 6797 KaiChieh Chuang
2018-04-16  0:32   ` [PATCH v2 3/5] ASoC: mt6797: add mt6797 platform driver KaiChieh Chuang
2018-04-18 16:46     ` Mark Brown
2018-04-19  1:51       ` KaiChieh Chuang
2018-04-19 11:29         ` Mark Brown
2018-04-16  0:32   ` [PATCH v2 4/5] ASoC: add mt6797-mt6351 driver and config option KaiChieh Chuang
2018-04-16  0:32 ` [PATCH v2 5/5] ASoC: mediatek: add documents for mt6797 KaiChieh Chuang
2018-04-18 16:46 ` [PATCH v2 0/5] ASoC: mediatek: add support for mt6797 SoC 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=1524103097.3290.14.camel@mtksdaap41 \
    --to=kaichieh.chuang@mediatek.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=chipeng.chang@mediatek.com \
    --cc=garlic.tseng@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=wsd_upstream@mediatek.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox