mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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 ...
This commit is contained in:
commit
0512c04a2b
32 changed files with 1803 additions and 1787 deletions
|
|
@ -471,7 +471,7 @@ static struct pwm_chip *of_node_to_pwmchip(struct device_node *np)
|
|||
}
|
||||
|
||||
/**
|
||||
* of_pwm_request() - request a PWM via the PWM framework
|
||||
* of_pwm_get() - request a PWM via the PWM framework
|
||||
* @np: device node to get the PWM from
|
||||
* @con_id: consumer name
|
||||
*
|
||||
|
|
@ -486,8 +486,7 @@ static struct pwm_chip *of_node_to_pwmchip(struct device_node *np)
|
|||
* becomes mandatory for devices that look up the PWM device via the con_id
|
||||
* parameter.
|
||||
*/
|
||||
static struct pwm_device *of_pwm_request(struct device_node *np,
|
||||
const char *con_id)
|
||||
struct pwm_device *of_pwm_get(struct device_node *np, const char *con_id)
|
||||
{
|
||||
struct pwm_device *pwm = NULL;
|
||||
struct of_phandle_args args;
|
||||
|
|
@ -545,6 +544,7 @@ put:
|
|||
|
||||
return pwm;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(of_pwm_get);
|
||||
|
||||
/**
|
||||
* pwm_add_table() - register PWM device consumers
|
||||
|
|
@ -587,7 +587,7 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id)
|
|||
|
||||
/* look up via DT first */
|
||||
if (IS_ENABLED(CONFIG_OF) && dev && dev->of_node)
|
||||
return of_pwm_request(dev->of_node, con_id);
|
||||
return of_pwm_get(dev->of_node, con_id);
|
||||
|
||||
/*
|
||||
* 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)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(devm_pwm_get);
|
||||
|
||||
/**
|
||||
* devm_of_pwm_get() - resource managed of_pwm_get()
|
||||
* @dev: device for PWM consumer
|
||||
* @np: device node to get the PWM from
|
||||
* @con_id: consumer name
|
||||
*
|
||||
* This function performs like of_pwm_get() but the acquired PWM device will
|
||||
* automatically be released on driver detach.
|
||||
*/
|
||||
struct pwm_device *devm_of_pwm_get(struct device *dev, struct device_node *np,
|
||||
const char *con_id)
|
||||
{
|
||||
struct pwm_device **ptr, *pwm;
|
||||
|
||||
ptr = devres_alloc(devm_pwm_release, sizeof(**ptr), GFP_KERNEL);
|
||||
if (!ptr)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
pwm = of_pwm_get(np, con_id);
|
||||
if (!IS_ERR(pwm)) {
|
||||
*ptr = pwm;
|
||||
devres_add(dev, ptr);
|
||||
} else {
|
||||
devres_free(ptr);
|
||||
}
|
||||
|
||||
return pwm;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_of_pwm_get);
|
||||
|
||||
static int devm_pwm_match(struct device *dev, void *res, void *data)
|
||||
{
|
||||
struct pwm_device **p = res;
|
||||
|
|
|
|||
Loading…
Reference in a new issue