linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: alsa-devel@alsa-project.org, Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Pawel Moll <pawel.moll@arm.com>,
	Patrick Lai <plai@codeaurora.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	kwestfie@codeaurora.org
Subject: Re: [RFC v1 4/9] ASoC: msm8x16: add ranges for default, readonly
Date: Tue, 16 Feb 2016 19:16:56 +0000	[thread overview]
Message-ID: <20160216191656.GE7544@sirena.org.uk> (raw)
In-Reply-To: <1455643976-1784-1-git-send-email-srinivas.kandagatla@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 1895 bytes --]

On Tue, Feb 16, 2016 at 05:32:56PM +0000, Srinivas Kandagatla wrote:

> This patch add register ranges for readonly, default and reset register
> values.

This split of the patches is really not helping at all.  The patches
cross reference each other which makes things harder to follow and it's
not like things can be treated independently or there are detaile
changelogs explaining everything separately.

> +static int __msm8x16_wcd_reg_write(struct snd_soc_codec *codec,
> +			unsigned short reg, u8 val)
> +{
> +	int ret = -EINVAL;
> +	struct msm8x16_wcd_chip *chip = dev_get_drvdata(codec->dev);
> +
> +	if (MSM8X16_WCD_IS_TOMBAK_REG(reg)) {
> +		ret = regmap_write(chip->analog_map,
> +				   chip->analog_base + reg, val);
> +	} else if (MSM8X16_WCD_IS_DIGITAL_REG(reg)) {
> +		u32 temp = val & 0x000000FF;
> +		u16 offset = (reg ^ 0x0200) & 0x0FFF;
> +
> +		ret = regmap_write(chip->digital_map, offset, temp);
> +	}
> +
> +	return ret;
> +}

I don't really know what this is supposed to be doing but it looks like
something is wrong.  It seems that it's trying to munge two different
register maps together in some undocumented reason.

> +static int msm8x16_wcd_write(struct snd_soc_codec *codec, unsigned int reg,
> +			     unsigned int value)
> +{
> +	if (reg == SND_SOC_NOPM)
> +		return 0;
> +
> +	WARN_ON(reg > MSM8X16_WCD_MAX_REGISTER);
> +	if (!msm8x16_wcd_volatile(codec, reg))
> +		msm8x16_wcd_reset_reg_defaults[reg] = value;

This appears to be obviously confused.  We're writing to a global
variable as part of the write routine, and worse that global variable is
called _reg_defaults which suggests that it's supposed to be the
register default values not what appears to be a cache implemented
outside of the existing generic cache code.

> +
> +	return __msm8x16_wcd_reg_write(codec, reg, (u8)value);
> +}

It's also not clear why this is a separate wrapper function.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2016-02-16 19:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16 17:31 [RFC v1 0/9] ASoC: Add support to Qualcomm msm8x16-wcd codec Srinivas Kandagatla
2016-02-16 17:32 ` [RFC v1 1/9] ASoC: msm8x176: Add Device Tree bindings Srinivas Kandagatla
2016-02-16 18:58   ` Mark Rutland
2016-02-16 19:38     ` Srinivas Kandagatla
2016-02-16 17:32 ` [RFC v1 2/9] ASoC: msm8x16: add driver structure Srinivas Kandagatla
2016-02-16 19:09   ` Mark Brown
2016-02-16 17:32 ` [RFC v1 3/9] ASoC: msm8x16: add codec registers definitions Srinivas Kandagatla
2016-02-16 17:32 ` [RFC v1 4/9] ASoC: msm8x16: add ranges for default, readonly Srinivas Kandagatla
2016-02-16 19:16   ` Mark Brown [this message]
2016-02-16 17:33 ` [RFC v1 5/9] ASoC: msm8x16: add codec intialization setup Srinivas Kandagatla
2016-02-16 19:23   ` Mark Brown
2016-02-16 17:33 ` [RFC v1 6/9] ASoC: msm8x16: add codec dais Srinivas Kandagatla
2016-02-16 19:36   ` Mark Brown
2016-02-16 17:33 ` [RFC v1 7/9] ASoC: msm8x16: Add sound mixer controls Srinivas Kandagatla
2016-02-16 20:21   ` Mark Brown
2016-02-17 10:58     ` Srinivas Kandagatla
2016-02-17 11:10       ` Mark Brown
2016-02-16 17:33 ` [RFC v1 8/9] ASoC: msm8x16: add dapm widgets Srinivas Kandagatla
2016-02-16 17:33 ` [RFC v1 9/9] ASoC: msm8x16: add dapm routes Srinivas Kandagatla

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=20160216191656.GE7544@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=kwestfie@codeaurora.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=perex@perex.cz \
    --cc=plai@codeaurora.org \
    --cc=robh+dt@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=tiwai@suse.com \
    /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).