diff options
author | Thierry Reding <treding@nvidia.com> | 2013-12-13 13:31:27 +0100 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2014-01-10 10:15:22 +0100 |
commit | c3b09161c4fb91be645c67a9b40b217697893c4a (patch) | |
tree | b4ffee3e247ccbbbf093a251b227892982b269ad /include | |
parent | 1a7bba1951987650146e171b763e9f5ab725ba4e (diff) |
drm/panel: Add interface to manipulate brightness
Add callbacks so that panel drivers can expose brightness controls. This
allows users to manipulate the brightness of a specific panel, without
resorting to heuristics to look up the corresponding backlight device.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/drm/drm_panel.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index c2ab77add67c..898c4c4da552 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -34,6 +34,11 @@ struct drm_panel_funcs { int (*disable)(struct drm_panel *panel); int (*enable)(struct drm_panel *panel); int (*get_modes)(struct drm_panel *panel); + + int (*get_brightness_range)(struct drm_panel *panel, uint64_t *min, + uint64_t *max); + int (*get_brightness)(struct drm_panel *panel, uint64_t *value); + int (*set_brightness)(struct drm_panel *panel, uint64_t value); }; struct drm_panel { @@ -62,6 +67,33 @@ static inline int drm_panel_enable(struct drm_panel *panel) return panel ? -ENOSYS : -EINVAL; } +static inline int drm_panel_get_brightness_range(struct drm_panel *panel, + uint64_t *min, uint64_t *max) +{ + if (panel && panel->funcs && panel->funcs->get_brightness_range) + return panel->funcs->get_brightness_range(panel, min, max); + + return panel ? -ENOSYS : -EINVAL; +} + +static inline int drm_panel_get_brightness(struct drm_panel *panel, + uint64_t *value) +{ + if (panel && panel->funcs && panel->funcs->get_brightness) + return panel->funcs->get_brightness(panel, value); + + return panel ? -ENOSYS : -EINVAL; +} + +static inline int drm_panel_set_brightness(struct drm_panel *panel, + uint64_t value) +{ + if (panel && panel->funcs && panel->funcs->set_brightness) + return panel->funcs->set_brightness(panel, value); + + return panel ? -ENOSYS : -EINVAL; +} + void drm_panel_init(struct drm_panel *panel); int drm_panel_add(struct drm_panel *panel); |