* [PATCH 1/3] regulator: pwm-regulator: Ensure headings aren't confused with properties
@ 2015-07-09 15:35 Lee Jones
[not found] ` <1436456128-18278-1-git-send-email-lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Lee Jones @ 2015-07-09 15:35 UTC (permalink / raw)
To: linux-arm-kernel, linux-kernel
Cc: kernel, broonie, lgirdwood, devicetree, Lee Jones
We're using capitalisation and removing the '-' to mitigate confusion.
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
Documentation/devicetree/bindings/regulator/pwm-regulator.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
index 892b366..23b4772 100644
--- a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
@@ -3,7 +3,7 @@ Bindings for the Generic PWM Regulator
Currently supports 2 modes of operation:
-voltage-table: When in this mode, a voltage table (See below) of
+Voltage Table: When in this mode, a voltage table (See below) of
predefined voltage <=> duty-cycle values must be
provided via DT. Limitations are that the regulator can
only operate at the voltages supplied in the table.
@@ -13,7 +13,7 @@ voltage-table: When in this mode, a voltage table (See below) of
the user if the assumptions made in continuous-voltage
mode do not reign true.
-continuous-voltage: This mode uses the regulator's maximum and minimum
+Continuous Voltage: This mode uses the regulator's maximum and minimum
supplied voltages specified in the
regulator-{min,max}-microvolt properties to calculate
appropriate duty-cycle values. This allows for a much
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/3] regulator: pwm-regulator: Remove obsoleted property
[not found] ` <1436456128-18278-1-git-send-email-lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2015-07-09 15:35 ` Lee Jones
2015-07-09 15:35 ` [PATCH 3/3] regulator: pwm-regulator: Small clean-ups Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2015-07-09 15:35 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: kernel-F5mvAk5X5gdBDgjK7y7TUQ, broonie-DgEjT+Ai2ygdnm+yROfE0A,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
devicetree-u79uwXL29TY76Z2rM5mHXA, Lee Jones
In "[3d7ef30] regulator: pwm-regulator: Simplify voltage to duty-cycle
call" we stopped using max_duty_cycle, so we can retire it from device
data and DT.
There is no need to deprecate this property, as it hasn't hit Mainline
yet.
Signed-off-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
Documentation/devicetree/bindings/regulator/pwm-regulator.txt | 11 ++++-------
drivers/regulator/pwm-regulator.c | 9 ---------
2 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
index 23b4772..ed936f0 100644
--- a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
@@ -29,15 +29,14 @@ Required properties:
- pwms: PWM specification (See: ../pwm/pwm.txt)
-One of these must be provided:
+Only required for Voltage Table Mode:
- voltage-table: Voltage and Duty-Cycle table consisting of 2 cells
First cell is voltage in microvolts (uV)
Second cell is duty-cycle in percent (%)
-- max-duty-cycle: Maximum Duty-Cycle value -- this will normally be
- 255 (0xff) for an 8 bit PWM device
-
-If both are provided, the current default is voltage-table mode.
+NB: To be clear, if voltage-table is provided, then the device will be used
+in Voltage Table Mode. If no voltage-table is provided, then the device will
+be used in Continuous Voltage Mode.
Any property defined as part of the core regulator binding can also be used.
(See: ../regulator/regulator.txt)
@@ -49,8 +48,6 @@ Continuous Voltage Example:
regulator-min-microvolt = <1016000>;
regulator-max-microvolt = <1114000>;
regulator-name = "vdd_logic";
-
- max-duty-cycle = <255>; /* 8bit PWM */
};
Voltage Table Example:
diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
index cb48208..d92e667 100644
--- a/drivers/regulator/pwm-regulator.c
+++ b/drivers/regulator/pwm-regulator.c
@@ -30,7 +30,6 @@ struct pwm_regulator_data {
int state;
/* Continuous voltage */
- u32 max_duty_cycle;
int volt_uV;
};
@@ -201,14 +200,6 @@ static int pwm_regulator_init_continuous(struct platform_device *pdev,
struct pwm_regulator_data *drvdata)
{
struct device_node *np = pdev->dev.of_node;
- int ret;
-
- ret = of_property_read_u32(np, "max-duty-cycle",
- &drvdata->max_duty_cycle);
- if (ret) {
- dev_err(&pdev->dev, "Failed to read \"pwm-max-value\"\n");
- return ret;
- }
pwm_regulator_desc.ops = &pwm_regulator_voltage_continuous_ops;
pwm_regulator_desc.continuous_voltage_range = true;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] regulator: pwm-regulator: Small clean-ups
[not found] ` <1436456128-18278-1-git-send-email-lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-09 15:35 ` [PATCH 2/3] regulator: pwm-regulator: Remove obsoleted property Lee Jones
@ 2015-07-09 15:35 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2015-07-09 15:35 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: kernel-F5mvAk5X5gdBDgjK7y7TUQ, broonie-DgEjT+Ai2ygdnm+yROfE0A,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
devicetree-u79uwXL29TY76Z2rM5mHXA, Lee Jones
Remove over-bracketing, use framework API to fetch PWM period and
be more forthcoming that pwm_voltage_to_duty_cycle() actually returns
duty cycle as a percentage, rather than a register value.
Signed-off-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
drivers/regulator/pwm-regulator.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
index d92e667..936e387 100644
--- a/drivers/regulator/pwm-regulator.c
+++ b/drivers/regulator/pwm-regulator.c
@@ -92,13 +92,13 @@ static int pwm_regulator_list_voltage(struct regulator_dev *rdev,
/**
* Continuous voltage call-backs
*/
-static int pwm_voltage_to_duty_cycle(struct regulator_dev *rdev, int req_uV)
+static int pwm_voltage_to_duty_cycle_percentage(struct regulator_dev *rdev, int req_uV)
{
int min_uV = rdev->constraints->min_uV;
int max_uV = rdev->constraints->max_uV;
int diff = max_uV - min_uV;
- return 100 - ((((req_uV * 100) - (min_uV * 100)) / diff));
+ return 100 - (((req_uV * 100) - (min_uV * 100)) / diff);
}
static int pwm_regulator_get_voltage(struct regulator_dev *rdev)
@@ -114,14 +114,13 @@ static int pwm_regulator_set_voltage(struct regulator_dev *rdev,
{
struct pwm_regulator_data *drvdata = rdev_get_drvdata(rdev);
unsigned int ramp_delay = rdev->constraints->ramp_delay;
+ unsigned int period = pwm_get_period(drvdata->pwm);
int duty_cycle;
int ret;
- duty_cycle = pwm_voltage_to_duty_cycle(rdev, min_uV);
+ duty_cycle = pwm_voltage_to_duty_cycle_percentage(rdev, min_uV);
- ret = pwm_config(drvdata->pwm,
- (drvdata->pwm->period / 100) * duty_cycle,
- drvdata->pwm->period);
+ ret = pwm_config(drvdata->pwm, (period / 100) * duty_cycle, period);
if (ret) {
dev_err(&rdev->dev, "Failed to configure PWM\n");
return ret;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-09 15:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-09 15:35 [PATCH 1/3] regulator: pwm-regulator: Ensure headings aren't confused with properties Lee Jones
[not found] ` <1436456128-18278-1-git-send-email-lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-09 15:35 ` [PATCH 2/3] regulator: pwm-regulator: Remove obsoleted property Lee Jones
2015-07-09 15:35 ` [PATCH 3/3] regulator: pwm-regulator: Small clean-ups Lee Jones
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).