diff mbox

[v5,4/9] drm/i915: Allow choosing how to adjust brightness if both supported

Message ID 20170504002836.120988-5-puthik@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Puthikorn Voravootivat May 4, 2017, 12:28 a.m. UTC
Add option to allow choosing how to adjust brightness if
panel supports both PWM pin and AUX channel.

Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
---
 drivers/gpu/drm/i915/i915_params.c            |  6 ++++--
 drivers/gpu/drm/i915/i915_params.h            |  2 +-
 drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 17 ++++++++++++++++-
 3 files changed, 21 insertions(+), 4 deletions(-)

Comments

kernel test robot May 5, 2017, 9:10 a.m. UTC | #1
Hi Puthikorn,

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on next-20170504]
[cannot apply to v4.11]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Puthikorn-Voravootivat/Enhancement-to-intel_dp_aux_backlight-driver/20170505-003007
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-rhel (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from include/linux/module.h:18:0,
                    from include/drm/drmP.h:59,
                    from drivers/gpu/drm/i915/i915_drv.h:47,
                    from drivers/gpu/drm/i915/i915_params.c:26:
   drivers/gpu/drm/i915/i915_params.c: In function '__check_enable_dpcd_backlight':
>> include/linux/moduleparam.h:146:27: error: return from incompatible pointer type [-Werror=incompatible-pointer-types]
     param_check_##type(name, &(value));       \
                              ^
   include/linux/moduleparam.h:344:68: note: in definition of macro '__param_check'
     static inline type __always_unused *__check_##name(void) { return(p); }
                                                                       ^
   include/linux/moduleparam.h:146:2: note: in expansion of macro 'param_check_bool'
     param_check_##type(name, &(value));       \
     ^~~~~~~~~~~~
   drivers/gpu/drm/i915/i915_params.c:249:1: note: in expansion of macro 'module_param_named'
    module_param_named(enable_dpcd_backlight, i915.enable_dpcd_backlight, bool, 0600);
    ^~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from include/linux/module.h:18:0,
                    from include/drm/drmP.h:59,
                    from drivers/gpu//drm/i915/i915_drv.h:47,
                    from drivers/gpu//drm/i915/i915_params.c:26:
   drivers/gpu//drm/i915/i915_params.c: In function '__check_enable_dpcd_backlight':
>> include/linux/moduleparam.h:146:27: error: return from incompatible pointer type [-Werror=incompatible-pointer-types]
     param_check_##type(name, &(value));       \
                              ^
   include/linux/moduleparam.h:344:68: note: in definition of macro '__param_check'
     static inline type __always_unused *__check_##name(void) { return(p); }
                                                                       ^
   include/linux/moduleparam.h:146:2: note: in expansion of macro 'param_check_bool'
     param_check_##type(name, &(value));       \
     ^~~~~~~~~~~~
   drivers/gpu//drm/i915/i915_params.c:249:1: note: in expansion of macro 'module_param_named'
    module_param_named(enable_dpcd_backlight, i915.enable_dpcd_backlight, bool, 0600);
    ^~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +146 include/linux/moduleparam.h

3baee201 Jani Nikula   2014-08-27  130   */
3baee201 Jani Nikula   2014-08-27  131  #define module_param_unsafe(name, type, perm)			\
3baee201 Jani Nikula   2014-08-27  132  	module_param_named_unsafe(name, name, type, perm)
3baee201 Jani Nikula   2014-08-27  133  
3baee201 Jani Nikula   2014-08-27  134  /**
546970bc Rusty Russell 2010-08-11  135   * module_param_named - typesafe helper for a renamed module/cmdline parameter
546970bc Rusty Russell 2010-08-11  136   * @name: a valid C identifier which is the parameter name.
546970bc Rusty Russell 2010-08-11  137   * @value: the actual lvalue to alter.
546970bc Rusty Russell 2010-08-11  138   * @type: the type of the parameter
546970bc Rusty Russell 2010-08-11  139   * @perm: visibility in sysfs.
546970bc Rusty Russell 2010-08-11  140   *
546970bc Rusty Russell 2010-08-11  141   * Usually it's a good idea to have variable names and user-exposed names the
546970bc Rusty Russell 2010-08-11  142   * same, but that's harder if the variable must be non-static or is inside a
546970bc Rusty Russell 2010-08-11  143   * structure.  This allows exposure under a different name.
546970bc Rusty Russell 2010-08-11  144   */
546970bc Rusty Russell 2010-08-11  145  #define module_param_named(name, value, type, perm)			   \
546970bc Rusty Russell 2010-08-11 @146  	param_check_##type(name, &(value));				   \
546970bc Rusty Russell 2010-08-11  147  	module_param_cb(name, &param_ops_##type, &value, perm);		   \
546970bc Rusty Russell 2010-08-11  148  	__MODULE_PARM_TYPE(name, #type)
546970bc Rusty Russell 2010-08-11  149  
546970bc Rusty Russell 2010-08-11  150  /**
3baee201 Jani Nikula   2014-08-27  151   * module_param_named_unsafe - same as module_param_named but taints kernel
3baee201 Jani Nikula   2014-08-27  152   */
3baee201 Jani Nikula   2014-08-27  153  #define module_param_named_unsafe(name, value, type, perm)		\
3baee201 Jani Nikula   2014-08-27  154  	param_check_##type(name, &(value));				\

:::::: The code at line 146 was first introduced by commit
:::::: 546970bc6afc7fb37447fbac09b82c7884662c21 param: add kerneldoc to moduleparam.h

:::::: TO: Rusty Russell <rusty@rustcorp.com.au>
:::::: CC: Rusty Russell <rusty@rustcorp.com.au>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index b6a7e363d076..323d12badace 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -63,7 +63,7 @@  struct i915_params i915 __read_mostly = {
 	.huc_firmware_path = NULL,
 	.enable_dp_mst = true,
 	.inject_load_failure = 0,
-	.enable_dpcd_backlight = false,
+	.enable_dpcd_backlight = -1,
 	.enable_gvt = false,
 };
 
@@ -248,7 +248,9 @@  MODULE_PARM_DESC(inject_load_failure,
 	"Force an error after a number of failure check points (0:disabled (default), N:force failure at the Nth failure check point)");
 module_param_named(enable_dpcd_backlight, i915.enable_dpcd_backlight, bool, 0600);
 MODULE_PARM_DESC(enable_dpcd_backlight,
-	"Enable support for DPCD backlight control (default:false)");
+	"Enable support for DPCD backlight control "
+	"(-1:disable (default), 0:Use PWM pin if both supported, "
+	"1:Use DPCD if both supported");
 
 module_param_named(enable_gvt, i915.enable_gvt, bool, 0400);
 MODULE_PARM_DESC(enable_gvt,
diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h
index 34148cc8637c..ac02efce6e22 100644
--- a/drivers/gpu/drm/i915/i915_params.h
+++ b/drivers/gpu/drm/i915/i915_params.h
@@ -66,7 +66,7 @@ 
 	func(bool, verbose_state_checks); \
 	func(bool, nuclear_pageflip); \
 	func(bool, enable_dp_mst); \
-	func(bool, enable_dpcd_backlight); \
+	func(int, enable_dpcd_backlight); \
 	func(bool, enable_gvt)
 
 #define MEMBER(T, member) T member
diff --git a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
index 5b83c9737644..e82f7cb9a7af 100644
--- a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
+++ b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
@@ -175,11 +175,26 @@  intel_dp_aux_display_control_capable(struct intel_connector *connector)
 	return false;
 }
 
+static bool
+intel_dp_pwm_pin_display_control_capable(struct intel_connector *connector)
+{
+	struct intel_dp *intel_dp = enc_to_intel_dp(&connector->encoder->base);
+
+	/* Check the  eDP Display control capabilities registers to determine if
+	 * the panel can support backlight control via BL_PWM_DIM eDP pin
+	 */
+	return intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP;
+}
+
 int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector)
 {
 	struct intel_panel *panel = &intel_connector->panel;
 
-	if (!i915.enable_dpcd_backlight)
+	if (i915.enable_dpcd_backlight == -1)
+		return -ENODEV;
+
+	if (i915.enable_dpcd_backlight == 0 &&
+	    intel_dp_pwm_pin_display_control_capable(intel_connector))
 		return -ENODEV;
 
 	if (!intel_dp_aux_display_control_capable(intel_connector))