Thread (7 messages) flat view 7 messages, 2 authors, 2014-01-10

Re: [PATCH v2] ASoC: fsl_esai: Add ESAI CPU DAI driver

From: Nicolin Chen <hidden>
Date: 2014-01-10 02:52:57
Also in: alsa-devel, linux-devicetree, lkml

Resent this because of losing attached file.

On Fri, Jan 10, 2014 at 10:32:52AM +0800, Nicolin Chen wrote:
On Thu, Jan 09, 2014 at 06:44:53PM +0000, Mark Brown wrote:
quoted
On Thu, Jan 09, 2014 at 06:57:58PM +0800, Nicolin Chen wrote:
quoted
+/**
+ * This function configures the ratio between MCLK (HCK) and BCLK (SCK)
+ * (For DAI Master Mode only)
+ *
+ * Note: Machine driver should calculate the ratio to call this function.
+ * 	 Only effective after calling set_dai_sysclk() to set HCK direction.
+ */
+static int fsl_esai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio)
Why does the machine driver have to do this by hand, being able to
override is fine but having sensible defaults is easier?  Or does it
actually do that and the comment just needs updating?
The divider part of ESAI is pretty complicated due to caring about three
configure bits - ETO, ETI, HCKD. (I've attached a diagram to this mail.)
So setting sysclk() alone is not enough to take care all the configurations.
That's why I designed these two interfaces at the first place. And it should
be hard to find a default situation.

But there is one approach to omit this calling for machine driver is to do
the set_bclk_ratio() at this CPU DAI driver. And this might be a good idea
because we can then separate the settings between PLAYBACK and CAPTURE, even
though we might then need to check the Master or Slave state to apply the
settings accordingly.

I'll try this idea in v3 if you feel it's plausible.
quoted
quoted
+	ret = devm_snd_soc_register_component(&pdev->dev, &fsl_esai_component,
+					      &fsl_esai_dai, 1);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to register DAI: %d\n", ret);
+		return ret;
+	}
+
+	ret = imx_pcm_dma_init(pdev);
+	if (ret)
+		dev_err(&pdev->dev, "failed to init imx pcm dma: %d\n", ret);
+
+	/* Reset ESAI unit */
+	regmap_write(esai_priv->regmap, REG_ESAI_ECR, ESAI_ECR_ERST);
+
+	/*
+	 * We need to enable ESAI so as to access some of its registers.
+	 * Otherwise, we would fail to dump regmap from user space.
+	 */
+	regmap_write(esai_priv->regmap, REG_ESAI_ECR, ESAI_ECR_ESAIEN);
I would expect to see the hardware initialisation before we start
registering with the core otherwise the core might start trying to run
prior to the hardware being initialised.
Will switch this initial code in v3 as your suggestion.

Thank you,
Nicolin Chen

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help