aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pwm/core.c
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@gmail.com>2016-05-17 08:57:47 -0400
committerThierry Reding <thierry.reding@gmail.com>2016-05-17 08:57:47 -0400
commitbf5dd9abcb4443bbab8cb63b9d82b96a4a45c802 (patch)
treea4d776d644c5b5140490f26c95578f9dcb77653d /drivers/pwm/core.c
parentc3499f0bc38d6db78f119f8f95d5d471e026ef88 (diff)
parentfbd45a12988e75a48d392feb8b0e5feb5d612513 (diff)
Merge branch 'for-4.7/pwm-args' into for-next
Diffstat (limited to 'drivers/pwm/core.c')
-rw-r--r--drivers/pwm/core.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 2a1a2d566e39..e4de9156974d 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -147,12 +147,12 @@ of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args)
147 if (IS_ERR(pwm)) 147 if (IS_ERR(pwm))
148 return pwm; 148 return pwm;
149 149
150 pwm_set_period(pwm, args->args[1]); 150 pwm->args.period = args->args[1];
151 151
152 if (args->args[2] & PWM_POLARITY_INVERTED) 152 if (args->args[2] & PWM_POLARITY_INVERTED)
153 pwm_set_polarity(pwm, PWM_POLARITY_INVERSED); 153 pwm->args.polarity = PWM_POLARITY_INVERSED;
154 else 154 else
155 pwm_set_polarity(pwm, PWM_POLARITY_NORMAL); 155 pwm->args.polarity = PWM_POLARITY_NORMAL;
156 156
157 return pwm; 157 return pwm;
158} 158}
@@ -173,7 +173,7 @@ of_pwm_simple_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
173 if (IS_ERR(pwm)) 173 if (IS_ERR(pwm))
174 return pwm; 174 return pwm;
175 175
176 pwm_set_period(pwm, args->args[1]); 176 pwm->args.period = args->args[1];
177 177
178 return pwm; 178 return pwm;
179} 179}
@@ -621,6 +621,13 @@ struct pwm_device *of_pwm_get(struct device_node *np, const char *con_id)
621 621
622 pwm->label = con_id; 622 pwm->label = con_id;
623 623
624 /*
625 * FIXME: This should be removed once all PWM users properly make use
626 * of struct pwm_args to initialize the PWM device. As long as this is
627 * here, the PWM state and hardware state can get out of sync.
628 */
629 pwm_apply_args(pwm);
630
624put: 631put:
625 of_node_put(args.np); 632 of_node_put(args.np);
626 633
@@ -752,8 +759,15 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id)
752 if (IS_ERR(pwm)) 759 if (IS_ERR(pwm))
753 goto out; 760 goto out;
754 761
755 pwm_set_period(pwm, chosen->period); 762 pwm->args.period = chosen->period;
756 pwm_set_polarity(pwm, chosen->polarity); 763 pwm->args.polarity = chosen->polarity;
764
765 /*
766 * FIXME: This should be removed once all PWM users properly make use
767 * of struct pwm_args to initialize the PWM device. As long as this is
768 * here, the PWM state and hardware state can get out of sync.
769 */
770 pwm_apply_args(pwm);
757 771
758out: 772out:
759 mutex_unlock(&pwm_lookup_lock); 773 mutex_unlock(&pwm_lookup_lock);