Commit b68edac9 authored by Thierry Reding's avatar Thierry Reding

unicore32: nb0916: Use PWM lookup table

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: default avatarThierry Reding <thierry.reding@gmail.com>
parent cdc13708
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
...@@ -49,11 +50,14 @@ static struct resource puv3_i2c_resources[] = { ...@@ -49,11 +50,14 @@ static struct resource puv3_i2c_resources[] = {
} }
}; };
static struct pwm_lookup nb0916_pwm_lookup[] = {
PWM_LOOKUP("PKUnity-v3-PWM", 0, "pwm-backlight", NULL, 70 * 1024,
PWM_POLARITY_NORMAL),
};
static struct platform_pwm_backlight_data nb0916_backlight_data = { static struct platform_pwm_backlight_data nb0916_backlight_data = {
.pwm_id = 0,
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 100, .dft_brightness = 100,
.pwm_period_ns = 70 * 1024,
.enable_gpio = -1, .enable_gpio = -1,
}; };
...@@ -112,6 +116,8 @@ int __init mach_nb0916_init(void) ...@@ -112,6 +116,8 @@ int __init mach_nb0916_init(void)
platform_device_register_simple("PKUnity-v3-I2C", -1, platform_device_register_simple("PKUnity-v3-I2C", -1,
puv3_i2c_resources, ARRAY_SIZE(puv3_i2c_resources)); 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, platform_device_register_data(NULL, "pwm-backlight", -1,
&nb0916_backlight_data, sizeof(nb0916_backlight_data)); &nb0916_backlight_data, sizeof(nb0916_backlight_data));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment