linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Trevor Wu (吳文良)" <Trevor.Wu@mediatek.com>
To: "robh+dt@kernel.org" <robh+dt@kernel.org>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"tiwai@suse.com" <tiwai@suse.com>,
	"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"krzysztof.kozlowski+dt@linaro.org"
	<krzysztof.kozlowski+dt@linaro.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"perex@perex.cz" <perex@perex.cz>,
	"angelogioacchino.delregno@collabora.com"
	<angelogioacchino.delregno@collabora.com>
Cc: "linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH 1/5] ASoC: mediatek: mt8188: separate ADDA playback dai from capture dai
Date: Wed, 17 May 2023 12:13:13 +0000	[thread overview]
Message-ID: <520bb4d2d65958dddba314d7fb931282959ba44e.camel@mediatek.com> (raw)
In-Reply-To: <678f3582-ff1e-033a-f8d9-f73910156d15@collabora.com>

On Wed, 2023-05-17 at 13:40 +0200, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> Il 17/05/23 13:15, Trevor Wu ha scritto:
> > MT8188 will support SOF. In SOF, be_hw_params_fixup callback are
> > used to
> > configure BE hardware parameters. However, playback and capture
> > stream
> > share the same callback function in which it can't know the stream
> > type.
> > 
> > It's possible to require different paremters for playback and
> > capture
> > stream, so separate them into two dais for SOF usage.
> > 
> > Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
> > ---
> >   sound/soc/mediatek/mt8188/mt8188-afe-common.h |  3 +-
> >   sound/soc/mediatek/mt8188/mt8188-dai-adda.c   | 76 ++++++++++--
> > -------
> >   sound/soc/mediatek/mt8188/mt8188-mt6359.c     | 34 +++++++--
> >   3 files changed, 68 insertions(+), 45 deletions(-)
> > 
> > diff --git a/sound/soc/mediatek/mt8188/mt8188-afe-common.h
> > b/sound/soc/mediatek/mt8188/mt8188-afe-common.h
> > index eb7e57c239bd..1304d685a306 100644
> > --- a/sound/soc/mediatek/mt8188/mt8188-afe-common.h
> > +++ b/sound/soc/mediatek/mt8188/mt8188-afe-common.h
> > @@ -39,7 +39,7 @@ enum {
> >       MT8188_AFE_MEMIF_END,
> >       MT8188_AFE_MEMIF_NUM = (MT8188_AFE_MEMIF_END -
> > MT8188_AFE_MEMIF_START),
> >       MT8188_AFE_IO_START = MT8188_AFE_MEMIF_END,
> > -     MT8188_AFE_IO_ADDA = MT8188_AFE_IO_START,
> > +     MT8188_AFE_IO_DL_SRC = MT8188_AFE_IO_START,
> >       MT8188_AFE_IO_DMIC_IN,
> >       MT8188_AFE_IO_DPTX,
> >       MT8188_AFE_IO_ETDM_START,
> > @@ -52,6 +52,7 @@ enum {
> >       MT8188_AFE_IO_ETDM_NUM =
> >               (MT8188_AFE_IO_ETDM_END - MT8188_AFE_IO_ETDM_START),
> >       MT8188_AFE_IO_PCM = MT8188_AFE_IO_ETDM_END,
> > +     MT8188_AFE_IO_UL_SRC,
> >       MT8188_AFE_IO_END,
> >       MT8188_AFE_IO_NUM = (MT8188_AFE_IO_END -
> > MT8188_AFE_IO_START),
> >       MT8188_DAI_END = MT8188_AFE_IO_END,
> > diff --git a/sound/soc/mediatek/mt8188/mt8188-dai-adda.c
> > b/sound/soc/mediatek/mt8188/mt8188-dai-adda.c
> > index fed9f927e623..9a6673a6f28a 100644
> > --- a/sound/soc/mediatek/mt8188/mt8188-dai-adda.c
> > +++ b/sound/soc/mediatek/mt8188/mt8188-dai-adda.c
> > @@ -53,8 +53,7 @@ enum {
> >   };
> > 
> >   struct mtk_dai_adda_priv {
> > -     unsigned int dl_rate;
> > -     unsigned int ul_rate;
> > +     bool hires_required;
> >   };
> > 
> >   static unsigned int afe_adda_dl_rate_transform(struct
> > mtk_base_afe *afe,
> 
> ..snip..
> 
> > @@ -503,13 +495,15 @@ static int mtk_dai_adda_hw_params(struct
> > snd_pcm_substream *substream,
> >       dev_dbg(afe->dev, "%s(), id %d, stream %d, rate %u\n",
> >               __func__, id, substream->stream, rate);
> > 
> > -     if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
> > -             adda_priv->dl_rate = rate;
> > +     if (rate > ADDA_HIRES_THRES)
> > +             adda_priv->hires_required = 1;
> > +     else
> > +             adda_priv->hires_required = 0;
> > +
> 
> hires_required is a boolean, so assigning 1 or 0 should be replaced
> with
> assigning true or false; regardless of that, what about...
> 
>         adda_priv->hires_required = (rate > ADDA_HIRES_THRES);
> 

It's great!! I will adopt it in V2.

Thanks,
Trevor

> > +     if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> >               ret = mtk_dai_da_configure(afe, rate, id);
> > -     } else {
> > -             adda_priv->ul_rate = rate;
> > +     else
> >               ret = mtk_dai_ad_configure(afe, rate, id);
> > -     }
> > 
> >       return ret;
> >   }
> 
> Regards,
> Angelo
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-05-17 12:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 11:15 [PATCH 0/5] ASoC: mt8188: add new board support Trevor Wu
2023-05-17 11:15 ` [PATCH 1/5] ASoC: mediatek: mt8188: separate ADDA playback dai from capture dai Trevor Wu
2023-05-17 11:40   ` AngeloGioacchino Del Regno
2023-05-17 12:13     ` Trevor Wu (吳文良) [this message]
2023-05-17 11:15 ` [PATCH 2/5] ASoC: mediatek: mt8188-mt6359: register hdmi/dp jack pins Trevor Wu
2023-05-17 11:31   ` AngeloGioacchino Del Regno
2023-05-17 12:10     ` Trevor Wu (吳文良)
2023-05-17 15:10       ` AngeloGioacchino Del Regno
2023-05-18  2:01         ` Trevor Wu (吳文良)
2023-05-17 11:15 ` [PATCH 3/5] ASoC: mediatek: common: soundcard driver add dai_fmt support Trevor Wu
2023-05-17 11:48   ` AngeloGioacchino Del Regno
2023-05-17 12:28     ` Trevor Wu (吳文良)
2023-05-17 11:15 ` [PATCH 4/5] ASoC: mediatek: mt8188-mt6359: support new board with nau88255 Trevor Wu
2023-05-17 11:54   ` AngeloGioacchino Del Regno
2023-05-17 12:41     ` Trevor Wu (吳文良)
2023-05-17 11:15 ` [PATCH 5/5] ASoC: dt-bindings: mediatek,mt8188-mt6359: update properties Trevor Wu
2023-05-17 14:43   ` Krzysztof Kozlowski
2023-05-18  2:37     ` Trevor Wu (吳文良)
2023-05-18  7:36       ` Krzysztof Kozlowski

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=520bb4d2d65958dddba314d7fb931282959ba44e.camel@mediatek.com \
    --to=trevor.wu@mediatek.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=perex@perex.cz \
    --cc=robh+dt@kernel.org \
    --cc=tiwai@suse.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;
as well as URLs for NNTP newsgroup(s).