* [PATCH] unicore32: nb0916: Use PWM lookup table
@ 2015-10-05 6:08 Thierry Reding
2015-11-06 14:35 ` Thierry Reding
0 siblings, 1 reply; 2+ messages in thread
From: Thierry Reding @ 2015-10-05 6:08 UTC (permalink / raw)
To: Guan Xuetao; +Cc: linux-pwm, linux-kernel, Thierry Reding
Use a PWM lookup table to provide the PWM to the pwm-backlight device.
The driver has a legacy code path that is required only because boards
still use the legacy method of requesting PWMs by global ID. Replacing
these usages allows that legacy fallback to be removed.
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
arch/unicore32/kernel/puv3-nb0916.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/unicore32/kernel/puv3-nb0916.c b/arch/unicore32/kernel/puv3-nb0916.c
index 46ebfdccbc31..af3962d90def 100644
--- a/arch/unicore32/kernel/puv3-nb0916.c
+++ b/arch/unicore32/kernel/puv3-nb0916.c
@@ -19,6 +19,7 @@
#include <linux/reboot.h>
#include <linux/interrupt.h>
#include <linux/i2c.h>
+#include <linux/pwm.h>
#include <linux/pwm_backlight.h>
#include <linux/gpio.h>
#include <linux/gpio_keys.h>
@@ -49,8 +50,12 @@ static struct resource puv3_i2c_resources[] = {
}
};
+static struct pwm_lookup nb0916_pwm_lookup[] = {
+ PWM_LOOKUP("PKUnity-v3-PWM", 0, "pwm-backlight", NULL, 0,
+ PWM_POLARITY_NORMAL),
+};
+
static struct platform_pwm_backlight_data nb0916_backlight_data = {
- .pwm_id = 0,
.max_brightness = 100,
.dft_brightness = 100,
.pwm_period_ns = 70 * 1024,
@@ -112,6 +117,8 @@ int __init mach_nb0916_init(void)
platform_device_register_simple("PKUnity-v3-I2C", -1,
puv3_i2c_resources, ARRAY_SIZE(puv3_i2c_resources));
+ pwm_add_table(nb0916_pwm_lookup, ARRAY_SIZE(nb0916_pwm_lookup));
+
platform_device_register_data(NULL, "pwm-backlight", -1,
&nb0916_backlight_data, sizeof(nb0916_backlight_data));
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] unicore32: nb0916: Use PWM lookup table
2015-10-05 6:08 [PATCH] unicore32: nb0916: Use PWM lookup table Thierry Reding
@ 2015-11-06 14:35 ` Thierry Reding
0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2015-11-06 14:35 UTC (permalink / raw)
To: Guan Xuetao; +Cc: linux-pwm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 729 bytes --]
On Mon, Oct 05, 2015 at 08:08:43AM +0200, Thierry Reding wrote:
> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> The driver has a legacy code path that is required only because boards
> still use the legacy method of requesting PWMs by global ID. Replacing
> these usages allows that legacy fallback to be removed.
>
> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
> arch/unicore32/kernel/puv3-nb0916.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
Guan, I've applied this to my PWM tree since you haven't responded to
this. The change is low-risk and badly needed to clean up PWM consumer
drivers.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-06 14:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-05 6:08 [PATCH] unicore32: nb0916: Use PWM lookup table Thierry Reding
2015-11-06 14:35 ` Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox