lkml.org 
[lkml]   [2012]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Patch v2 2/7] Regulator: DA9055 Regulator driver
On Mon, Oct 08, 2012 at 07:00:39PM +0530, Ashish Jangam wrote:

Mostly OK, but there's a few issues including yet more reimplementation
of framework features.

> +static int da9055_list_voltage(struct regulator_dev *rdev,
> + unsigned int selector)
> +{
> + struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
> + struct da9055_regulator_info *info = regulator->info;
> + int volt_uV;
> +
> + volt_uV = (selector * info->step_uV) + info->min_uV;
> +
> + if (volt_uV > info->max_uV)
> + return -EINVAL;
> +
> + return volt_uV;
> +}

This is regulator_list_voltage_linear()

> +static int da9055_map_voltage(struct regulator_dev *rdev,
> + int min_uV, int max_uV)
> +{
> + struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
> + struct da9055_regulator_info *info = regulator->info;
> + int ret, sel;
> +
> + ret = verify_range(info, min_uV, max_uV);
> + if (ret < 0)
> + return ret;
> +
> + if (min_uV < info->min_uV)
> + min_uV = info->min_uV;
> +
> + sel = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
> +
> + ret = da9055_list_voltage(rdev, sel);
> + if (ret < 0)
> + return ret;
> +
> + return sel;
> +}

This is regulator_map_voltage_linear().

> + int gpio = pdata->gpio_base + pdata->gpio_ren[id];

> + sprintf(name, "DA9055 REG %d STATE", id);

snprintf().

> + /* Set the GPIO I/P pin for controlling the regulator state. */
> + ret = devm_gpio_request_one(config->dev, gpio, GPIOF_DIR_IN,
> + name);
> + if (ret < 0)
> + goto err;

We never actually appear to use this GPIO anywhere... why are we
requesting it? Also, why is the ability to read the regulator state via
a GPIO associated with controlling it via a GPIO, it's unusual for these
things to be tied together.


\
 
 \ /
  Last update: 2012-10-09 09:21    [W:0.032 / U:3.904 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site