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
251255static 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
559564static 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,
584590static 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
591599static 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