]> Git Repo - u-boot.git/blame - drivers/video/exynos/exynos_pwm_bl.c
SPDX: Convert all of our single license tags to Linux Kernel style
[u-boot.git] / drivers / video / exynos / exynos_pwm_bl.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
6fff52b9
DL
2/*
3 * PWM BACKLIGHT driver for Board based on EXYNOS.
4 *
5 * Author: Donghwa Lee <[email protected]>
6 *
7 * Derived from linux/drivers/video/backlight/pwm_backlight.c
6fff52b9
DL
8 */
9
10#include <common.h>
11#include <pwm.h>
12#include <linux/types.h>
13#include <asm/io.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>
18
19static struct pwm_backlight_data *pwm;
20
21static int exynos_pwm_backlight_update_status(void)
22{
23 int brightness = pwm->brightness;
24 int max = pwm->max_brightness;
25
26 if (brightness == 0) {
27 pwm_config(pwm->pwm_id, 0, pwm->period);
28 pwm_disable(pwm->pwm_id);
29 } else {
30 pwm_config(pwm->pwm_id,
31 brightness * pwm->period / max, pwm->period);
32 pwm_enable(pwm->pwm_id);
33 }
34 return 0;
35}
36
37int exynos_pwm_backlight_init(struct pwm_backlight_data *pd)
38{
39 pwm = pd;
40
41 exynos_pwm_backlight_update_status();
42
43 return 0;
44}
This page took 0.221168 seconds and 4 git commands to generate.