All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Eason Yen <eason.yen@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
	jiaxin.yu@mediatek.com, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org,
	wsd_upstream@mediatek.com
Subject: Re: [PATCH 2/2] ASoC: codec: mediatek: add mt6359 codec driver
Date: Thu, 12 Mar 2020 19:08:05 +0000	[thread overview]
Message-ID: <20200312190805.GJ4038@sirena.org.uk> (raw)
In-Reply-To: <1583995387.19248.93.camel@mtkswgap22>

[-- Attachment #1: Type: text/plain, Size: 2636 bytes --]

On Thu, Mar 12, 2020 at 02:43:07PM +0800, Eason Yen wrote:
> On Wed, 2020-03-11 at 12:12 +0000, Mark Brown wrote:
> > On Wed, Mar 11, 2020 at 05:22:24PM +0800, Eason Yen wrote:
> > > On Mon, 2020-03-09 at 13:13 +0000, Mark Brown wrote:

> > > The following functions are used to set:
> > > - playback_gpio_set/playback_gpio_reset
> > > - capture_gpio_set/capture_gpio_reset
> > > - vow_gpio_set/vow_gpio_reset

> > This sounds like it should be handled at the machine driver level, it's
> > possible some system integrator will wire things up differently.

> machine driver will set default at booting stage to execute
> mt6359_mtkaif_calibration_enable and mt6359_mtkaif_calibration_disable.

> And at runtime stage, it is triggered by mt_dl_gpio_event and
> mt_ul_gpio_event while playback or capture.

What I'm suggesting is moving those to the machine driver (you could
provide helpers in the CODEC driver for the common case I guess...  I'd
need to review).

> OK. So it is better to fix mic_type (ACC/DMIC/DCC/DCC_*) at init stage
> because it will not be changed at runtime.

> And use another dpam mux or kcontrol to enable/disable vow for low power
> scenario.

> Is it right?

Yes.

> enum {
> 	LO_MUX_OPEN = 0,
> 	LO_MUX_L_DAC,
> 	LO_MUX_3RD_DAC,
> 	LO_MUX_TEST_MODE,
> 	LO_MUX_MASK = 0x3,
> };
> 
> static const char * const lo_in_mux_map[] = {
> 	"Open", "Playback_L_DAC", "Playback", "Test Mode"
> };
> 
> static SOC_ENUM_SINGLE_DECL(lo_in_mux_map_enum,
> 			    SND_SOC_NOPM, 0, lo_in_mux_map);
> 
> static const struct snd_kcontrol_new lo_in_mux_control =
> 	SOC_DAPM_ENUM("LO Select", lo_in_mux_map_enum);

That looks OK.

> > > > > +static int mt_delay_250_event(struct snd_soc_dapm_widget *w,
> > > > > +			      struct snd_kcontrol *kcontrol,
> > > > > +			      int event)
> > > > > +{
> > > > > +	switch (event) {
> > > > > +	case SND_SOC_DAPM_POST_PMU:
> > > > > +	case SND_SOC_DAPM_PRE_PMD:
> > > > > +		usleep_range(250, 270);

> > > > Why would having a sleep before power down be useful?

> > > It is based on designer's control sequence to add some delay while
> > > PMU/PMD.

> > But how does the designer know when the sequence starts?  Don't they
> > mean to have a delay *after* power down?

> For PMU, designer think 
> "AUD_CK" --> wait at least 250ms --> "AUDIF_CK" --> next ...

> For PMD, designer think 
> "AUDIF_CK" --> wait at least 250ms --> "AUD_CK" --> next ...

I think you need some comments about this in the code, it looks like a
mistake - it relies on the use of sequenced widgets, you should
reference that.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: Eason Yen <eason.yen@mediatek.com>
Cc: devicetree@vger.kernel.org, wsd_upstream@mediatek.com,
	linux-kernel@vger.kernel.org, jiaxin.yu@mediatek.com,
	linux-mediatek@lists.infradead.org,
	Matthias Brugger <matthias.bgg@gmail.com>
Subject: Re: [PATCH 2/2] ASoC: codec: mediatek: add mt6359 codec driver
Date: Thu, 12 Mar 2020 19:08:05 +0000	[thread overview]
Message-ID: <20200312190805.GJ4038@sirena.org.uk> (raw)
In-Reply-To: <1583995387.19248.93.camel@mtkswgap22>


[-- Attachment #1.1: Type: text/plain, Size: 2636 bytes --]

On Thu, Mar 12, 2020 at 02:43:07PM +0800, Eason Yen wrote:
> On Wed, 2020-03-11 at 12:12 +0000, Mark Brown wrote:
> > On Wed, Mar 11, 2020 at 05:22:24PM +0800, Eason Yen wrote:
> > > On Mon, 2020-03-09 at 13:13 +0000, Mark Brown wrote:

> > > The following functions are used to set:
> > > - playback_gpio_set/playback_gpio_reset
> > > - capture_gpio_set/capture_gpio_reset
> > > - vow_gpio_set/vow_gpio_reset

> > This sounds like it should be handled at the machine driver level, it's
> > possible some system integrator will wire things up differently.

> machine driver will set default at booting stage to execute
> mt6359_mtkaif_calibration_enable and mt6359_mtkaif_calibration_disable.

> And at runtime stage, it is triggered by mt_dl_gpio_event and
> mt_ul_gpio_event while playback or capture.

What I'm suggesting is moving those to the machine driver (you could
provide helpers in the CODEC driver for the common case I guess...  I'd
need to review).

> OK. So it is better to fix mic_type (ACC/DMIC/DCC/DCC_*) at init stage
> because it will not be changed at runtime.

> And use another dpam mux or kcontrol to enable/disable vow for low power
> scenario.

> Is it right?

Yes.

> enum {
> 	LO_MUX_OPEN = 0,
> 	LO_MUX_L_DAC,
> 	LO_MUX_3RD_DAC,
> 	LO_MUX_TEST_MODE,
> 	LO_MUX_MASK = 0x3,
> };
> 
> static const char * const lo_in_mux_map[] = {
> 	"Open", "Playback_L_DAC", "Playback", "Test Mode"
> };
> 
> static SOC_ENUM_SINGLE_DECL(lo_in_mux_map_enum,
> 			    SND_SOC_NOPM, 0, lo_in_mux_map);
> 
> static const struct snd_kcontrol_new lo_in_mux_control =
> 	SOC_DAPM_ENUM("LO Select", lo_in_mux_map_enum);

That looks OK.

> > > > > +static int mt_delay_250_event(struct snd_soc_dapm_widget *w,
> > > > > +			      struct snd_kcontrol *kcontrol,
> > > > > +			      int event)
> > > > > +{
> > > > > +	switch (event) {
> > > > > +	case SND_SOC_DAPM_POST_PMU:
> > > > > +	case SND_SOC_DAPM_PRE_PMD:
> > > > > +		usleep_range(250, 270);

> > > > Why would having a sleep before power down be useful?

> > > It is based on designer's control sequence to add some delay while
> > > PMU/PMD.

> > But how does the designer know when the sequence starts?  Don't they
> > mean to have a delay *after* power down?

> For PMU, designer think 
> "AUD_CK" --> wait at least 250ms --> "AUDIF_CK" --> next ...

> For PMD, designer think 
> "AUDIF_CK" --> wait at least 250ms --> "AUD_CK" --> next ...

I think you need some comments about this in the code, it looks like a
mistake - it relies on the use of sequenced widgets, you should
reference that.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

  reply	other threads:[~2020-03-12 19:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-06  3:33 [PATCH 0/2] Add mediatek codec mt6359 driver Eason Yen
2020-03-06  3:33 ` Eason Yen
2020-03-06  3:33 ` [PATCH 1/2] ASoC: mediatek: mt6359: add codec document Eason Yen
2020-03-06  3:33   ` Eason Yen
2020-03-12 19:05   ` Rob Herring
2020-03-12 19:05     ` Rob Herring
2020-03-06  3:33 ` [PATCH 2/2] ASoC: codec: mediatek: add mt6359 codec driver Eason Yen
2020-03-06  3:33   ` Eason Yen
2020-03-09 13:13   ` Mark Brown
2020-03-09 13:13     ` Mark Brown
2020-03-11  9:22     ` Eason Yen
2020-03-11  9:22       ` Eason Yen
2020-03-11 12:12       ` Mark Brown
2020-03-11 12:12         ` Mark Brown
2020-03-12  6:43         ` Eason Yen
2020-03-12  6:43           ` Eason Yen
2020-03-12 19:08           ` Mark Brown [this message]
2020-03-12 19: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=20200312190805.GJ4038@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=eason.yen@mediatek.com \
    --cc=jiaxin.yu@mediatek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --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 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.