2019-06-04 08:11:33 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2009-02-11 21:24:40 +00:00
|
|
|
/*
|
|
|
|
* linux/drivers/leds-pwm.c
|
|
|
|
*
|
|
|
|
* simple PWM based LED control
|
|
|
|
*
|
|
|
|
* Copyright 2009 Luotao Fu @ Pengutronix (l.fu@pengutronix.de)
|
|
|
|
*
|
|
|
|
* based on leds-gpio.c by Raphael Assenat <raph@8d.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/platform_device.h>
|
2023-07-14 17:46:50 +00:00
|
|
|
#include <linux/of.h>
|
2009-02-11 21:24:40 +00:00
|
|
|
#include <linux/leds.h>
|
|
|
|
#include <linux/err.h>
|
|
|
|
#include <linux/pwm.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 08:04:11 +00:00
|
|
|
#include <linux/slab.h>
|
2021-06-08 06:35:54 +00:00
|
|
|
#include "leds.h"
|
2009-02-11 21:24:40 +00:00
|
|
|
|
2020-03-21 08:15:53 +00:00
|
|
|
struct led_pwm {
|
|
|
|
const char *name;
|
|
|
|
u8 active_low;
|
2021-06-08 06:35:54 +00:00
|
|
|
u8 default_state;
|
2020-03-21 08:15:53 +00:00
|
|
|
unsigned int max_brightness;
|
|
|
|
};
|
|
|
|
|
2009-02-11 21:24:40 +00:00
|
|
|
struct led_pwm_data {
|
|
|
|
struct led_classdev cdev;
|
|
|
|
struct pwm_device *pwm;
|
2020-01-24 16:54:08 +00:00
|
|
|
struct pwm_state pwmstate;
|
2012-11-25 06:54:55 +00:00
|
|
|
unsigned int active_low;
|
2009-02-11 21:24:40 +00:00
|
|
|
};
|
|
|
|
|
2012-12-21 09:43:56 +00:00
|
|
|
struct led_pwm_priv {
|
|
|
|
int num_leds;
|
2020-03-19 21:51:46 +00:00
|
|
|
struct led_pwm_data leds[];
|
2012-12-21 09:43:56 +00:00
|
|
|
};
|
|
|
|
|
2017-01-04 08:37:56 +00:00
|
|
|
static int led_pwm_set(struct led_classdev *led_cdev,
|
|
|
|
enum led_brightness brightness)
|
2009-02-11 21:24:40 +00:00
|
|
|
{
|
|
|
|
struct led_pwm_data *led_dat =
|
|
|
|
container_of(led_cdev, struct led_pwm_data, cdev);
|
2009-11-27 05:17:38 +00:00
|
|
|
unsigned int max = led_dat->cdev.max_brightness;
|
2020-01-24 16:54:08 +00:00
|
|
|
unsigned long long duty = led_dat->pwmstate.period;
|
2009-02-11 21:24:40 +00:00
|
|
|
|
2013-12-11 09:19:42 +00:00
|
|
|
duty *= brightness;
|
|
|
|
do_div(duty, max);
|
2014-04-06 22:20:18 +00:00
|
|
|
|
|
|
|
if (led_dat->active_low)
|
2020-01-24 16:54:08 +00:00
|
|
|
duty = led_dat->pwmstate.period - duty;
|
2013-01-28 14:00:59 +00:00
|
|
|
|
2020-01-24 16:54:08 +00:00
|
|
|
led_dat->pwmstate.duty_cycle = duty;
|
2024-04-17 15:38:47 +00:00
|
|
|
/*
|
|
|
|
* Disabling a PWM doesn't guarantee that it emits the inactive level.
|
|
|
|
* So keep it on. Only for suspending the PWM should be disabled because
|
|
|
|
* otherwise it refuses to suspend. The possible downside is that the
|
|
|
|
* LED might stay (or even go) on.
|
|
|
|
*/
|
|
|
|
led_dat->pwmstate.enabled = !(led_cdev->flags & LED_SUSPENDED);
|
2023-12-19 16:30:24 +00:00
|
|
|
return pwm_apply_might_sleep(led_dat->pwm, &led_dat->pwmstate);
|
2009-02-11 21:24:40 +00:00
|
|
|
}
|
|
|
|
|
2020-10-05 20:34:40 +00:00
|
|
|
__attribute__((nonnull))
|
2014-04-06 22:20:08 +00:00
|
|
|
static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
|
leds: pwm: Support ACPI via firmware-node framework
DT specific handling is replaced by firmware-node abstration to support
ACPI specification of PWM LEDS.
Example ASL:
Device (PWML)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () { Package () {"compatible",
Package () {"pwm-leds"}}}})
Device (PWL0)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "alarm-led"},
Package () {"pwms", Package ()
{\_SB_.PCI0.PWM, 0, 600000, 0}},
Package () {"linux,default-state", "off"}}})
}
}
Signed-off-by: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2019-06-12 08:36:08 +00:00
|
|
|
struct led_pwm *led, struct fwnode_handle *fwnode)
|
2009-02-11 21:24:40 +00:00
|
|
|
{
|
2014-04-06 22:20:08 +00:00
|
|
|
struct led_pwm_data *led_data = &priv->leds[priv->num_leds];
|
2020-09-19 05:31:44 +00:00
|
|
|
struct led_init_data init_data = { .fwnode = fwnode };
|
2013-11-28 09:06:38 +00:00
|
|
|
int ret;
|
2009-02-11 21:24:40 +00:00
|
|
|
|
2014-04-06 22:20:08 +00:00
|
|
|
led_data->active_low = led->active_low;
|
|
|
|
led_data->cdev.name = led->name;
|
|
|
|
led_data->cdev.brightness = LED_OFF;
|
|
|
|
led_data->cdev.max_brightness = led->max_brightness;
|
|
|
|
led_data->cdev.flags = LED_CORE_SUSPENDRESUME;
|
2009-02-11 21:24:40 +00:00
|
|
|
|
2020-10-05 20:34:40 +00:00
|
|
|
led_data->pwm = devm_fwnode_pwm_get(dev, fwnode, NULL);
|
2020-08-26 14:50:11 +00:00
|
|
|
if (IS_ERR(led_data->pwm))
|
|
|
|
return dev_err_probe(dev, PTR_ERR(led_data->pwm),
|
|
|
|
"unable to request PWM for %s\n",
|
|
|
|
led->name);
|
2012-12-21 09:44:01 +00:00
|
|
|
|
2017-01-04 08:37:56 +00:00
|
|
|
led_data->cdev.brightness_set_blocking = led_pwm_set;
|
2009-02-11 21:24:40 +00:00
|
|
|
|
2021-06-08 06:35:54 +00:00
|
|
|
/* init PWM state */
|
|
|
|
switch (led->default_state) {
|
|
|
|
case LEDS_DEFSTATE_KEEP:
|
|
|
|
pwm_get_state(led_data->pwm, &led_data->pwmstate);
|
|
|
|
if (led_data->pwmstate.period)
|
|
|
|
break;
|
|
|
|
led->default_state = LEDS_DEFSTATE_OFF;
|
|
|
|
dev_warn(dev,
|
|
|
|
"failed to read period for %s, default to off",
|
|
|
|
led->name);
|
|
|
|
fallthrough;
|
|
|
|
default:
|
|
|
|
pwm_init_state(led_data->pwm, &led_data->pwmstate);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set brightness */
|
|
|
|
switch (led->default_state) {
|
|
|
|
case LEDS_DEFSTATE_ON:
|
|
|
|
led_data->cdev.brightness = led->max_brightness;
|
|
|
|
break;
|
|
|
|
case LEDS_DEFSTATE_KEEP:
|
|
|
|
{
|
|
|
|
uint64_t brightness;
|
|
|
|
|
|
|
|
brightness = led->max_brightness;
|
|
|
|
brightness *= led_data->pwmstate.duty_cycle;
|
|
|
|
do_div(brightness, led_data->pwmstate.period);
|
|
|
|
led_data->cdev.brightness = brightness;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2016-04-14 19:17:26 +00:00
|
|
|
|
2020-09-19 05:31:44 +00:00
|
|
|
ret = devm_led_classdev_register_ext(dev, &led_data->cdev, &init_data);
|
2020-04-21 13:09:14 +00:00
|
|
|
if (ret) {
|
2014-04-06 22:20:08 +00:00
|
|
|
dev_err(dev, "failed to register PWM led for %s: %d\n",
|
|
|
|
led->name, ret);
|
2020-04-21 13:09:14 +00:00
|
|
|
return ret;
|
2014-04-06 22:20:08 +00:00
|
|
|
}
|
|
|
|
|
2021-06-08 06:35:54 +00:00
|
|
|
if (led->default_state != LEDS_DEFSTATE_KEEP) {
|
|
|
|
ret = led_pwm_set(&led_data->cdev, led_data->cdev.brightness);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(dev, "failed to set led PWM value for %s: %d",
|
|
|
|
led->name, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
2020-04-21 13:09:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
priv->num_leds++;
|
|
|
|
return 0;
|
2014-04-06 22:20:08 +00:00
|
|
|
}
|
2013-01-28 14:00:59 +00:00
|
|
|
|
leds: pwm: Support ACPI via firmware-node framework
DT specific handling is replaced by firmware-node abstration to support
ACPI specification of PWM LEDS.
Example ASL:
Device (PWML)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () { Package () {"compatible",
Package () {"pwm-leds"}}}})
Device (PWL0)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "alarm-led"},
Package () {"pwms", Package ()
{\_SB_.PCI0.PWM, 0, 600000, 0}},
Package () {"linux,default-state", "off"}}})
}
}
Signed-off-by: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2019-06-12 08:36:08 +00:00
|
|
|
static int led_pwm_create_fwnode(struct device *dev, struct led_pwm_priv *priv)
|
2009-02-11 21:24:40 +00:00
|
|
|
{
|
leds: pwm: Support ACPI via firmware-node framework
DT specific handling is replaced by firmware-node abstration to support
ACPI specification of PWM LEDS.
Example ASL:
Device (PWML)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () { Package () {"compatible",
Package () {"pwm-leds"}}}})
Device (PWL0)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "alarm-led"},
Package () {"pwms", Package ()
{\_SB_.PCI0.PWM, 0, 600000, 0}},
Package () {"linux,default-state", "off"}}})
}
}
Signed-off-by: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2019-06-12 08:36:08 +00:00
|
|
|
struct fwnode_handle *fwnode;
|
2014-04-06 22:20:13 +00:00
|
|
|
struct led_pwm led;
|
2021-05-10 09:50:43 +00:00
|
|
|
int ret;
|
2009-02-11 21:24:40 +00:00
|
|
|
|
leds: pwm: Support ACPI via firmware-node framework
DT specific handling is replaced by firmware-node abstration to support
ACPI specification of PWM LEDS.
Example ASL:
Device (PWML)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () { Package () {"compatible",
Package () {"pwm-leds"}}}})
Device (PWL0)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "alarm-led"},
Package () {"pwms", Package ()
{\_SB_.PCI0.PWM, 0, 600000, 0}},
Package () {"linux,default-state", "off"}}})
}
}
Signed-off-by: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2019-06-12 08:36:08 +00:00
|
|
|
device_for_each_child_node(dev, fwnode) {
|
2022-12-20 07:33:35 +00:00
|
|
|
memset(&led, 0, sizeof(led));
|
|
|
|
|
leds: pwm: Support ACPI via firmware-node framework
DT specific handling is replaced by firmware-node abstration to support
ACPI specification of PWM LEDS.
Example ASL:
Device (PWML)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () { Package () {"compatible",
Package () {"pwm-leds"}}}})
Device (PWL0)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "alarm-led"},
Package () {"pwms", Package ()
{\_SB_.PCI0.PWM, 0, 600000, 0}},
Package () {"linux,default-state", "off"}}})
}
}
Signed-off-by: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2019-06-12 08:36:08 +00:00
|
|
|
ret = fwnode_property_read_string(fwnode, "label", &led.name);
|
|
|
|
if (ret && is_of_node(fwnode))
|
|
|
|
led.name = to_of_node(fwnode)->name;
|
2012-12-21 09:44:01 +00:00
|
|
|
|
leds: pwm: Support ACPI via firmware-node framework
DT specific handling is replaced by firmware-node abstration to support
ACPI specification of PWM LEDS.
Example ASL:
Device (PWML)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () { Package () {"compatible",
Package () {"pwm-leds"}}}})
Device (PWL0)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "alarm-led"},
Package () {"pwms", Package ()
{\_SB_.PCI0.PWM, 0, 600000, 0}},
Package () {"linux,default-state", "off"}}})
}
}
Signed-off-by: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2019-06-12 08:36:08 +00:00
|
|
|
if (!led.name) {
|
2023-07-11 06:13:34 +00:00
|
|
|
ret = -EINVAL;
|
2021-05-10 09:50:43 +00:00
|
|
|
goto err_child_out;
|
leds: pwm: Support ACPI via firmware-node framework
DT specific handling is replaced by firmware-node abstration to support
ACPI specification of PWM LEDS.
Example ASL:
Device (PWML)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () { Package () {"compatible",
Package () {"pwm-leds"}}}})
Device (PWL0)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "alarm-led"},
Package () {"pwms", Package ()
{\_SB_.PCI0.PWM, 0, 600000, 0}},
Package () {"linux,default-state", "off"}}})
}
}
Signed-off-by: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2019-06-12 08:36:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
led.active_low = fwnode_property_read_bool(fwnode,
|
|
|
|
"active-low");
|
|
|
|
fwnode_property_read_u32(fwnode, "max-brightness",
|
|
|
|
&led.max_brightness);
|
2013-01-28 14:00:59 +00:00
|
|
|
|
2021-06-08 06:35:54 +00:00
|
|
|
led.default_state = led_init_default_state_get(fwnode);
|
|
|
|
|
leds: pwm: Support ACPI via firmware-node framework
DT specific handling is replaced by firmware-node abstration to support
ACPI specification of PWM LEDS.
Example ASL:
Device (PWML)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () { Package () {"compatible",
Package () {"pwm-leds"}}}})
Device (PWL0)
{
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "alarm-led"},
Package () {"pwms", Package ()
{\_SB_.PCI0.PWM, 0, 600000, 0}},
Package () {"linux,default-state", "off"}}})
}
}
Signed-off-by: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2019-06-12 08:36:08 +00:00
|
|
|
ret = led_pwm_add(dev, priv, &led, fwnode);
|
2021-05-10 09:50:43 +00:00
|
|
|
if (ret)
|
|
|
|
goto err_child_out;
|
2012-12-21 09:44:01 +00:00
|
|
|
}
|
|
|
|
|
2021-05-10 09:50:43 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_child_out:
|
|
|
|
fwnode_handle_put(fwnode);
|
2013-11-28 09:06:38 +00:00
|
|
|
return ret;
|
2012-12-21 09:44:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int led_pwm_probe(struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
struct led_pwm_priv *priv;
|
2013-11-28 09:06:38 +00:00
|
|
|
int ret = 0;
|
2020-10-05 20:34:40 +00:00
|
|
|
int count;
|
2013-11-28 09:06:38 +00:00
|
|
|
|
2020-10-05 20:34:40 +00:00
|
|
|
count = device_get_child_node_count(&pdev->dev);
|
2013-11-28 09:06:38 +00:00
|
|
|
|
|
|
|
if (!count)
|
|
|
|
return -EINVAL;
|
2012-12-21 09:44:01 +00:00
|
|
|
|
2019-08-30 00:53:20 +00:00
|
|
|
priv = devm_kzalloc(&pdev->dev, struct_size(priv, leds, count),
|
2013-11-28 09:06:38 +00:00
|
|
|
GFP_KERNEL);
|
|
|
|
if (!priv)
|
|
|
|
return -ENOMEM;
|
2012-12-21 09:44:01 +00:00
|
|
|
|
2020-10-05 20:34:40 +00:00
|
|
|
ret = led_pwm_create_fwnode(&pdev->dev, priv);
|
2014-04-06 22:20:08 +00:00
|
|
|
|
2018-12-07 12:32:51 +00:00
|
|
|
if (ret)
|
2014-04-06 22:20:08 +00:00
|
|
|
return ret;
|
2009-02-11 21:24:40 +00:00
|
|
|
|
2012-12-21 09:43:56 +00:00
|
|
|
platform_set_drvdata(pdev, priv);
|
2009-02-11 21:24:40 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-12-21 09:44:01 +00:00
|
|
|
static const struct of_device_id of_pwm_leds_match[] = {
|
|
|
|
{ .compatible = "pwm-leds", },
|
|
|
|
{},
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(of, of_pwm_leds_match);
|
|
|
|
|
2009-02-11 21:24:40 +00:00
|
|
|
static struct platform_driver led_pwm_driver = {
|
|
|
|
.probe = led_pwm_probe,
|
|
|
|
.driver = {
|
|
|
|
.name = "leds_pwm",
|
2013-09-28 11:38:31 +00:00
|
|
|
.of_match_table = of_pwm_leds_match,
|
2009-02-11 21:24:40 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2012-01-10 23:09:24 +00:00
|
|
|
module_platform_driver(led_pwm_driver);
|
2009-02-11 21:24:40 +00:00
|
|
|
|
|
|
|
MODULE_AUTHOR("Luotao Fu <l.fu@pengutronix.de>");
|
2013-11-25 20:43:45 +00:00
|
|
|
MODULE_DESCRIPTION("generic PWM LED driver");
|
|
|
|
MODULE_LICENSE("GPL v2");
|
2009-02-11 21:24:40 +00:00
|
|
|
MODULE_ALIAS("platform:leds-pwm");
|