1 /*
2 * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
3 * Author:Mark Yao <mark.yao@rock-chips.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15 #ifndef _ROCKCHIP_DRM_BACKLIGHT_H
16 #define _ROCKCHIP_DRM_BACKLIGHT_H
17
18 #include <linux/pwm_backlight.h>
19
20 struct rockchip_drm_backlight {
21 struct device *dev;
22 struct backlight_device *bd;
23 struct pinctrl *pinctrl;
24 struct pinctrl_state *dummy_state;
25 struct pwm_device *pwm;
26
27 struct drm_connector *connector;
28 struct sub_backlight *current_sub, *sub;
29
30 struct regulator *power_supply;
31 struct gpio_desc *enable_gpio;
32 bool enabled;
33
34 unsigned int max_brightness;
35 unsigned int dft_brightness;
36 unsigned int lth_brightness;
37 unsigned int scale;
38 unsigned int *levels;
39 };
40
41 struct rockchip_sub_backlight_ops {
42 void (*config_done)(struct device *dev, bool async);
43 };
44
45 #if IS_ENABLED(CONFIG_ROCKCHIP_DRM_BACKLIGHT)
46 int of_rockchip_drm_sub_backlight_register(struct device *dev,
47 struct drm_crtc *crtc,
48 const struct rockchip_sub_backlight_ops *ops);
49 void rockchip_drm_backlight_update(struct drm_device *drm);
50 #else
51 static inline int
of_rockchip_drm_sub_backlight_register(struct device * dev,struct drm_crtc * crtc,const struct rockchip_sub_backlight_ops * ops)52 of_rockchip_drm_sub_backlight_register(struct device *dev,
53 struct drm_crtc *crtc,
54 const struct rockchip_sub_backlight_ops *ops)
55 {
56 return 0;
57 }
58
rockchip_drm_backlight_update(struct drm_device * drm)59 static inline void rockchip_drm_backlight_update(struct drm_device *drm)
60 {
61 }
62
63 #endif
64 #endif
65