devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Inha Song <ideal.song@samsung.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: alsa-devel@alsa-project.org, mark.rutland@arm.com,
	devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux@arm.linux.org.uk, pawel.moll@arm.com,
	ijc+devicetree@hellion.org.uk, sbkim73@samsung.com,
	linux-kernel@vger.kernel.org, robh+dt@kernel.org,
	lgirdwood@gmail.com, tiwai@suse.de, broonie@kernel.org,
	kgene@kernel.org, s.nawrocki@samsung.com, galak@codeaurora.org,
	grant.likely@linaro.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [alsa-devel] [PATCH 1/3] ASoC: samsung: Add machine driver for Trats2
Date: Mon, 05 Jan 2015 21:40:39 +0900	[thread overview]
Message-ID: <20150105214039.2f6065fe@songinha-Samsung-DeskTop-System> (raw)
In-Reply-To: <54AA7A0B.2070004@metafoo.de>

Hi,

Thanks for your comments.


> Hi,
> 
> A few small comments inline.
> 
> On 01/05/2015 12:25 PM, Inha Song wrote:
> > --- /dev/null
> > +++ b/sound/soc/samsung/trats2_wm1811.c
> > @@ -0,0 +1,216 @@
> >[...]
> > +#include <linux/of.h>
> > +#include <linux/module.h>
> > +#include <linux/clk.h>
> > +#include <sound/soc.h>
> > +#include <sound/pcm_params.h>
> > +#include "i2s.h"
> > +#include "i2s-regs.h"
> 
> You probably don't need i2s-regs.h

OK, I will remove.

> 
> > +#include "../codecs/wm8994.h"
> > +
> > +struct trats2_machine_priv {
> > +	struct clk *clk_mclk;
> > +};
> > +
> > +static struct trats2_machine_priv trats2_wm1811_priv;
> > +
> > +static const struct snd_kcontrol_new trats2_controls[] = {
> > +	SOC_DAPM_PIN_SWITCH("SPK"),
> > +};
> > +
> > +const struct snd_soc_dapm_widget trats2_dapm_widgets[] = {
> 
> static

Sorry for my mistake.

> 
> > +	SND_SOC_DAPM_SPK("SPK", NULL),
> > +};
> > +
> > +static int trats2_aif1_hw_params(struct snd_pcm_substream *substream,
> > +				 struct snd_pcm_hw_params *params)
> > +{
> > +	struct snd_soc_pcm_runtime *rtd = substream->private_data;
> > +	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
> > +	struct snd_soc_dai *codec_dai = rtd->codec_dai;
> > +	struct trats2_machine_priv *priv = snd_soc_card_get_drvdata(rtd->card);
> > +	unsigned int sysclk_rate;
> > +	unsigned int mclk_rate =
> > +			(unsigned int)clk_get_rate(priv->clk_mclk);
> > +	int ret;
> > +
> > +	/* Set the codec DAI configuration to Master*/
> > +	ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S
> > +					| SND_SOC_DAIFMT_NB_NF
> > +					| SND_SOC_DAIFMT_CBM_CFM);
> > +	if (ret < 0) {
> > +		dev_err(codec_dai->dev,
> > +			"Failed to set codec dai format: %d\n", ret);
> > +		return ret;
> > +	}
> > +
> > +	/* Set the cpu DAI configuration to Slave */
> > +	ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S
> > +					| SND_SOC_DAIFMT_NB_NF
> > +					| SND_SOC_DAIFMT_CBM_CFM);
> > +	if (ret < 0) {
> > +		dev_err(cpu_dai->dev,
> > +			"Failed to set cpu dai format: %d\n", ret);
> > +		return ret;
> > +	}
> 
> 
> Use the dai_fmt field in the dai_link struct to setup the DAI link format. 
> This will configure both the CPU and the CODEC DAI with the specified 
> format, no need to do it manually.

Ok, move to dai_fmt.

> 
> >[...]
> > +static struct snd_soc_ops trats2_aif1_ops = {
> 
> const

I will fix this.

> 
> > +	.hw_params = trats2_aif1_hw_params,
> > +};
> > +
> > +static int trats2_init_paiftx(struct snd_soc_pcm_runtime *rtd)
> > +{
> > +	struct snd_soc_codec *codec = rtd->codec;
> > +	struct snd_soc_card *card = rtd->card;
> > +	struct trats2_machine_priv *priv = snd_soc_card_get_drvdata(card);
> > +	int ret;
> > +
> > +	ret = clk_prepare_enable(priv->clk_mclk);
> 
> Maybe just do this in the platform device probe handler and you should have 
> a matching disable call somewhere.

Ok, I will move clk_prepare_enable call to snd_soc_ops->startup
and clk_disable_unprepare call to snd_soc_ops->shutdown.

Best Regards,
Inha Song.

> 
> > +	if (ret) {
> > +		dev_err(codec->dev, "Failed to enable mclk: %d\n", ret);
> > +		return ret;
> > +	}
> > +
> > +	return 0;
> > +}
> >[...]
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2015-01-05 12:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05 11:25 [alsa-devel] [PATCH 0/3] Sound support for Exynos4412 Trats2 board Inha Song
2015-01-05 11:25 ` [alsa-devel] [PATCH 1/3] ASoC: samsung: Add machine driver for Trats2 Inha Song
     [not found]   ` <1420457117-11030-2-git-send-email-ideal.song-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-01-05 11:48     ` Lars-Peter Clausen
2015-01-05 12:40       ` Inha Song [this message]
2015-01-05 11:25 ` [alsa-devel] [PATCH 2/3] ASoC: samsung: Document Trats2 audio subsystem bindings Inha Song
2015-01-05 15:29   ` Mark Brown
2015-01-13  1:27     ` Inha Song
2015-01-05 11:25 ` [alsa-devel] [PATCH 3/3] ARM: dts: Add sound nodes for exynos4412-trats2 Inha Song

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=20150105214039.2f6065fe@songinha-Samsung-DeskTop-System \
    --to=ideal.song@samsung.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=grant.likely@linaro.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=kgene@kernel.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sbkim73@samsung.com \
    --cc=tiwai@suse.de \
    /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).