diff mbox series

drm/i915: Backlight control via VESA eDP aux interface

Message ID 1560156055-10451-1-git-send-email-shawn.c.lee@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Backlight control via VESA eDP aux interface | expand

Commit Message

Lee, Shawn C June 10, 2019, 8:40 a.m. UTC
The latest VBT support backlight control via aux. We have to
check VBT's setting before doing backlight initialization.
Then Driver will assign correct callback function for eDP
backlight control.

Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Jose Roberto de Souza <jose.souza@intel.com>
Cc: Cooper Chiou <cooper.chiou@intel.com>

Signed-off-by: Lee, Shawn C <shawn.c.lee@intel.com>
---
 drivers/gpu/drm/i915/intel_bios.c     | 3 ++-
 drivers/gpu/drm/i915/intel_vbt_defs.h | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

Comments

Jani Nikula June 10, 2019, 9:48 a.m. UTC | #1
On Mon, 10 Jun 2019, "Lee, Shawn C" <shawn.c.lee@intel.com> wrote:
> The latest VBT support backlight control via aux. We have to
> check VBT's setting before doing backlight initialization.
> Then Driver will assign correct callback function for eDP
> backlight control.
>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Jose Roberto de Souza <jose.souza@intel.com>
> Cc: Cooper Chiou <cooper.chiou@intel.com>
>
> Signed-off-by: Lee, Shawn C <shawn.c.lee@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_bios.c     | 3 ++-
>  drivers/gpu/drm/i915/intel_vbt_defs.h | 6 ++++--
>  2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 1c037dfa83f5..27bda45520ec 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -317,7 +317,8 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv,
>  
>  	entry = &backlight_data->data[panel_type];
>  
> -	dev_priv->vbt.backlight.present = entry->type == BDB_BACKLIGHT_TYPE_PWM;
> +	dev_priv->vbt.backlight.present = (entry->type == BDB_BACKLIGHT_TYPE_PWM_SOC ||
> +					   entry->type == BDB_BACKLIGHT_TYPE_PWM_VESA_EDP_AUX);
>  	if (!dev_priv->vbt.backlight.present) {
>  		DRM_DEBUG_KMS("PWM backlight not present in VBT (type %u)\n",
>  			      entry->type);
> diff --git a/drivers/gpu/drm/i915/intel_vbt_defs.h b/drivers/gpu/drm/i915/intel_vbt_defs.h
> index 89ef14cafb6b..710f539f17de 100644
> --- a/drivers/gpu/drm/i915/intel_vbt_defs.h
> +++ b/drivers/gpu/drm/i915/intel_vbt_defs.h
> @@ -760,8 +760,10 @@ struct bdb_lvds_lfp_data {
>   * Block 43 - LFP Backlight Control Data Block
>   */
>  
> -#define BDB_BACKLIGHT_TYPE_NONE	0
> -#define BDB_BACKLIGHT_TYPE_PWM	2
> +#define BDB_BACKLIGHT_TYPE_NONE				0
> +#define BDB_BACKLIGHT_TYPE_PWM_SOC			2
> +#define BDB_BACKLIGHT_TYPE_PWM_PANEL_DRIVER_OLED	4
> +#define BDB_BACKLIGHT_TYPE_PWM_VESA_EDP_AUX		5

entry->type is two bits, 0-1 in the Features byte of the Backlight Data
Structure in the spec. BDB_BACKLIGHT_TYPE_PWM_VESA_EDP_AUX will never
match, so this was also never tested. There are no updates to the VBT
spec to reflect the above change (and if I saw one, I'd reject it as
backward incompatible).

Please don't tell me you have some product specific spec and VBT there,
because it's not flying upstream.

The brightness control method structure does have a more detailed way of
describing the method, and it probably already covers what you need.

BR,
Jani.


>  
>  struct lfp_backlight_data_entry {
>  	u8 type:2;
Jani Nikula June 10, 2019, 9:51 a.m. UTC | #2
On Mon, 10 Jun 2019, Jani Nikula <jani.nikula@intel.com> wrote:
> On Mon, 10 Jun 2019, "Lee, Shawn C" <shawn.c.lee@intel.com> wrote:
>> The latest VBT support backlight control via aux. We have to
>> check VBT's setting before doing backlight initialization.
>> Then Driver will assign correct callback function for eDP
>> backlight control.
>>
>> Cc: Jani Nikula <jani.nikula@intel.com>
>> Cc: Jose Roberto de Souza <jose.souza@intel.com>
>> Cc: Cooper Chiou <cooper.chiou@intel.com>
>>
>> Signed-off-by: Lee, Shawn C <shawn.c.lee@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_bios.c     | 3 ++-
>>  drivers/gpu/drm/i915/intel_vbt_defs.h | 6 ++++--
>>  2 files changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
>> index 1c037dfa83f5..27bda45520ec 100644
>> --- a/drivers/gpu/drm/i915/intel_bios.c
>> +++ b/drivers/gpu/drm/i915/intel_bios.c
>> @@ -317,7 +317,8 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv,
>>  
>>  	entry = &backlight_data->data[panel_type];
>>  
>> -	dev_priv->vbt.backlight.present = entry->type == BDB_BACKLIGHT_TYPE_PWM;
>> +	dev_priv->vbt.backlight.present = (entry->type == BDB_BACKLIGHT_TYPE_PWM_SOC ||
>> +					   entry->type == BDB_BACKLIGHT_TYPE_PWM_VESA_EDP_AUX);
>>  	if (!dev_priv->vbt.backlight.present) {
>>  		DRM_DEBUG_KMS("PWM backlight not present in VBT (type %u)\n",
>>  			      entry->type);
>> diff --git a/drivers/gpu/drm/i915/intel_vbt_defs.h b/drivers/gpu/drm/i915/intel_vbt_defs.h
>> index 89ef14cafb6b..710f539f17de 100644
>> --- a/drivers/gpu/drm/i915/intel_vbt_defs.h
>> +++ b/drivers/gpu/drm/i915/intel_vbt_defs.h
>> @@ -760,8 +760,10 @@ struct bdb_lvds_lfp_data {
>>   * Block 43 - LFP Backlight Control Data Block
>>   */
>>  
>> -#define BDB_BACKLIGHT_TYPE_NONE	0
>> -#define BDB_BACKLIGHT_TYPE_PWM	2
>> +#define BDB_BACKLIGHT_TYPE_NONE				0
>> +#define BDB_BACKLIGHT_TYPE_PWM_SOC			2
>> +#define BDB_BACKLIGHT_TYPE_PWM_PANEL_DRIVER_OLED	4
>> +#define BDB_BACKLIGHT_TYPE_PWM_VESA_EDP_AUX		5
>
> entry->type is two bits, 0-1 in the Features byte of the Backlight Data
> Structure in the spec. BDB_BACKLIGHT_TYPE_PWM_VESA_EDP_AUX will never
> match, so this was also never tested. There are no updates to the VBT
> spec to reflect the above change (and if I saw one, I'd reject it as
> backward incompatible).
>
> Please don't tell me you have some product specific spec and VBT there,
> because it's not flying upstream.
>
> The brightness control method structure does have a more detailed way of
> describing the method, and it probably already covers what you need.

Indeed you probably want to look at dev_priv->vbt.backlight.type and how
it's assigned, as well as update enum intel_backlight_type.

BR,
Jani.


>
> BR,
> Jani.
>
>
>>  
>>  struct lfp_backlight_data_entry {
>>  	u8 type:2;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 1c037dfa83f5..27bda45520ec 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -317,7 +317,8 @@  parse_lfp_backlight(struct drm_i915_private *dev_priv,
 
 	entry = &backlight_data->data[panel_type];
 
-	dev_priv->vbt.backlight.present = entry->type == BDB_BACKLIGHT_TYPE_PWM;
+	dev_priv->vbt.backlight.present = (entry->type == BDB_BACKLIGHT_TYPE_PWM_SOC ||
+					   entry->type == BDB_BACKLIGHT_TYPE_PWM_VESA_EDP_AUX);
 	if (!dev_priv->vbt.backlight.present) {
 		DRM_DEBUG_KMS("PWM backlight not present in VBT (type %u)\n",
 			      entry->type);
diff --git a/drivers/gpu/drm/i915/intel_vbt_defs.h b/drivers/gpu/drm/i915/intel_vbt_defs.h
index 89ef14cafb6b..710f539f17de 100644
--- a/drivers/gpu/drm/i915/intel_vbt_defs.h
+++ b/drivers/gpu/drm/i915/intel_vbt_defs.h
@@ -760,8 +760,10 @@  struct bdb_lvds_lfp_data {
  * Block 43 - LFP Backlight Control Data Block
  */
 
-#define BDB_BACKLIGHT_TYPE_NONE	0
-#define BDB_BACKLIGHT_TYPE_PWM	2
+#define BDB_BACKLIGHT_TYPE_NONE				0
+#define BDB_BACKLIGHT_TYPE_PWM_SOC			2
+#define BDB_BACKLIGHT_TYPE_PWM_PANEL_DRIVER_OLED	4
+#define BDB_BACKLIGHT_TYPE_PWM_VESA_EDP_AUX		5
 
 struct lfp_backlight_data_entry {
 	u8 type:2;