alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
To: broonie@kernel.org, lee.jones@linaro.org, sameo@linux.intel.com,
	lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.de
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3 v4 RESEND] mfd: arizona: Export function to control subsystem DVFS
Date: Mon, 1 Sep 2014 15:47:00 +0100	[thread overview]
Message-ID: <20140901144700.GA18134@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20140808133233.GA2665@opensource.wolfsonmicro.com>

>  
> +
> +int arizona_dvfs_down(struct arizona *arizona, unsigned int flags)
> +{
> +	int ret = 0;
> +
> +	mutex_lock(&arizona->subsys_max_lock);
> +
> +	if ((arizona->subsys_max_rq & flags) != flags)
> +		dev_warn(arizona->dev, "Unbalanced DVFS down: %x\n", flags);

This warning is bogus and should be removed. These are just simple on/off bit
flags, not a reference count. If a requestor is already at the lower DVFS
state we just do nothing.

It was done this way to keep the code simple and lower risk. None of the
blocks that need to move the DVFS frequency up and down have multiple users
so they are simple either/or cases that don't currently reference count
themselves. So having a boolean flag to match the state of each block
keeps the change set smaller.

> +
> +	arizona->subsys_max_rq &= ~flags;
> +
> +	if (arizona->subsys_max_rq == 0) {
> +		switch (arizona->type) {
> +		case WM5102:
> +		case WM8997:
> +			ret = regmap_update_bits(arizona->regmap,
> +					ARIZONA_DYNAMIC_FREQUENCY_SCALING_1,
> +					ARIZONA_SUBSYS_MAX_FREQ, 0);
> +			if (ret != 0)
> +				dev_err(arizona->dev,
> +					"Failed to disable subsys max: %d\n",
> +					ret);
> +
> +			ret = regulator_set_voltage(arizona->dcvdd,
> +						    1200000, 1800000);
> +			if (ret != 0)
> +				dev_err(arizona->dev,
> +					"Failed to set DCVDD (DVFS down): %d\n",
> +					ret);
> +			break;
> +
> +		default:
> +			break;
> +		}
> +	}
> +
> +	mutex_unlock(&arizona->subsys_max_lock);
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(arizona_dvfs_down);
> +

      parent reply	other threads:[~2014-09-01 14:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08 13:32 [PATCH 1/3 v4 RESEND] mfd: arizona: Export function to control subsystem DVFS Richard Fitzgerald
2014-08-08 13:34 ` [PATCH 2/3 v4 RESEND] ASoC: wm_adsp: Move DVFS control into codec driver Richard Fitzgerald
2014-08-08 13:35 ` [PATCH 3/3 v4 RESEND] ASoC: arizona: Add DVFS handling for sample rate control Richard Fitzgerald
2014-08-12 13:34   ` Charles Keepax
2014-08-12 15:57     ` Mark Brown
2014-08-21 10:40 ` [PATCH 1/3 v4 RESEND] mfd: arizona: Export function to control subsystem DVFS Lee Jones
2014-08-25 10:15   ` Richard Fitzgerald
2014-09-01 14:47 ` Richard Fitzgerald [this message]

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=20140901144700.GA18134@opensource.wolfsonmicro.com \
    --to=rf@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=perex@perex.cz \
    --cc=sameo@linux.intel.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).