[alsa-devel] [PATCH 1/3 v4 RESEND] mfd: arizona: Export function to control subsystem DVFS
Richard Fitzgerald
rf at opensource.wolfsonmicro.com
Mon Sep 1 16:47:00 CEST 2014
>
> +
> +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);
> +
More information about the Alsa-devel
mailing list