Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 989cbba1 authored by Tirupathi Reddy's avatar Tirupathi Reddy Committed by Ashay Jaiswal
Browse files

regulator: cpr-regulator: specify a list_corner_voltage callback function



Define a list_corner_voltage callback function for the
cpr-regulator driver so that consumers can determine the CPR
ceiling voltage for each voltage corner.

Change-Id: I14ad513191d28a0f0ce66fa957983c1fc4a2de0d
Signed-off-by: default avatarTirupathi Reddy <tirupath@codeaurora.org>
parent 264fe994
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -1117,12 +1117,35 @@ static int cpr_regulator_get_voltage(struct regulator_dev *rdev)
	return cpr_vreg->corner;
}

/**
 * cpr_regulator_list_corner_voltage() - return the ceiling voltage mapped to
 *			the specified voltage corner
 * @rdev:		Regulator device pointer for the cpr-regulator
 * @corner:		Voltage corner
 *
 * This function is passed as a callback function into the regulator ops that
 * are registered for each cpr-regulator device.
 *
 * Return: voltage value in microvolts or -EINVAL if the corner is out of range
 */
static int cpr_regulator_list_corner_voltage(struct regulator_dev *rdev,
		int corner)
{
	struct cpr_regulator *cpr_vreg = rdev_get_drvdata(rdev);

	if (corner >= CPR_CORNER_MIN && corner <= cpr_vreg->num_corners)
		return cpr_vreg->ceiling_volt[corner];
	else
		return -EINVAL;
}

static struct regulator_ops cpr_corner_ops = {
	.enable			= cpr_regulator_enable,
	.disable		= cpr_regulator_disable,
	.is_enabled		= cpr_regulator_is_enabled,
	.set_voltage		= cpr_regulator_set_voltage_op,
	.get_voltage		= cpr_regulator_get_voltage,
	.list_corner_voltage	= cpr_regulator_list_corner_voltage,
};

#ifdef CONFIG_PM