linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: garlic.tseng@mediatek.com (Garlic Tseng)
To: linux-arm-kernel@lists.infradead.org
Subject: [alsa-devel] [PATCH v2 2/9] ASoC: mediatek: implement mediatek common structure
Date: Wed, 8 Jun 2016 10:06:12 +0800	[thread overview]
Message-ID: <1465351572.4197.17.camel@mtksdaap41> (raw)
In-Reply-To: <20160607155427.GB7510@sirena.org.uk>

Hi Mark, thank for comment.

On Tue, 2016-06-07 at 16:54 +0100, Mark Brown wrote:
> On Fri, Jun 03, 2016 at 12:56:17PM +0800, Garlic Tseng wrote:
> 
> > +	/*enable agent*/
> 
> Lots of comments with missing spaces in them, there's quite a few
> examples of that in here.

I'll check all the code and fix them. 

> 
> > +EXPORT_SYMBOL(mtk_afe_fe_startup);
> 
> All the ASoC and regmap APIs are _GPL(), you really shouldn't export new
> interfaces based on them without it - the point with the _GPL() is that
> non-GPL code shouldn't be able to use the APIs.

Thanks for comment, I'll fix them.


> 
> > +EXPORT_SYMBOL(mtk_afe_fe_hw_params);
> 
> Do you need to export the individual ops rather than just the ops
> structure?
> 

Yes, in 2701 driver we modify some ops.


+/* FE DAIs */
+static const struct snd_soc_dai_ops mt2701_single_memif_dai_ops = {
+	.startup	= mt2701_simple_fe_startup,
+	.shutdown	= mtk_afe_fe_shutdown,
+	.hw_params	= mt2701_simple_fe_hw_params,
+	.hw_free	= mtk_afe_fe_hw_free,
+	.prepare	= mtk_afe_fe_prepare,
+	.trigger	= mtk_afe_fe_trigger,
+
+};

And here is one of them. Here MT2701 need one more reg control.

+static int mt2701_simple_fe_hw_params(struct snd_pcm_substream
*substream,
+				      struct snd_pcm_hw_params *params,
+				      struct snd_soc_dai *dai)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct mtk_base_afe *afe =
snd_soc_platform_get_drvdata(rtd->platform);
+	int stream_dir = substream->stream;
+
+	/*single DL use PAIR_INTERLEAVE*/
+	if (stream_dir == SNDRV_PCM_STREAM_PLAYBACK) {
+		regmap_update_bits(afe->regmap,
+				   AFE_MEMIF_PBUF_SIZE,
+				   AFE_MEMIF_PBUF_SIZE_DLM_MASK,
+				   AFE_MEMIF_PBUF_SIZE_PAIR_INTERLEAVE);
+	}
+	return mtk_afe_fe_hw_params(substream, params, dai);
+}

MT2701 need some specific reg controls. If the control is
platform-specific I tend not to put them in the common ops structure.


> > +int mtk_afe_fe_trigger(struct snd_pcm_substream *substream, int cmd,
> > +		       struct snd_soc_dai *dai)
> > +{
> > +	struct snd_soc_pcm_runtime *rtd = substream->private_data;
> > +	struct snd_pcm_runtime * const runtime = substream->runtime;
> > +	struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
> > +	struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
> > +	struct mtk_base_afe_irq *irqs = &afe->irqs[memif->irq_usage];
> > +	const struct mtk_base_irq_data *irq_data = irqs->irq_data;
> > +	unsigned int counter = runtime->period_size;
> > +	int fs;
> > +
> > +	dev_info(afe->dev, "%s %s cmd=%d\n", __func__, memif->data->name, cmd);
> 
> That's way too noisy, dev_dbg() at most.

OK. I'll fix it.

> > +static DEFINE_MUTEX(irqs_lock);
> > +int mtk_dynamic_irq_acquire(struct mtk_base_afe *afe)
> > +{
> > +	int i;
> > +
> > +	mutex_lock(&irqs_lock);
> > +	for (i = 0; i < afe->irqs_size; ++i) {
> 
> Why is the lock global and not part of the AFE struct?

I'll put it in AFE struct. Thanks.

> 
> > +void mtk_simple_isr(struct mtk_base_afe *afe, struct mtk_base_afe_memif *memif)
> > +{
> > +	snd_pcm_period_elapsed(memif->substream);
> > +}
> > +EXPORT_SYMBOL(mtk_simple_isr);
> 
> Is this really worth it over just calling _period_elapsed() directly?

I'll remove the function and just calling period_elapsed() directly.

  reply	other threads:[~2016-06-08  2:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-03  4:56 [alsa-devel] [PATCH v2 0/9] ASoC: Mediatek: Add support for MT2701 SOC Garlic Tseng
2016-06-03  4:56 ` [alsa-devel] [PATCH v2 1/9] ASoC: mediatek: Refine mt8173 driver and change config option Garlic Tseng
2016-06-03  4:56 ` [alsa-devel] [PATCH v2 2/9] ASoC: mediatek: implement mediatek common structure Garlic Tseng
2016-06-07 15:54   ` Mark Brown
2016-06-08  2:06     ` Garlic Tseng [this message]
2016-06-09 10:44       ` Mark Brown
2016-06-03  4:56 ` [alsa-devel] [PATCH v2 3/9] ASoC: mediatek: let mt8173 use " Garlic Tseng
2016-06-03  4:56 ` [alsa-devel] [PATCH v2 4/9] ASoC: mediatek: add documents for mt2701 Garlic Tseng
2016-06-29 19:16   ` Applied "ASoC: mediatek: add documents for mt2701" to the asoc tree Mark Brown
2016-06-03  4:56 ` [alsa-devel] [PATCH v2 5/9] ASoC: mediatek: add structure define and clock control for 2701 Garlic Tseng
2016-06-07 16:15   ` Mark Brown
2016-06-08  1:44     ` Garlic Tseng
2016-06-03  4:56 ` [alsa-devel] [PATCH v2 6/9] ASoC: mediatek: add mt2701 platform driver implementation Garlic Tseng
2016-06-07 16:31   ` Mark Brown
2016-06-08  3:32     ` Garlic Tseng
2016-06-09 10:44       ` Mark Brown
2016-06-03  4:56 ` [alsa-devel] [PATCH v2 7/9] ASoC: bt-sco: extend rate and add a general compatible string Garlic Tseng
2016-06-03  4:56 ` [alsa-devel] [PATCH v2 8/9] ASoC: mediatek: add BT implementation Garlic Tseng
2016-06-03  4:56 ` [alsa-devel] [PATCH v2 9/9] ASoC: mediatek: Add mt2701-cs42448 driver and config option Garlic Tseng

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=1465351572.4197.17.camel@mtksdaap41 \
    --to=garlic.tseng@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).