diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-22 17:50:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-22 17:50:21 -0400 |
commit | 451fd72219dd6f3355e2d036c598544c760ee532 (patch) | |
tree | 2d25ff688cdca00341e8e207c06ba9df3d4b8764 | |
parent | 47e4df94d129cbca84de252ff63c4ded08a513e7 (diff) | |
parent | d717ea73e36dd5659640fae82605ad85c4117f4d (diff) |
Merge tag 'pwm/for-3.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm
Pull pwm fix from Thierry Reding:
"Just one bugfix for the PWM lookup table code that would cause a PWM
channel to be set to the wrong period and polarity for non-perfect
matches"
* tag 'pwm/for-3.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm:
pwm: Fix period and polarity in pwm_get() for non-perfect matches
-rw-r--r-- | drivers/pwm/core.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 4b66bf09ee55..d2c35920ff08 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c | |||
@@ -606,6 +606,8 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id) | |||
606 | unsigned int best = 0; | 606 | unsigned int best = 0; |
607 | struct pwm_lookup *p; | 607 | struct pwm_lookup *p; |
608 | unsigned int match; | 608 | unsigned int match; |
609 | unsigned int period; | ||
610 | enum pwm_polarity polarity; | ||
609 | 611 | ||
610 | /* look up via DT first */ | 612 | /* look up via DT first */ |
611 | if (IS_ENABLED(CONFIG_OF) && dev && dev->of_node) | 613 | if (IS_ENABLED(CONFIG_OF) && dev && dev->of_node) |
@@ -653,6 +655,8 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id) | |||
653 | if (match > best) { | 655 | if (match > best) { |
654 | chip = pwmchip_find_by_name(p->provider); | 656 | chip = pwmchip_find_by_name(p->provider); |
655 | index = p->index; | 657 | index = p->index; |
658 | period = p->period; | ||
659 | polarity = p->polarity; | ||
656 | 660 | ||
657 | if (match != 3) | 661 | if (match != 3) |
658 | best = match; | 662 | best = match; |
@@ -668,8 +672,8 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id) | |||
668 | if (IS_ERR(pwm)) | 672 | if (IS_ERR(pwm)) |
669 | return pwm; | 673 | return pwm; |
670 | 674 | ||
671 | pwm_set_period(pwm, p->period); | 675 | pwm_set_period(pwm, period); |
672 | pwm_set_polarity(pwm, p->polarity); | 676 | pwm_set_polarity(pwm, polarity); |
673 | 677 | ||
674 | 678 | ||
675 | return pwm; | 679 | return pwm; |