1 // SPDX-License-Identifier: GPL-2.0+
3 * PWM BACKLIGHT driver for Board based on EXYNOS.
7 * Derived from linux/drivers/video/backlight/pwm_backlight.c
12 #include <linux/types.h>
14 #include <asm/arch/cpu.h>
15 #include <asm/arch/gpio.h>
16 #include <asm/arch/pwm.h>
17 #include <asm/arch/pwm_backlight.h>
19 static struct pwm_backlight_data *pwm;
21 static int exynos_pwm_backlight_update_status(void)
23 int brightness = pwm->brightness;
24 int max = pwm->max_brightness;
26 if (brightness == 0) {
27 pwm_config(pwm->pwm_id, 0, pwm->period);
28 pwm_disable(pwm->pwm_id);
30 pwm_config(pwm->pwm_id,
31 brightness * pwm->period / max, pwm->period);
32 pwm_enable(pwm->pwm_id);
37 int exynos_pwm_backlight_init(struct pwm_backlight_data *pd)
41 exynos_pwm_backlight_update_status();