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  linux-cve-announce  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:	Thu, 6 Nov 2014 13:37:20 +0000
From:	Mark Brown <broonie@...nel.org>
To:	Peter Rosin <peda@...ator.liu.se>
Cc:	alsa-devel@...a-project.org, Liam Girdwood <lgirdwood@...il.com>,
	linux-kernel@...r.kernel.org, Peter Rosin <peda@...ntia.se>
Subject: Re: [PATCH 1/2] ASoC: tfa9879: New driver for NXP Semiconductors
 TFA9879 amplifier.

On Thu, Nov 06, 2014 at 01:54:00PM +0100, Peter Rosin wrote:

> +#define TFA9879_REG(codec, reg, field, value)				\
> +	snd_soc_update_bits(codec, TFA9879_ ## reg,			\
> +			    TFA9879_ ## field ## _MASK,			\
> +			    (value) << TFA9879_ ## field ## _SHIFT)

Please don't do stuff like this, it just makes the code look more
obscure than it should be for people who work with multiple devices -
just use update_bits() directly.

> +static int tfa9879_prepare(struct snd_pcm_substream *substream,
> +			   struct snd_soc_dai *dai)
> +{
> +	struct snd_soc_codec *codec = dai->codec;
> +
> +	TFA9879_REG(codec, DEVICE_CONTROL, POWERUP, 1);

Use DAPM to manage power, you're probably looking for a supply widget.

> +	switch (params_format(params)) {
> +	case SNDRV_PCM_FORMAT_S16_LE:

Use params_width() rather than a specific memory layout.

> +	if (tfa9879->lsb_justified)
> +		TFA9879_REG(codec, SERIAL_INTERFACE_1, I2S_SET, i2s_set);

Why does this need to be reset every time, shouldn't we just be setting
the register in set_fmt().?

> +static int tfa9879_probe(struct snd_soc_codec *codec)
> +{
> +	struct tfa9879_priv *tfa9879 = snd_soc_codec_get_drvdata(codec);
> +
> +	codec->control_data = tfa9879->regmap;

This is redundant, just remove the entire function - ASoC will get the
regmap automatically.

> +	{ TFA9879_MISC_STATUS,		0x0000 }, /* 0x15, read-only */
> +};
> +
> +static bool tfa9879_volatile_register(struct device *dev, unsigned int reg)
> +{
> +	return reg == TFA9879_MISC_STATUS;

If the register is volatile it shouldn't have a default value provided.

Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ