Skip to content

Commit 371abae

Browse files
Deepak Mdanvet
authored andcommitted
drm/i915: Parsing LFP brightness control from VBT
LFP brighness control from the VBT block 43 indicates which controller is used for brightness. LFP1 brightness control method: Bit 7-4 = This field controller number of the brightnes controller. 0 = Controller 0 1 = Controller 1 2 = Controller 2 3 = Controller 3 Others = Reserved Bits 3-0 = This field specifies the brightness control pin to be used on the platform. 0 = PMIC pin is used for brightness control 1 = LPSS PWM is used for brightness control 2 = Display DDI is used for brightness control 3 = CABC method to control brightness Others = Reserved Adding the above fields in dev_priv->vbt and corresponding changes in parse_backlight() v2: Jani's review comments addressed - Move PWM definitions to intel_bios.h - Moving vbt_version to intel_vbt_data - Rename brightness to bl_ctrl_data - Logging just control_pin instead of string - Avoid adding vbt_version in dev_priv - Since only DDI option is available as of now, let control pin DDI affect dev_priv->vbt.backlight.present v3: Jani's review comments addressed - Drop control_pin - Use bdb->version - set controller to 0 instead of using control pin define - check controller bounds - remove superfluous changes in intel_parse_bios Signed-off-by: Deepak M <m.deepak@intel.com> Signed-off-by: Vandana Kannan <vandana.kannan@intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent d9d8e6b commit 371abae

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,6 +1367,7 @@ struct intel_vbt_data {
13671367
bool present;
13681368
bool active_low_pwm;
13691369
u8 min_brightness; /* min_brightness/255 of max */
1370+
u8 controller; /* brightness controller number */
13701371
} backlight;
13711372

13721373
/* MIPI DSI */

drivers/gpu/drm/i915/intel_bios.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
314314
{
315315
const struct bdb_lfp_backlight_data *backlight_data;
316316
const struct bdb_lfp_backlight_data_entry *entry;
317+
const struct bdb_lfp_backlight_control_data *bl_ctrl_data;
317318

318319
backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT);
319320
if (!backlight_data)
@@ -326,6 +327,7 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
326327
}
327328

328329
entry = &backlight_data->data[panel_type];
330+
bl_ctrl_data = &backlight_data->blc_ctl[panel_type];
329331

330332
dev_priv->vbt.backlight.present = entry->type == BDB_BACKLIGHT_TYPE_PWM;
331333
if (!dev_priv->vbt.backlight.present) {
@@ -337,12 +339,30 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
337339
dev_priv->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz;
338340
dev_priv->vbt.backlight.active_low_pwm = entry->active_low_pwm;
339341
dev_priv->vbt.backlight.min_brightness = entry->min_brightness;
342+
343+
dev_priv->vbt.backlight.controller = 0;
344+
if (bdb->version >= 191) {
345+
dev_priv->vbt.backlight.present =
346+
bl_ctrl_data->pin == BLC_CONTROL_PIN_DDI;
347+
if (!dev_priv->vbt.backlight.present) {
348+
DRM_DEBUG_KMS("BL control pin is not DDI (pin %u)\n",
349+
bl_ctrl_data->pin);
350+
return;
351+
}
352+
if (bl_ctrl_data->controller == 1)
353+
dev_priv->vbt.backlight.controller =
354+
bl_ctrl_data->controller;
355+
}
356+
340357
DRM_DEBUG_KMS("VBT backlight PWM modulation frequency %u Hz, "
341358
"active %s, min brightness %u, level %u\n",
342359
dev_priv->vbt.backlight.pwm_freq_hz,
343360
dev_priv->vbt.backlight.active_low_pwm ? "low" : "high",
344361
dev_priv->vbt.backlight.min_brightness,
345362
backlight_data->level[panel_type]);
363+
364+
DRM_DEBUG_KMS("VBT BL controller %u\n",
365+
dev_priv->vbt.backlight.controller);
346366
}
347367

348368
/* Try to find sdvo panel data */

drivers/gpu/drm/i915/intel_bios.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,21 @@ struct bdb_lfp_backlight_data_entry {
402402
u8 obsolete3;
403403
} __packed;
404404

405+
#define BLC_CONTROL_PIN_PMIC 0
406+
#define BLC_CONTROL_PIN_LPSS_PWM 1
407+
#define BLC_CONTROL_PIN_DDI 2
408+
#define BLC_CONTROL_PIN_CABC 3
409+
410+
struct bdb_lfp_backlight_control_data {
411+
u8 controller:4;
412+
u8 pin:4;
413+
} __packed;
414+
405415
struct bdb_lfp_backlight_data {
406416
u8 entry_size;
407417
struct bdb_lfp_backlight_data_entry data[16];
408418
u8 level[16];
419+
struct bdb_lfp_backlight_control_data blc_ctl[16];
409420
} __packed;
410421

411422
struct aimdb_header {

0 commit comments

Comments
 (0)