Skip to content

Commit c90b155

Browse files
vsyrjalajnikula
authored andcommitted
drm/i915: Pick the backlight controller based on VBT on ICP+
Use the second backlight controller on ICP+ if the VBT asks us to do so. On pre-MTP we also check the chicken bit to make sure the pins have been correctly muxed by the firmware. Cc: [email protected] Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8016 Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Jani Nikula <[email protected]> (cherry picked from commit b337715) Signed-off-by: Jani Nikula <[email protected]>
1 parent 14e591a commit c90b155

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

drivers/gpu/drm/i915/display/intel_backlight.c

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,6 +1431,30 @@ bxt_setup_backlight(struct intel_connector *connector, enum pipe unused)
14311431
return 0;
14321432
}
14331433

1434+
static int cnp_num_backlight_controllers(struct drm_i915_private *i915)
1435+
{
1436+
if (INTEL_PCH_TYPE(i915) >= PCH_DG1)
1437+
return 1;
1438+
1439+
if (INTEL_PCH_TYPE(i915) >= PCH_ICP)
1440+
return 2;
1441+
1442+
return 1;
1443+
}
1444+
1445+
static bool cnp_backlight_controller_is_valid(struct drm_i915_private *i915, int controller)
1446+
{
1447+
if (controller < 0 || controller >= cnp_num_backlight_controllers(i915))
1448+
return false;
1449+
1450+
if (controller == 1 &&
1451+
INTEL_PCH_TYPE(i915) >= PCH_ICP &&
1452+
INTEL_PCH_TYPE(i915) < PCH_MTP)
1453+
return intel_de_read(i915, SOUTH_CHICKEN1) & ICP_SECOND_PPS_IO_SELECT;
1454+
1455+
return true;
1456+
}
1457+
14341458
static int
14351459
cnp_setup_backlight(struct intel_connector *connector, enum pipe unused)
14361460
{
@@ -1440,10 +1464,14 @@ cnp_setup_backlight(struct intel_connector *connector, enum pipe unused)
14401464

14411465
/*
14421466
* CNP has the BXT implementation of backlight, but with only one
1443-
* controller. TODO: ICP has multiple controllers but we only use
1444-
* controller 0 for now.
1467+
* controller. ICP+ can have two controllers, depending on pin muxing.
14451468
*/
1446-
panel->backlight.controller = 0;
1469+
panel->backlight.controller = connector->panel.vbt.backlight.controller;
1470+
if (!cnp_backlight_controller_is_valid(i915, panel->backlight.controller)) {
1471+
drm_dbg_kms(&i915->drm, "Invalid backlight controller %d, assuming 0\n",
1472+
panel->backlight.controller);
1473+
panel->backlight.controller = 0;
1474+
}
14471475

14481476
pwm_ctl = intel_de_read(i915,
14491477
BXT_BLC_PWM_CTL(panel->backlight.controller));

0 commit comments

Comments
 (0)