lkml.org 
[lkml]   [2014]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/3 v4 RESEND] mfd: arizona: Export function to control subsystem DVFS
> 
> +
> +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);
> +


\
 
 \ /
  Last update: 2014-09-01 17:21    [W:0.847 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site