From: Wadim Egorov <w.egorov@phytec.de>
To: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
rtc-linux@googlegroups.com, devicetree@vger.kernel.org,
linux-rockchip@lists.infradead.org, lee.jones@linaro.org
Cc: robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
mturquette@baylibre.com, sboyd@codeaurora.org,
lgirdwood@gmail.com, broonie@kernel.org, a.zummo@towertech.it,
alexandre.belloni@free-electrons.com, dianders@chromium.org,
zyw@rock-chips.com
Subject: [PATCH v4 1/7] regulator: rk808: Add rk808_reg_ops_ranges for LDO3
Date: Tue, 26 Apr 2016 16:54:04 +0200 [thread overview]
Message-ID: <1461682450-22173-2-git-send-email-w.egorov@phytec.de> (raw)
In-Reply-To: <1461682450-22173-1-git-send-email-w.egorov@phytec.de>
LDO_REG3 descriptor is using linear_ranges.
Add and use proper ops for LDO_REG3.
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
---
drivers/regulator/rk808-regulator.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
index 67f72fe..6601ab5 100644
--- a/drivers/regulator/rk808-regulator.c
+++ b/drivers/regulator/rk808-regulator.c
@@ -238,6 +238,21 @@ static int rk808_set_suspend_voltage(struct regulator_dev *rdev, int uv)
sel);
}
+static int rk808_set_suspend_voltage_range(struct regulator_dev *rdev, int uv)
+{
+ unsigned int reg;
+ int sel = regulator_map_voltage_linear_range(rdev, uv, uv);
+
+ if (sel < 0)
+ return -EINVAL;
+
+ reg = rdev->desc->vsel_reg + RK808_SLP_REG_OFFSET;
+
+ return regmap_update_bits(rdev->regmap, reg,
+ rdev->desc->vsel_mask,
+ sel);
+}
+
static int rk808_set_suspend_enable(struct regulator_dev *rdev)
{
unsigned int reg;
@@ -288,6 +303,19 @@ static struct regulator_ops rk808_reg_ops = {
.set_suspend_disable = rk808_set_suspend_disable,
};
+static struct regulator_ops rk808_reg_ops_ranges = {
+ .list_voltage = regulator_list_voltage_linear_range,
+ .map_voltage = regulator_map_voltage_linear_range,
+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
+ .set_voltage_sel = regulator_set_voltage_sel_regmap,
+ .enable = regulator_enable_regmap,
+ .disable = regulator_disable_regmap,
+ .is_enabled = regulator_is_enabled_regmap,
+ .set_suspend_voltage = rk808_set_suspend_voltage_range,
+ .set_suspend_enable = rk808_set_suspend_enable,
+ .set_suspend_disable = rk808_set_suspend_disable,
+};
+
static struct regulator_ops rk808_switch_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
@@ -383,7 +411,7 @@ static const struct regulator_desc rk808_reg[] = {
.name = "LDO_REG3",
.supply_name = "vcc7",
.id = RK808_ID_LDO3,
- .ops = &rk808_reg_ops,
+ .ops = &rk808_reg_ops_ranges,
.type = REGULATOR_VOLTAGE,
.n_voltages = 16,
.linear_ranges = rk808_ldo3_voltage_ranges,
--
1.9.1
next prev parent reply other threads:[~2016-04-26 14:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-26 14:54 [PATCH v4 0/7] Add support for rk818 Wadim Egorov
2016-04-26 14:54 ` Wadim Egorov [this message]
2016-04-27 16:35 ` Applied "regulator: rk808: Add rk808_reg_ops_ranges for LDO3" to the regulator tree Mark Brown
2016-04-27 21:54 ` [PATCH v4 1/7] regulator: rk808: Add rk808_reg_ops_ranges for LDO3 Heiko Stübner
[not found] ` <1461682450-22173-1-git-send-email-w.egorov-guT5V/WYfQezQB+pC5nmwQ@public.gmane.org>
2016-04-26 14:54 ` [PATCH v4 2/7] regulator: rk808: Migrate to regulator core's simplified DT parsing code Wadim Egorov
[not found] ` <1461682450-22173-3-git-send-email-w.egorov-guT5V/WYfQezQB+pC5nmwQ@public.gmane.org>
2016-04-27 16:57 ` Mark Brown
2016-04-26 14:54 ` [PATCH v4 5/7] mfd: dt-bindings: Add RK818 device tree bindings document Wadim Egorov
2016-04-26 14:54 ` [PATCH v4 6/7] clk: Kconfig: Name RK818 in Kconfig for COMMON_CLK_RK808 Wadim Egorov
2016-04-26 14:54 ` [PATCH v4 7/7] rtc: Kconfig: Name RK818 in Kconfig for RTC_DRV_RK808 Wadim Egorov
2016-04-26 14:54 ` [PATCH v4 3/7] mfd: RK808: Add RK818 support Wadim Egorov
2016-05-10 6:51 ` Wadim Egorov
2016-05-10 7:54 ` Lee Jones
2016-04-26 14:54 ` [PATCH v4 4/7] regulator: rk808: Add regulator driver for RK818 Wadim Egorov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1461682450-22173-2-git-send-email-w.egorov@phytec.de \
--to=w.egorov@phytec.de \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@free-electrons.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=lee.jones@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=mturquette@baylibre.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=rtc-linux@googlegroups.com \
--cc=sboyd@codeaurora.org \
--cc=zyw@rock-chips.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).