Skip to content

Commit cee25d7

Browse files
committed
drm/simpledrm: Make backlight support a Kconfig option
And make it mutually exclusive with DCP. Signed-off-by: Hector Martin <marcan@marcan.st>
1 parent c7906f5 commit cee25d7

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

drivers/gpu/drm/tiny/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ config DRM_SIMPLEDRM
9797
On x86 BIOS or UEFI systems, you should also select SYSFB_SIMPLEFB
9898
to use UEFI and VESA framebuffers.
9999

100+
config DRM_SIMPLEDRM_BACKLIGHT
101+
bool "Backlight support for simpledrm"
102+
depends on DRM_SIMPLEDRM && !DRM_APPLE
103+
select BACKLIGHT_CLASS_DEVICE
104+
help
105+
Enable backlight support for simpledrm.
106+
100107
config TINYDRM_HX8357D
101108
tristate "DRM support for HX8357D display panels"
102109
depends on DRM && SPI

drivers/gpu/drm/tiny/simpledrm.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22

3+
#if defined CONFIG_DRM_SIMPLEDRM_BACKLIGHT
34
#include <linux/backlight.h>
5+
#endif
46
#include <linux/clk.h>
57
#include <linux/of_clk.h>
68
#include <linux/minmax.h>
@@ -244,8 +246,10 @@ struct simpledrm_device {
244246
struct drm_crtc crtc;
245247
struct drm_encoder encoder;
246248
struct drm_connector connector;
249+
#if defined CONFIG_DRM_SIMPLEDRM_BACKLIGHT
247250
/* backlight */
248251
struct backlight_device *backlight;
252+
#endif
249253
};
250254

251255
static struct simpledrm_device *simpledrm_device_of_dev(struct drm_device *dev)
@@ -556,6 +560,7 @@ static enum drm_mode_status simpledrm_crtc_helper_mode_valid(struct drm_crtc *cr
556560
return drm_crtc_helper_mode_valid_fixed(crtc, mode, &sdev->mode);
557561
}
558562

563+
#if defined CONFIG_DRM_SIMPLEDRM_BACKLIGHT
559564
static void simpledrm_crtc_helper_atomic_enable(struct drm_crtc *crtc,
560565
struct drm_atomic_state *state)
561566
{
@@ -575,6 +580,7 @@ static void simpledrm_crtc_helper_atomic_disable(struct drm_crtc *crtc,
575580
if (sdev->backlight)
576581
backlight_disable(sdev->backlight);
577582
}
583+
#endif
578584

579585
/*
580586
* The CRTC is always enabled. Screen updates are performed by
@@ -584,8 +590,10 @@ static void simpledrm_crtc_helper_atomic_disable(struct drm_crtc *crtc,
584590
static const struct drm_crtc_helper_funcs simpledrm_crtc_helper_funcs = {
585591
.mode_valid = simpledrm_crtc_helper_mode_valid,
586592
.atomic_check = drm_crtc_helper_atomic_check,
593+
#if defined CONFIG_DRM_SIMPLEDRM_BACKLIGHT
587594
.atomic_enable = simpledrm_crtc_helper_atomic_enable,
588595
.atomic_disable = simpledrm_crtc_helper_atomic_disable,
596+
#endif
589597
};
590598

591599
static const struct drm_crtc_funcs simpledrm_crtc_funcs = {
@@ -674,10 +682,11 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
674682
* Hardware settings
675683
*/
676684

685+
#if defined CONFIG_DRM_SIMPLEDRM_BACKLIGHT
677686
sdev->backlight = devm_of_find_backlight(&pdev->dev);
678687
if (IS_ERR(sdev->backlight))
679688
sdev->backlight = NULL;
680-
689+
#endif
681690
ret = simpledrm_device_init_clocks(sdev);
682691
if (ret)
683692
return ERR_PTR(ret);

0 commit comments

Comments
 (0)