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