lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 05 Jan 2015 12:48:27 +0100
From:	Lars-Peter Clausen <lars@...afoo.de>
To:	Inha Song <ideal.song@...sung.com>, alsa-devel@...a-project.org
CC:	mark.rutland@....com, devicetree@...r.kernel.org,
	linux-samsung-soc@...r.kernel.org, linux@....linux.org.uk,
	pawel.moll@....com, ijc+devicetree@...lion.org.uk,
	sbkim73@...sung.com, linux-kernel@...r.kernel.org,
	broonie@...nel.org, lgirdwood@...il.com, tiwai@...e.de,
	robh+dt@...nel.org, kgene@...nel.org, s.nawrocki@...sung.com,
	galak@...eaurora.org, grant.likely@...aro.org,
	linux-arm-kernel@...ts.infradead.org
Subject: Re: [alsa-devel] [PATCH 1/3] ASoC: samsung: Add machine driver for
 Trats2

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

> +#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

> +	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.

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

const

> +	.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.

> +	if (ret) {
> +		dev_err(codec->dev, "Failed to enable mclk: %d\n", ret);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
>[...]
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists