diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-26 12:29:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-26 12:29:02 -0500 |
commit | 0512c04a2b5d29a33d96d315e1d14c55f5148aa7 (patch) | |
tree | 6373c0370abe32e1e42a933bd9cd08727e48b5d9 /drivers/pwm | |
parent | 5115f3c19d17851aaff5a857f55b4a019c908775 (diff) | |
parent | 4b07c5d5123f76487c61cf9dc3f987d0b8c88a94 (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds
Pull LED subsystem update from Bryan Wu.
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: (61 commits)
leds: leds-sunfire: use dev_err()/pr_err() instead of printk()
leds: 88pm860x: Add missing of_node_put()
leds: tca6507: Use of_get_child_count()
leds: leds-pwm: make it depend on PWM and not HAVE_PWM
Documentation: leds: update LP55xx family devices
leds-lp55xx: fix problem on removing LED attributes
leds-lp5521/5523: add author and copyright description
leds-lp5521/5523: use new lp55xx common header
leds-lp55xx: clean up headers
leds-lp55xx: clean up definitions
leds-lp55xx: clean up unused data and functions
leds-lp55xx: clean up _remove()
leds-lp55xx: add new function for removing device attribtues
leds-lp55xx: code refactoring on selftest function
leds-lp55xx: use common device attribute driver function
leds-lp55xx: support device specific attributes
leds-lp5523: use generic firmware interface
leds-lp5521: use generic firmware interface
leds-lp55xx: support firmware interface
leds-lp55xx: add new lp55xx_register_sysfs() for the firmware interface
...
Diffstat (limited to 'drivers/pwm')
-rw-r--r-- | drivers/pwm/core.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 903138b18842..4a13da48fefe 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c | |||
@@ -471,7 +471,7 @@ static struct pwm_chip *of_node_to_pwmchip(struct device_node *np) | |||
471 | } | 471 | } |
472 | 472 | ||
473 | /** | 473 | /** |
474 | * of_pwm_request() - request a PWM via the PWM framework | 474 | * of_pwm_get() - request a PWM via the PWM framework |
475 | * @np: device node to get the PWM from | 475 | * @np: device node to get the PWM from |
476 | * @con_id: consumer name | 476 | * @con_id: consumer name |
477 | * | 477 | * |
@@ -486,8 +486,7 @@ static struct pwm_chip *of_node_to_pwmchip(struct device_node *np) | |||
486 | * becomes mandatory for devices that look up the PWM device via the con_id | 486 | * becomes mandatory for devices that look up the PWM device via the con_id |
487 | * parameter. | 487 | * parameter. |
488 | */ | 488 | */ |
489 | static struct pwm_device *of_pwm_request(struct device_node *np, | 489 | struct pwm_device *of_pwm_get(struct device_node *np, const char *con_id) |
490 | const char *con_id) | ||
491 | { | 490 | { |
492 | struct pwm_device *pwm = NULL; | 491 | struct pwm_device *pwm = NULL; |
493 | struct of_phandle_args args; | 492 | struct of_phandle_args args; |
@@ -545,6 +544,7 @@ put: | |||
545 | 544 | ||
546 | return pwm; | 545 | return pwm; |
547 | } | 546 | } |
547 | EXPORT_SYMBOL_GPL(of_pwm_get); | ||
548 | 548 | ||
549 | /** | 549 | /** |
550 | * pwm_add_table() - register PWM device consumers | 550 | * pwm_add_table() - register PWM device consumers |
@@ -587,7 +587,7 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id) | |||
587 | 587 | ||
588 | /* look up via DT first */ | 588 | /* look up via DT first */ |
589 | if (IS_ENABLED(CONFIG_OF) && dev && dev->of_node) | 589 | if (IS_ENABLED(CONFIG_OF) && dev && dev->of_node) |
590 | return of_pwm_request(dev->of_node, con_id); | 590 | return of_pwm_get(dev->of_node, con_id); |
591 | 591 | ||
592 | /* | 592 | /* |
593 | * We look up the provider in the static table typically provided by | 593 | * We look up the provider in the static table typically provided by |
@@ -708,6 +708,36 @@ struct pwm_device *devm_pwm_get(struct device *dev, const char *con_id) | |||
708 | } | 708 | } |
709 | EXPORT_SYMBOL_GPL(devm_pwm_get); | 709 | EXPORT_SYMBOL_GPL(devm_pwm_get); |
710 | 710 | ||
711 | /** | ||
712 | * devm_of_pwm_get() - resource managed of_pwm_get() | ||
713 | * @dev: device for PWM consumer | ||
714 | * @np: device node to get the PWM from | ||
715 | * @con_id: consumer name | ||
716 | * | ||
717 | * This function performs like of_pwm_get() but the acquired PWM device will | ||
718 | * automatically be released on driver detach. | ||
719 | */ | ||
720 | struct pwm_device *devm_of_pwm_get(struct device *dev, struct device_node *np, | ||
721 | const char *con_id) | ||
722 | { | ||
723 | struct pwm_device **ptr, *pwm; | ||
724 | |||
725 | ptr = devres_alloc(devm_pwm_release, sizeof(**ptr), GFP_KERNEL); | ||
726 | if (!ptr) | ||
727 | return ERR_PTR(-ENOMEM); | ||
728 | |||
729 | pwm = of_pwm_get(np, con_id); | ||
730 | if (!IS_ERR(pwm)) { | ||
731 | *ptr = pwm; | ||
732 | devres_add(dev, ptr); | ||
733 | } else { | ||
734 | devres_free(ptr); | ||
735 | } | ||
736 | |||
737 | return pwm; | ||
738 | } | ||
739 | EXPORT_SYMBOL_GPL(devm_of_pwm_get); | ||
740 | |||
711 | static int devm_pwm_match(struct device *dev, void *res, void *data) | 741 | static int devm_pwm_match(struct device *dev, void *res, void *data) |
712 | { | 742 | { |
713 | struct pwm_device **p = res; | 743 | struct pwm_device **p = res; |