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

Commit 52003ab9 authored by Tirupathi Reddy's avatar Tirupathi Reddy
Browse files

regulator: msm_gfx_ldo: specify a list_corner_voltage callback function



Define a list_corner_voltage callback function for the msm_gfx_ldo
driver so that consumers can determine the msm_gfx_ldo voltage
for each voltage corner.

CRs-Fixed: 2174431
Change-Id: I3f661f9bbb01bcce4b7f56707583eea507045b47
Signed-off-by: default avatarTirupathi Reddy <tirupath@codeaurora.org>
parent be566880
Loading
Loading
Loading
Loading
+28 −6
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -773,12 +773,34 @@ static int msm_gfx_ldo_is_enabled(struct regulator_dev *rdev)
	return ldo_vreg->vreg_enabled;
}

/**
 * msm_gfx_ldo_list_corner_voltage() - return the ldo voltage mapped to
 *			the specified voltage corner
 * @rdev:		Regulator device pointer for the msm_gfx_ldo
 * @corner:		Voltage corner
 *
 * Return: voltage value in microvolts or -EINVAL if the corner is out of range
 */
static int msm_gfx_ldo_list_corner_voltage(struct regulator_dev *rdev,
		int corner)
{
	struct msm_gfx_ldo *ldo_vreg  = rdev_get_drvdata(rdev);

	corner -= MIN_CORNER_OFFSET;

	if (corner >= 0 && corner < ldo_vreg->num_corners)
		return ldo_vreg->open_loop_volt[corner];
	else
		return -EINVAL;
}

static struct regulator_ops msm_gfx_ldo_corner_ops = {
	.enable			= msm_gfx_ldo_corner_enable,
	.disable		= msm_gfx_ldo_disable,
	.is_enabled		= msm_gfx_ldo_is_enabled,
	.set_voltage		= msm_gfx_ldo_set_corner,
	.get_voltage		= msm_gfx_ldo_get_corner,
	.list_corner_voltage	= msm_gfx_ldo_list_corner_voltage,
};

static int msm_gfx_ldo_get_bypass(struct regulator_dev *rdev,