On Tuesday 13 January 2009, David Brownell wrote:
> static int tps6235x_dcdc_set_voltage(struct regulator_dev *dev,
> int min_uV, int max_uV)
> {
> + struct tps *tps = rdev_get_drvdata(dev);
> + const struct tps_info *info = tps->info;
> unsigned char vsel1;
> - unsigned int volt;
> - struct i2c_client *tps_info = rdev_get_drvdata(dev);
> - unsigned int millivolts = min_uV / 1000;
> + unsigned step;
> + int status;
>
> - /* check if the millivolts is within range */
> - if ((millivolts < TPS62352_MIN_CORE_VOLT) ||
> - (millivolts > TPS62352_MAX_CORE_VOLT))
> + /* adjust to match supported range, fail if out of range */
> + if (min_uV < info->min_uV)
> + min_uV = info->min_uV;
> + if (max_uV > info->max_uV)
> + max_uV = info->min_uV;
On second thought, those particular checks would be better
handled by updating the board-level constraints in probe().
That will let this driver not worry about the chip's hard
limits in set_voltage(), and will ensure that the constraints
listed in sysfs are accurate ... in the sense of not lying
about what the actual system capabilities are.
- Dave
> + if (min_uV > max_uV)
> return -EINVAL;
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html