Lines Matching +full:pwm +full:- +full:backlight

1 // SPDX-License-Identifier: MIT
6 #include <linux/backlight.h>
8 #include <linux/pwm.h>
26 * scale - scale values from one range to another
49 target_val = mul_u32_u32(source_val - source_min, in scale()
50 target_max - target_min); in scale()
51 target_val = DIV_ROUND_CLOSEST_ULL(target_val, source_max - source_min); in scale()
64 struct intel_panel *panel = &connector->panel; in clamp_user_to_hw()
67 hw_level = scale(user_level, 0, user_max, 0, panel->backlight.max); in clamp_user_to_hw()
68 hw_level = clamp(hw_level, panel->backlight.min, panel->backlight.max); in clamp_user_to_hw()
77 struct intel_panel *panel = &connector->panel; in scale_hw_to_user()
79 return scale(hw_level, panel->backlight.min, panel->backlight.max, in scale_hw_to_user()
85 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in intel_backlight_invert_pwm_level()
86 struct intel_panel *panel = &connector->panel; in intel_backlight_invert_pwm_level()
88 drm_WARN_ON(&dev_priv->drm, panel->backlight.pwm_level_max == 0); in intel_backlight_invert_pwm_level()
90 if (dev_priv->params.invert_brightness < 0) in intel_backlight_invert_pwm_level()
93 if (dev_priv->params.invert_brightness > 0 || in intel_backlight_invert_pwm_level()
95 return panel->backlight.pwm_level_max - val + panel->backlight.pwm_level_min; in intel_backlight_invert_pwm_level()
103 struct intel_connector *connector = to_intel_connector(conn_state->connector); in intel_backlight_set_pwm_level()
104 struct drm_i915_private *i915 = to_i915(connector->base.dev); in intel_backlight_set_pwm_level()
105 struct intel_panel *panel = &connector->panel; in intel_backlight_set_pwm_level()
107 drm_dbg_kms(&i915->drm, "set backlight PWM = %d\n", val); in intel_backlight_set_pwm_level()
108 panel->backlight.pwm_funcs->set(conn_state, val); in intel_backlight_set_pwm_level()
113 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in intel_backlight_level_to_pwm()
114 struct intel_panel *panel = &connector->panel; in intel_backlight_level_to_pwm()
116 drm_WARN_ON_ONCE(&dev_priv->drm, in intel_backlight_level_to_pwm()
117 panel->backlight.max == 0 || panel->backlight.pwm_level_max == 0); in intel_backlight_level_to_pwm()
119 val = scale(val, panel->backlight.min, panel->backlight.max, in intel_backlight_level_to_pwm()
120 panel->backlight.pwm_level_min, panel->backlight.pwm_level_max); in intel_backlight_level_to_pwm()
127 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in intel_backlight_level_from_pwm()
128 struct intel_panel *panel = &connector->panel; in intel_backlight_level_from_pwm()
130 drm_WARN_ON_ONCE(&dev_priv->drm, in intel_backlight_level_from_pwm()
131 panel->backlight.max == 0 || panel->backlight.pwm_level_max == 0); in intel_backlight_level_from_pwm()
133 if (dev_priv->params.invert_brightness > 0 || in intel_backlight_level_from_pwm()
134 … (dev_priv->params.invert_brightness == 0 && intel_has_quirk(dev_priv, QUIRK_INVERT_BRIGHTNESS))) in intel_backlight_level_from_pwm()
135 val = panel->backlight.pwm_level_max - (val - panel->backlight.pwm_level_min); in intel_backlight_level_from_pwm()
137 return scale(val, panel->backlight.pwm_level_min, panel->backlight.pwm_level_max, in intel_backlight_level_from_pwm()
138 panel->backlight.min, panel->backlight.max); in intel_backlight_level_from_pwm()
143 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in lpt_get_backlight()
150 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in pch_get_backlight()
157 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in i9xx_get_backlight()
158 struct intel_panel *panel = &connector->panel; in i9xx_get_backlight()
165 if (panel->backlight.combination_mode) { in i9xx_get_backlight()
168 pci_read_config_byte(to_pci_dev(dev_priv->drm.dev), LBPC, &lbpc); in i9xx_get_backlight()
177 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in vlv_get_backlight()
179 if (drm_WARN_ON(&dev_priv->drm, pipe != PIPE_A && pipe != PIPE_B)) in vlv_get_backlight()
187 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in bxt_get_backlight()
188 struct intel_panel *panel = &connector->panel; in bxt_get_backlight()
191 BXT_BLC_PWM_DUTY(panel->backlight.controller)); in bxt_get_backlight()
196 struct intel_panel *panel = &connector->panel; in ext_pwm_get_backlight()
199 pwm_get_state(panel->backlight.pwm, &state); in ext_pwm_get_backlight()
205 struct intel_connector *connector = to_intel_connector(conn_state->connector); in lpt_set_backlight()
206 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in lpt_set_backlight()
214 struct intel_connector *connector = to_intel_connector(conn_state->connector); in pch_set_backlight()
215 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in pch_set_backlight()
224 struct intel_connector *connector = to_intel_connector(conn_state->connector); in i9xx_set_backlight()
225 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in i9xx_set_backlight()
226 struct intel_panel *panel = &connector->panel; in i9xx_set_backlight()
229 drm_WARN_ON(&dev_priv->drm, panel->backlight.pwm_level_max == 0); in i9xx_set_backlight()
231 if (panel->backlight.combination_mode) { in i9xx_set_backlight()
234 lbpc = level * 0xfe / panel->backlight.pwm_level_max + 1; in i9xx_set_backlight()
236 pci_write_config_byte(to_pci_dev(dev_priv->drm.dev), LBPC, lbpc); in i9xx_set_backlight()
252 struct intel_connector *connector = to_intel_connector(conn_state->connector); in vlv_set_backlight()
253 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in vlv_set_backlight()
254 enum pipe pipe = to_intel_crtc(conn_state->crtc)->pipe; in vlv_set_backlight()
263 struct intel_connector *connector = to_intel_connector(conn_state->connector); in bxt_set_backlight()
264 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in bxt_set_backlight()
265 struct intel_panel *panel = &connector->panel; in bxt_set_backlight()
268 BXT_BLC_PWM_DUTY(panel->backlight.controller), level); in bxt_set_backlight()
273 struct intel_panel *panel = &to_intel_connector(conn_state->connector)->panel; in ext_pwm_set_backlight()
275 pwm_set_relative_duty_cycle(&panel->backlight.pwm_state, level, 100); in ext_pwm_set_backlight()
276 pwm_apply_state(panel->backlight.pwm, &panel->backlight.pwm_state); in ext_pwm_set_backlight()
282 struct intel_connector *connector = to_intel_connector(conn_state->connector); in intel_panel_actually_set_backlight()
283 struct drm_i915_private *i915 = to_i915(connector->base.dev); in intel_panel_actually_set_backlight()
284 struct intel_panel *panel = &connector->panel; in intel_panel_actually_set_backlight()
286 drm_dbg_kms(&i915->drm, "set backlight level = %d\n", level); in intel_panel_actually_set_backlight()
288 panel->backlight.funcs->set(conn_state, level); in intel_panel_actually_set_backlight()
291 /* set backlight brightness to level in range [0..max], assuming hw min is
297 struct intel_connector *connector = to_intel_connector(conn_state->connector); in intel_backlight_set_acpi()
298 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in intel_backlight_set_acpi()
299 struct intel_panel *panel = &connector->panel; in intel_backlight_set_acpi()
304 * connection_mutex isn't held across the entire backlight in intel_backlight_set_acpi()
308 if (!panel->backlight.present || !conn_state->crtc) in intel_backlight_set_acpi()
311 mutex_lock(&dev_priv->display.backlight.lock); in intel_backlight_set_acpi()
313 drm_WARN_ON(&dev_priv->drm, panel->backlight.max == 0); in intel_backlight_set_acpi()
316 panel->backlight.level = hw_level; in intel_backlight_set_acpi()
318 if (panel->backlight.device) in intel_backlight_set_acpi()
319 panel->backlight.device->props.brightness = in intel_backlight_set_acpi()
321 panel->backlight.level, in intel_backlight_set_acpi()
322 panel->backlight.device->props.max_brightness); in intel_backlight_set_acpi()
324 if (panel->backlight.enabled) in intel_backlight_set_acpi()
327 mutex_unlock(&dev_priv->display.backlight.lock); in intel_backlight_set_acpi()
332 struct intel_connector *connector = to_intel_connector(old_conn_state->connector); in lpt_disable_backlight()
333 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in lpt_disable_backlight()
339 * Although we don't support or enable CPU PWM with LPT/SPT based in lpt_disable_backlight()
343 * This needs rework if we need to add support for CPU PWM on PCH split in lpt_disable_backlight()
348 drm_dbg_kms(&dev_priv->drm, in lpt_disable_backlight()
349 "cpu backlight was enabled, disabling\n"); in lpt_disable_backlight()
360 struct intel_connector *connector = to_intel_connector(old_conn_state->connector); in pch_disable_backlight()
361 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in pch_disable_backlight()
380 struct drm_i915_private *dev_priv = to_i915(old_conn_state->connector->dev); in i965_disable_backlight()
391 struct intel_connector *connector = to_intel_connector(old_conn_state->connector); in vlv_disable_backlight()
392 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in vlv_disable_backlight()
393 enum pipe pipe = to_intel_crtc(old_conn_state->crtc)->pipe; in vlv_disable_backlight()
405 struct intel_connector *connector = to_intel_connector(old_conn_state->connector); in bxt_disable_backlight()
406 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in bxt_disable_backlight()
407 struct intel_panel *panel = &connector->panel; in bxt_disable_backlight()
413 BXT_BLC_PWM_CTL(panel->backlight.controller)); in bxt_disable_backlight()
414 intel_de_write(dev_priv, BXT_BLC_PWM_CTL(panel->backlight.controller), in bxt_disable_backlight()
417 if (panel->backlight.controller == 1) { in bxt_disable_backlight()
426 struct intel_connector *connector = to_intel_connector(old_conn_state->connector); in cnp_disable_backlight()
427 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in cnp_disable_backlight()
428 struct intel_panel *panel = &connector->panel; in cnp_disable_backlight()
434 BXT_BLC_PWM_CTL(panel->backlight.controller)); in cnp_disable_backlight()
435 intel_de_write(dev_priv, BXT_BLC_PWM_CTL(panel->backlight.controller), in cnp_disable_backlight()
441 struct intel_connector *connector = to_intel_connector(old_conn_state->connector); in ext_pwm_disable_backlight()
442 struct intel_panel *panel = &connector->panel; in ext_pwm_disable_backlight()
446 panel->backlight.pwm_state.enabled = false; in ext_pwm_disable_backlight()
447 pwm_apply_state(panel->backlight.pwm, &panel->backlight.pwm_state); in ext_pwm_disable_backlight()
452 struct intel_connector *connector = to_intel_connector(old_conn_state->connector); in intel_backlight_disable()
453 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in intel_backlight_disable()
454 struct intel_panel *panel = &connector->panel; in intel_backlight_disable()
456 if (!panel->backlight.present) in intel_backlight_disable()
460 * Do not disable backlight on the vga_switcheroo path. When switching in intel_backlight_disable()
462 * backlight. This will leave the backlight on unnecessarily when in intel_backlight_disable()
465 if (dev_priv->drm.switch_power_state == DRM_SWITCH_POWER_CHANGING) { in intel_backlight_disable()
466 drm_dbg_kms(&dev_priv->drm, in intel_backlight_disable()
467 "Skipping backlight disable on vga switch\n"); in intel_backlight_disable()
471 mutex_lock(&dev_priv->display.backlight.lock); in intel_backlight_disable()
473 if (panel->backlight.device) in intel_backlight_disable()
474 panel->backlight.device->props.power = FB_BLANK_POWERDOWN; in intel_backlight_disable()
475 panel->backlight.enabled = false; in intel_backlight_disable()
476 panel->backlight.funcs->disable(old_conn_state, 0); in intel_backlight_disable()
478 mutex_unlock(&dev_priv->display.backlight.lock); in intel_backlight_disable()
484 struct intel_connector *connector = to_intel_connector(conn_state->connector); in lpt_enable_backlight()
485 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in lpt_enable_backlight()
486 struct intel_panel *panel = &connector->panel; in lpt_enable_backlight()
491 drm_dbg_kms(&dev_priv->drm, "pch backlight already enabled\n"); in lpt_enable_backlight()
498 if (panel->backlight.alternate_pwm_increment) in lpt_enable_backlight()
505 if (panel->backlight.alternate_pwm_increment) in lpt_enable_backlight()
512 pch_ctl2 = panel->backlight.pwm_level_max << 16; in lpt_enable_backlight()
516 if (panel->backlight.active_low_pwm) in lpt_enable_backlight()
535 struct intel_connector *connector = to_intel_connector(conn_state->connector); in pch_enable_backlight()
536 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in pch_enable_backlight()
537 struct intel_panel *panel = &connector->panel; in pch_enable_backlight()
538 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; in pch_enable_backlight()
543 drm_dbg_kms(&dev_priv->drm, "cpu backlight already enabled\n"); in pch_enable_backlight()
550 drm_dbg_kms(&dev_priv->drm, "pch backlight already enabled\n"); in pch_enable_backlight()
566 pch_ctl2 = panel->backlight.pwm_level_max << 16; in pch_enable_backlight()
570 if (panel->backlight.active_low_pwm) in pch_enable_backlight()
582 struct intel_connector *connector = to_intel_connector(conn_state->connector); in i9xx_enable_backlight()
583 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in i9xx_enable_backlight()
584 struct intel_panel *panel = &connector->panel; in i9xx_enable_backlight()
589 drm_dbg_kms(&dev_priv->drm, "backlight already enabled\n"); in i9xx_enable_backlight()
593 freq = panel->backlight.pwm_level_max; in i9xx_enable_backlight()
594 if (panel->backlight.combination_mode) in i9xx_enable_backlight()
598 if (panel->backlight.combination_mode) in i9xx_enable_backlight()
600 if (IS_PINEVIEW(dev_priv) && panel->backlight.active_low_pwm) in i9xx_enable_backlight()
610 * Needed to enable backlight on some 855gm models. BLC_HIST_CTL is in i9xx_enable_backlight()
612 * that has backlight. in i9xx_enable_backlight()
621 struct intel_connector *connector = to_intel_connector(conn_state->connector); in i965_enable_backlight()
622 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in i965_enable_backlight()
623 struct intel_panel *panel = &connector->panel; in i965_enable_backlight()
624 enum pipe pipe = to_intel_crtc(conn_state->crtc)->pipe; in i965_enable_backlight()
629 drm_dbg_kms(&dev_priv->drm, "backlight already enabled\n"); in i965_enable_backlight()
634 freq = panel->backlight.pwm_level_max; in i965_enable_backlight()
635 if (panel->backlight.combination_mode) in i965_enable_backlight()
642 if (panel->backlight.combination_mode) in i965_enable_backlight()
644 if (panel->backlight.active_low_pwm) in i965_enable_backlight()
656 struct intel_connector *connector = to_intel_connector(conn_state->connector); in vlv_enable_backlight()
657 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in vlv_enable_backlight()
658 struct intel_panel *panel = &connector->panel; in vlv_enable_backlight()
659 enum pipe pipe = to_intel_crtc(crtc_state->uapi.crtc)->pipe; in vlv_enable_backlight()
664 drm_dbg_kms(&dev_priv->drm, "backlight already enabled\n"); in vlv_enable_backlight()
669 ctl = panel->backlight.pwm_level_max << 16; in vlv_enable_backlight()
676 if (panel->backlight.active_low_pwm) in vlv_enable_backlight()
687 struct intel_connector *connector = to_intel_connector(conn_state->connector); in bxt_enable_backlight()
688 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in bxt_enable_backlight()
689 struct intel_panel *panel = &connector->panel; in bxt_enable_backlight()
690 enum pipe pipe = to_intel_crtc(crtc_state->uapi.crtc)->pipe; in bxt_enable_backlight()
694 if (panel->backlight.controller == 1) { in bxt_enable_backlight()
697 drm_dbg_kms(&dev_priv->drm, in bxt_enable_backlight()
704 if (panel->backlight.util_pin_active_low) in bxt_enable_backlight()
711 BXT_BLC_PWM_CTL(panel->backlight.controller)); in bxt_enable_backlight()
713 drm_dbg_kms(&dev_priv->drm, "backlight already enabled\n"); in bxt_enable_backlight()
716 BXT_BLC_PWM_CTL(panel->backlight.controller), in bxt_enable_backlight()
721 BXT_BLC_PWM_FREQ(panel->backlight.controller), in bxt_enable_backlight()
722 panel->backlight.pwm_level_max); in bxt_enable_backlight()
727 if (panel->backlight.active_low_pwm) in bxt_enable_backlight()
730 intel_de_write(dev_priv, BXT_BLC_PWM_CTL(panel->backlight.controller), in bxt_enable_backlight()
733 BXT_BLC_PWM_CTL(panel->backlight.controller)); in bxt_enable_backlight()
734 intel_de_write(dev_priv, BXT_BLC_PWM_CTL(panel->backlight.controller), in bxt_enable_backlight()
741 struct intel_connector *connector = to_intel_connector(conn_state->connector); in cnp_enable_backlight()
742 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in cnp_enable_backlight()
743 struct intel_panel *panel = &connector->panel; in cnp_enable_backlight()
747 BXT_BLC_PWM_CTL(panel->backlight.controller)); in cnp_enable_backlight()
749 drm_dbg_kms(&dev_priv->drm, "backlight already enabled\n"); in cnp_enable_backlight()
752 BXT_BLC_PWM_CTL(panel->backlight.controller), in cnp_enable_backlight()
757 BXT_BLC_PWM_FREQ(panel->backlight.controller), in cnp_enable_backlight()
758 panel->backlight.pwm_level_max); in cnp_enable_backlight()
763 if (panel->backlight.active_low_pwm) in cnp_enable_backlight()
766 intel_de_write(dev_priv, BXT_BLC_PWM_CTL(panel->backlight.controller), in cnp_enable_backlight()
769 BXT_BLC_PWM_CTL(panel->backlight.controller)); in cnp_enable_backlight()
770 intel_de_write(dev_priv, BXT_BLC_PWM_CTL(panel->backlight.controller), in cnp_enable_backlight()
777 struct intel_connector *connector = to_intel_connector(conn_state->connector); in ext_pwm_enable_backlight()
778 struct intel_panel *panel = &connector->panel; in ext_pwm_enable_backlight()
780 pwm_set_relative_duty_cycle(&panel->backlight.pwm_state, level, 100); in ext_pwm_enable_backlight()
781 panel->backlight.pwm_state.enabled = true; in ext_pwm_enable_backlight()
782 pwm_apply_state(panel->backlight.pwm, &panel->backlight.pwm_state); in ext_pwm_enable_backlight()
788 struct intel_connector *connector = to_intel_connector(conn_state->connector); in __intel_backlight_enable()
789 struct intel_panel *panel = &connector->panel; in __intel_backlight_enable()
791 WARN_ON(panel->backlight.max == 0); in __intel_backlight_enable()
793 if (panel->backlight.level <= panel->backlight.min) { in __intel_backlight_enable()
794 panel->backlight.level = panel->backlight.max; in __intel_backlight_enable()
795 if (panel->backlight.device) in __intel_backlight_enable()
796 panel->backlight.device->props.brightness = in __intel_backlight_enable()
798 panel->backlight.level, in __intel_backlight_enable()
799 panel->backlight.device->props.max_brightness); in __intel_backlight_enable()
802 panel->backlight.funcs->enable(crtc_state, conn_state, panel->backlight.level); in __intel_backlight_enable()
803 panel->backlight.enabled = true; in __intel_backlight_enable()
804 if (panel->backlight.device) in __intel_backlight_enable()
805 panel->backlight.device->props.power = FB_BLANK_UNBLANK; in __intel_backlight_enable()
811 struct intel_connector *connector = to_intel_connector(conn_state->connector); in intel_backlight_enable()
812 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in intel_backlight_enable()
813 struct intel_panel *panel = &connector->panel; in intel_backlight_enable()
814 enum pipe pipe = to_intel_crtc(crtc_state->uapi.crtc)->pipe; in intel_backlight_enable()
816 if (!panel->backlight.present) in intel_backlight_enable()
819 drm_dbg_kms(&dev_priv->drm, "pipe %c\n", pipe_name(pipe)); in intel_backlight_enable()
821 mutex_lock(&dev_priv->display.backlight.lock); in intel_backlight_enable()
825 mutex_unlock(&dev_priv->display.backlight.lock); in intel_backlight_enable()
831 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in intel_panel_get_backlight()
832 struct intel_panel *panel = &connector->panel; in intel_panel_get_backlight()
835 mutex_lock(&dev_priv->display.backlight.lock); in intel_panel_get_backlight()
837 if (panel->backlight.enabled) in intel_panel_get_backlight()
838 val = panel->backlight.funcs->get(connector, intel_connector_get_pipe(connector)); in intel_panel_get_backlight()
840 mutex_unlock(&dev_priv->display.backlight.lock); in intel_panel_get_backlight()
842 drm_dbg_kms(&dev_priv->drm, "get backlight PWM = %d\n", val); in intel_panel_get_backlight()
850 struct intel_panel *panel = &connector->panel; in scale_user_to_hw()
853 panel->backlight.min, panel->backlight.max); in scale_user_to_hw()
856 /* set backlight brightness to level in range [0..max], scaling wrt hw min */
860 struct intel_connector *connector = to_intel_connector(conn_state->connector); in intel_panel_set_backlight()
861 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in intel_panel_set_backlight()
862 struct intel_panel *panel = &connector->panel; in intel_panel_set_backlight()
865 if (!panel->backlight.present) in intel_panel_set_backlight()
868 mutex_lock(&dev_priv->display.backlight.lock); in intel_panel_set_backlight()
870 drm_WARN_ON(&dev_priv->drm, panel->backlight.max == 0); in intel_panel_set_backlight()
873 panel->backlight.level = hw_level; in intel_panel_set_backlight()
875 if (panel->backlight.enabled) in intel_panel_set_backlight()
878 mutex_unlock(&dev_priv->display.backlight.lock); in intel_panel_set_backlight()
884 struct intel_panel *panel = &connector->panel; in intel_backlight_device_update_status()
885 struct drm_device *dev = connector->base.dev; in intel_backlight_device_update_status()
887 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); in intel_backlight_device_update_status()
889 bd->props.brightness, bd->props.max_brightness); in intel_backlight_device_update_status()
890 intel_panel_set_backlight(connector->base.state, bd->props.brightness, in intel_backlight_device_update_status()
891 bd->props.max_brightness); in intel_backlight_device_update_status()
894 * Allow flipping bl_power as a sub-state of enabled. Sadly the in intel_backlight_device_update_status()
895 * backlight class device does not make it easy to differentiate in intel_backlight_device_update_status()
899 if (panel->backlight.enabled) { in intel_backlight_device_update_status()
900 if (panel->backlight.power) { in intel_backlight_device_update_status()
901 bool enable = bd->props.power == FB_BLANK_UNBLANK && in intel_backlight_device_update_status()
902 bd->props.brightness != 0; in intel_backlight_device_update_status()
903 panel->backlight.power(connector, enable); in intel_backlight_device_update_status()
906 bd->props.power = FB_BLANK_POWERDOWN; in intel_backlight_device_update_status()
909 drm_modeset_unlock(&dev->mode_config.connection_mutex); in intel_backlight_device_update_status()
916 struct drm_device *dev = connector->base.dev; in intel_backlight_device_get_brightness()
921 with_intel_runtime_pm(&dev_priv->runtime_pm, wakeref) { in intel_backlight_device_get_brightness()
924 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); in intel_backlight_device_get_brightness()
928 hw_level, bd->props.max_brightness); in intel_backlight_device_get_brightness()
930 drm_modeset_unlock(&dev->mode_config.connection_mutex); in intel_backlight_device_get_brightness()
943 struct drm_i915_private *i915 = to_i915(connector->base.dev); in intel_backlight_device_register()
944 struct intel_panel *panel = &connector->panel; in intel_backlight_device_register()
950 if (WARN_ON(panel->backlight.device)) in intel_backlight_device_register()
951 return -ENODEV; in intel_backlight_device_register()
953 if (!panel->backlight.present) in intel_backlight_device_register()
956 WARN_ON(panel->backlight.max == 0); in intel_backlight_device_register()
959 drm_info(&i915->drm, "Skipping intel_backlight registration\n"); in intel_backlight_device_register()
967 * Note: Everything should work even if the backlight device max in intel_backlight_device_register()
970 props.max_brightness = panel->backlight.max; in intel_backlight_device_register()
972 panel->backlight.level, in intel_backlight_device_register()
975 if (panel->backlight.enabled) in intel_backlight_device_register()
982 return -ENOMEM; in intel_backlight_device_register()
986 put_device(&bd->dev); in intel_backlight_device_register()
989 * prevents registration of multiple backlight devices in the in intel_backlight_device_register()
991 * compatibility. Use unique names for subsequent backlight devices as a in intel_backlight_device_register()
995 name = kasprintf(GFP_KERNEL, "card%d-%s-backlight", in intel_backlight_device_register()
996 i915->drm.primary->index, connector->base.name); in intel_backlight_device_register()
998 return -ENOMEM; in intel_backlight_device_register()
1000 bd = backlight_device_register(name, connector->base.kdev, connector, in intel_backlight_device_register()
1004 drm_err(&i915->drm, in intel_backlight_device_register()
1005 "[CONNECTOR:%d:%s] backlight device %s register failed: %ld\n", in intel_backlight_device_register()
1006 connector->base.base.id, connector->base.name, name, PTR_ERR(bd)); in intel_backlight_device_register()
1011 panel->backlight.device = bd; in intel_backlight_device_register()
1013 drm_dbg_kms(&i915->drm, in intel_backlight_device_register()
1014 "[CONNECTOR:%d:%s] backlight device %s registered\n", in intel_backlight_device_register()
1015 connector->base.base.id, connector->base.name, name); in intel_backlight_device_register()
1025 struct intel_panel *panel = &connector->panel; in intel_backlight_device_unregister()
1027 if (panel->backlight.device) { in intel_backlight_device_unregister()
1028 backlight_device_unregister(panel->backlight.device); in intel_backlight_device_unregister()
1029 panel->backlight.device = NULL; in intel_backlight_device_unregister()
1035 * CNP: PWM clock frequency is 19.2 MHz or 24 MHz.
1036 * PWM increment = 1
1040 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in cnp_hz_to_pwm()
1042 return DIV_ROUND_CLOSEST(KHz(RUNTIME_INFO(dev_priv)->rawclk_freq), in cnp_hz_to_pwm()
1047 * BXT: PWM clock frequency = 19.2 MHz.
1055 * SPT: This value represents the period of the PWM stream in clock periods
1057 * SCHICKEN_1 bit 0). PWM clock is 24 MHz.
1061 struct intel_panel *panel = &connector->panel; in spt_hz_to_pwm()
1064 if (panel->backlight.alternate_pwm_increment) in spt_hz_to_pwm()
1073 * LPT: This value represents the period of the PWM stream in clock periods
1079 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in lpt_hz_to_pwm()
1080 struct intel_panel *panel = &connector->panel; in lpt_hz_to_pwm()
1083 if (panel->backlight.alternate_pwm_increment) in lpt_hz_to_pwm()
1097 * ILK/SNB/IVB: This value represents the period of the PWM stream in PCH
1102 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in pch_hz_to_pwm()
1104 return DIV_ROUND_CLOSEST(KHz(RUNTIME_INFO(dev_priv)->rawclk_freq), in pch_hz_to_pwm()
1110 * clock frequency/32) in total for a complete cycle of modulated backlight
1118 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in i9xx_hz_to_pwm()
1122 clock = KHz(RUNTIME_INFO(dev_priv)->rawclk_freq); in i9xx_hz_to_pwm()
1124 clock = KHz(dev_priv->display.cdclk.hw.cdclk); in i9xx_hz_to_pwm()
1130 * Gen4: This value represents the period of the PWM stream in display core
1136 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in i965_hz_to_pwm()
1140 clock = KHz(RUNTIME_INFO(dev_priv)->rawclk_freq); in i965_hz_to_pwm()
1142 clock = KHz(dev_priv->display.cdclk.hw.cdclk); in i965_hz_to_pwm()
1148 * VLV: This value represents the period of the PWM stream in display core
1154 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in vlv_hz_to_pwm()
1164 clock = KHz(RUNTIME_INFO(dev_priv)->rawclk_freq); in vlv_hz_to_pwm()
1173 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in get_vbt_pwm_freq()
1174 u16 pwm_freq_hz = connector->panel.vbt.backlight.pwm_freq_hz; in get_vbt_pwm_freq()
1177 drm_dbg_kms(&dev_priv->drm, in get_vbt_pwm_freq()
1178 "VBT defined backlight frequency %u Hz\n", in get_vbt_pwm_freq()
1182 drm_dbg_kms(&dev_priv->drm, in get_vbt_pwm_freq()
1183 "default backlight frequency %u Hz\n", in get_vbt_pwm_freq()
1192 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in get_backlight_max_vbt()
1193 struct intel_panel *panel = &connector->panel; in get_backlight_max_vbt()
1195 u32 pwm; in get_backlight_max_vbt() local
1197 if (!panel->backlight.pwm_funcs->hz_to_pwm) { in get_backlight_max_vbt()
1198 drm_dbg_kms(&dev_priv->drm, in get_backlight_max_vbt()
1199 "backlight frequency conversion not supported\n"); in get_backlight_max_vbt()
1203 pwm = panel->backlight.pwm_funcs->hz_to_pwm(connector, pwm_freq_hz); in get_backlight_max_vbt()
1204 if (!pwm) { in get_backlight_max_vbt()
1205 drm_dbg_kms(&dev_priv->drm, in get_backlight_max_vbt()
1206 "backlight frequency conversion failed\n"); in get_backlight_max_vbt()
1210 return pwm; in get_backlight_max_vbt()
1218 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in get_backlight_min_vbt()
1219 struct intel_panel *panel = &connector->panel; in get_backlight_min_vbt()
1222 drm_WARN_ON(&dev_priv->drm, panel->backlight.pwm_level_max == 0); in get_backlight_min_vbt()
1231 min = clamp_t(int, connector->panel.vbt.backlight.min_brightness, 0, 64); in get_backlight_min_vbt()
1232 if (min != connector->panel.vbt.backlight.min_brightness) { in get_backlight_min_vbt()
1233 drm_dbg_kms(&dev_priv->drm, in get_backlight_min_vbt()
1234 "clamping VBT min backlight %d/255 to %d/255\n", in get_backlight_min_vbt()
1235 connector->panel.vbt.backlight.min_brightness, min); in get_backlight_min_vbt()
1239 return scale(min, 0, 255, 0, panel->backlight.pwm_level_max); in get_backlight_min_vbt()
1244 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in lpt_setup_backlight()
1245 struct intel_panel *panel = &connector->panel; in lpt_setup_backlight()
1253 panel->backlight.alternate_pwm_increment = alt; in lpt_setup_backlight()
1256 panel->backlight.active_low_pwm = pch_ctl1 & BLM_PCH_POLARITY; in lpt_setup_backlight()
1259 panel->backlight.pwm_level_max = pch_ctl2 >> 16; in lpt_setup_backlight()
1263 if (!panel->backlight.pwm_level_max) in lpt_setup_backlight()
1264 panel->backlight.pwm_level_max = get_backlight_max_vbt(connector); in lpt_setup_backlight()
1266 if (!panel->backlight.pwm_level_max) in lpt_setup_backlight()
1267 return -ENODEV; in lpt_setup_backlight()
1269 panel->backlight.pwm_level_min = get_backlight_min_vbt(connector); in lpt_setup_backlight()
1271 panel->backlight.pwm_enabled = pch_ctl1 & BLM_PCH_PWM_ENABLE; in lpt_setup_backlight()
1273 cpu_mode = panel->backlight.pwm_enabled && HAS_PCH_LPT(dev_priv) && in lpt_setup_backlight()
1280 drm_dbg_kms(&dev_priv->drm, in lpt_setup_backlight()
1281 "CPU backlight register was enabled, switching to PCH override\n"); in lpt_setup_backlight()
1283 /* Write converted CPU PWM value to PCH override register */ in lpt_setup_backlight()
1284 lpt_set_backlight(connector->base.state, val); in lpt_setup_backlight()
1297 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in pch_setup_backlight()
1298 struct intel_panel *panel = &connector->panel; in pch_setup_backlight()
1302 panel->backlight.active_low_pwm = pch_ctl1 & BLM_PCH_POLARITY; in pch_setup_backlight()
1305 panel->backlight.pwm_level_max = pch_ctl2 >> 16; in pch_setup_backlight()
1307 if (!panel->backlight.pwm_level_max) in pch_setup_backlight()
1308 panel->backlight.pwm_level_max = get_backlight_max_vbt(connector); in pch_setup_backlight()
1310 if (!panel->backlight.pwm_level_max) in pch_setup_backlight()
1311 return -ENODEV; in pch_setup_backlight()
1313 panel->backlight.pwm_level_min = get_backlight_min_vbt(connector); in pch_setup_backlight()
1316 panel->backlight.pwm_enabled = (cpu_ctl2 & BLM_PWM_ENABLE) && in pch_setup_backlight()
1324 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in i9xx_setup_backlight()
1325 struct intel_panel *panel = &connector->panel; in i9xx_setup_backlight()
1331 panel->backlight.combination_mode = ctl & BLM_LEGACY_MODE; in i9xx_setup_backlight()
1334 panel->backlight.active_low_pwm = ctl & BLM_POLARITY_PNV; in i9xx_setup_backlight()
1336 panel->backlight.pwm_level_max = ctl >> 17; in i9xx_setup_backlight()
1338 if (!panel->backlight.pwm_level_max) { in i9xx_setup_backlight()
1339 panel->backlight.pwm_level_max = get_backlight_max_vbt(connector); in i9xx_setup_backlight()
1340 panel->backlight.pwm_level_max >>= 1; in i9xx_setup_backlight()
1343 if (!panel->backlight.pwm_level_max) in i9xx_setup_backlight()
1344 return -ENODEV; in i9xx_setup_backlight()
1346 if (panel->backlight.combination_mode) in i9xx_setup_backlight()
1347 panel->backlight.pwm_level_max *= 0xff; in i9xx_setup_backlight()
1349 panel->backlight.pwm_level_min = get_backlight_min_vbt(connector); in i9xx_setup_backlight()
1353 val = clamp(val, panel->backlight.pwm_level_min, panel->backlight.pwm_level_max); in i9xx_setup_backlight()
1355 panel->backlight.pwm_enabled = val != 0; in i9xx_setup_backlight()
1362 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in i965_setup_backlight()
1363 struct intel_panel *panel = &connector->panel; in i965_setup_backlight()
1367 panel->backlight.combination_mode = ctl2 & BLM_COMBINATION_MODE; in i965_setup_backlight()
1368 panel->backlight.active_low_pwm = ctl2 & BLM_POLARITY_I965; in i965_setup_backlight()
1371 panel->backlight.pwm_level_max = ctl >> 16; in i965_setup_backlight()
1373 if (!panel->backlight.pwm_level_max) in i965_setup_backlight()
1374 panel->backlight.pwm_level_max = get_backlight_max_vbt(connector); in i965_setup_backlight()
1376 if (!panel->backlight.pwm_level_max) in i965_setup_backlight()
1377 return -ENODEV; in i965_setup_backlight()
1379 if (panel->backlight.combination_mode) in i965_setup_backlight()
1380 panel->backlight.pwm_level_max *= 0xff; in i965_setup_backlight()
1382 panel->backlight.pwm_level_min = get_backlight_min_vbt(connector); in i965_setup_backlight()
1384 panel->backlight.pwm_enabled = ctl2 & BLM_PWM_ENABLE; in i965_setup_backlight()
1391 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in vlv_setup_backlight()
1392 struct intel_panel *panel = &connector->panel; in vlv_setup_backlight()
1395 if (drm_WARN_ON(&dev_priv->drm, pipe != PIPE_A && pipe != PIPE_B)) in vlv_setup_backlight()
1396 return -ENODEV; in vlv_setup_backlight()
1399 panel->backlight.active_low_pwm = ctl2 & BLM_POLARITY_I965; in vlv_setup_backlight()
1402 panel->backlight.pwm_level_max = ctl >> 16; in vlv_setup_backlight()
1404 if (!panel->backlight.pwm_level_max) in vlv_setup_backlight()
1405 panel->backlight.pwm_level_max = get_backlight_max_vbt(connector); in vlv_setup_backlight()
1407 if (!panel->backlight.pwm_level_max) in vlv_setup_backlight()
1408 return -ENODEV; in vlv_setup_backlight()
1410 panel->backlight.pwm_level_min = get_backlight_min_vbt(connector); in vlv_setup_backlight()
1412 panel->backlight.pwm_enabled = ctl2 & BLM_PWM_ENABLE; in vlv_setup_backlight()
1420 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in bxt_setup_backlight()
1421 struct intel_panel *panel = &connector->panel; in bxt_setup_backlight()
1424 panel->backlight.controller = connector->panel.vbt.backlight.controller; in bxt_setup_backlight()
1427 BXT_BLC_PWM_CTL(panel->backlight.controller)); in bxt_setup_backlight()
1430 if (panel->backlight.controller == 1) { in bxt_setup_backlight()
1432 panel->backlight.util_pin_active_low = in bxt_setup_backlight()
1436 panel->backlight.active_low_pwm = pwm_ctl & BXT_BLC_PWM_POLARITY; in bxt_setup_backlight()
1437 panel->backlight.pwm_level_max = in bxt_setup_backlight()
1438 intel_de_read(dev_priv, BXT_BLC_PWM_FREQ(panel->backlight.controller)); in bxt_setup_backlight()
1440 if (!panel->backlight.pwm_level_max) in bxt_setup_backlight()
1441 panel->backlight.pwm_level_max = get_backlight_max_vbt(connector); in bxt_setup_backlight()
1443 if (!panel->backlight.pwm_level_max) in bxt_setup_backlight()
1444 return -ENODEV; in bxt_setup_backlight()
1446 panel->backlight.pwm_level_min = get_backlight_min_vbt(connector); in bxt_setup_backlight()
1448 panel->backlight.pwm_enabled = pwm_ctl & BXT_BLC_PWM_ENABLE; in bxt_setup_backlight()
1456 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in cnp_setup_backlight()
1457 struct intel_panel *panel = &connector->panel; in cnp_setup_backlight()
1461 * CNP has the BXT implementation of backlight, but with only one in cnp_setup_backlight()
1465 panel->backlight.controller = 0; in cnp_setup_backlight()
1468 BXT_BLC_PWM_CTL(panel->backlight.controller)); in cnp_setup_backlight()
1470 panel->backlight.active_low_pwm = pwm_ctl & BXT_BLC_PWM_POLARITY; in cnp_setup_backlight()
1471 panel->backlight.pwm_level_max = in cnp_setup_backlight()
1472 intel_de_read(dev_priv, BXT_BLC_PWM_FREQ(panel->backlight.controller)); in cnp_setup_backlight()
1474 if (!panel->backlight.pwm_level_max) in cnp_setup_backlight()
1475 panel->backlight.pwm_level_max = get_backlight_max_vbt(connector); in cnp_setup_backlight()
1477 if (!panel->backlight.pwm_level_max) in cnp_setup_backlight()
1478 return -ENODEV; in cnp_setup_backlight()
1480 panel->backlight.pwm_level_min = get_backlight_min_vbt(connector); in cnp_setup_backlight()
1482 panel->backlight.pwm_enabled = pwm_ctl & BXT_BLC_PWM_ENABLE; in cnp_setup_backlight()
1490 struct drm_device *dev = connector->base.dev; in ext_pwm_setup_backlight()
1492 struct intel_panel *panel = &connector->panel; in ext_pwm_setup_backlight()
1496 /* Get the right PWM chip for DSI backlight according to VBT */ in ext_pwm_setup_backlight()
1497 if (connector->panel.vbt.dsi.config->pwm_blc == PPS_BLC_PMIC) { in ext_pwm_setup_backlight()
1498 panel->backlight.pwm = pwm_get(dev->dev, "pwm_pmic_backlight"); in ext_pwm_setup_backlight()
1501 panel->backlight.pwm = pwm_get(dev->dev, "pwm_soc_backlight"); in ext_pwm_setup_backlight()
1505 if (IS_ERR(panel->backlight.pwm)) { in ext_pwm_setup_backlight()
1506 drm_err(&dev_priv->drm, "Failed to get the %s PWM chip\n", in ext_pwm_setup_backlight()
1508 panel->backlight.pwm = NULL; in ext_pwm_setup_backlight()
1509 return -ENODEV; in ext_pwm_setup_backlight()
1512 panel->backlight.pwm_level_max = 100; /* 100% */ in ext_pwm_setup_backlight()
1513 panel->backlight.pwm_level_min = get_backlight_min_vbt(connector); in ext_pwm_setup_backlight()
1515 if (pwm_is_enabled(panel->backlight.pwm)) { in ext_pwm_setup_backlight()
1516 /* PWM is already enabled, use existing settings */ in ext_pwm_setup_backlight()
1517 pwm_get_state(panel->backlight.pwm, &panel->backlight.pwm_state); in ext_pwm_setup_backlight()
1519 level = pwm_get_relative_duty_cycle(&panel->backlight.pwm_state, in ext_pwm_setup_backlight()
1522 panel->backlight.pwm_enabled = true; in ext_pwm_setup_backlight()
1524 drm_dbg_kms(&dev_priv->drm, "PWM already enabled at freq %ld, VBT freq %d, level %d\n", in ext_pwm_setup_backlight()
1525 NSEC_PER_SEC / (unsigned long)panel->backlight.pwm_state.period, in ext_pwm_setup_backlight()
1529 panel->backlight.pwm_state.period = in ext_pwm_setup_backlight()
1533 drm_info(&dev_priv->drm, "Using %s PWM for LCD backlight control\n", in ext_pwm_setup_backlight()
1540 struct intel_connector *connector = to_intel_connector(conn_state->connector); in intel_pwm_set_backlight()
1541 struct intel_panel *panel = &connector->panel; in intel_pwm_set_backlight()
1543 panel->backlight.pwm_funcs->set(conn_state, in intel_pwm_set_backlight()
1549 struct intel_panel *panel = &connector->panel; in intel_pwm_get_backlight()
1552 panel->backlight.pwm_funcs->get(connector, pipe)); in intel_pwm_get_backlight()
1558 struct intel_connector *connector = to_intel_connector(conn_state->connector); in intel_pwm_enable_backlight()
1559 struct intel_panel *panel = &connector->panel; in intel_pwm_enable_backlight()
1561 panel->backlight.pwm_funcs->enable(crtc_state, conn_state, in intel_pwm_enable_backlight()
1567 struct intel_connector *connector = to_intel_connector(conn_state->connector); in intel_pwm_disable_backlight()
1568 struct intel_panel *panel = &connector->panel; in intel_pwm_disable_backlight()
1570 panel->backlight.pwm_funcs->disable(conn_state, in intel_pwm_disable_backlight()
1576 struct intel_panel *panel = &connector->panel; in intel_pwm_setup_backlight()
1577 int ret = panel->backlight.pwm_funcs->setup(connector, pipe); in intel_pwm_setup_backlight()
1582 panel->backlight.min = panel->backlight.pwm_level_min; in intel_pwm_setup_backlight()
1583 panel->backlight.max = panel->backlight.pwm_level_max; in intel_pwm_setup_backlight()
1584 panel->backlight.level = intel_pwm_get_backlight(connector, pipe); in intel_pwm_setup_backlight()
1585 panel->backlight.enabled = panel->backlight.pwm_enabled; in intel_pwm_setup_backlight()
1595 struct intel_connector *connector = to_intel_connector(conn_state->connector); in intel_backlight_update()
1596 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in intel_backlight_update()
1597 struct intel_panel *panel = &connector->panel; in intel_backlight_update()
1599 if (!panel->backlight.present) in intel_backlight_update()
1602 mutex_lock(&dev_priv->display.backlight.lock); in intel_backlight_update()
1603 if (!panel->backlight.enabled) in intel_backlight_update()
1606 mutex_unlock(&dev_priv->display.backlight.lock); in intel_backlight_update()
1611 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in intel_backlight_setup()
1612 struct intel_panel *panel = &connector->panel; in intel_backlight_setup()
1615 if (!connector->panel.vbt.backlight.present) { in intel_backlight_setup()
1617 drm_dbg_kms(&dev_priv->drm, in intel_backlight_setup()
1618 "no backlight present per VBT, but present per quirk\n"); in intel_backlight_setup()
1620 drm_dbg_kms(&dev_priv->drm, in intel_backlight_setup()
1621 "no backlight present per VBT\n"); in intel_backlight_setup()
1627 if (drm_WARN_ON(&dev_priv->drm, !panel->backlight.funcs)) in intel_backlight_setup()
1628 return -ENODEV; in intel_backlight_setup()
1631 mutex_lock(&dev_priv->display.backlight.lock); in intel_backlight_setup()
1632 ret = panel->backlight.funcs->setup(connector, pipe); in intel_backlight_setup()
1633 mutex_unlock(&dev_priv->display.backlight.lock); in intel_backlight_setup()
1636 drm_dbg_kms(&dev_priv->drm, in intel_backlight_setup()
1637 "failed to setup backlight for connector %s\n", in intel_backlight_setup()
1638 connector->base.name); in intel_backlight_setup()
1642 panel->backlight.present = true; in intel_backlight_setup()
1644 drm_dbg_kms(&dev_priv->drm, in intel_backlight_setup()
1645 "Connector %s backlight initialized, %s, brightness %u/%u\n", in intel_backlight_setup()
1646 connector->base.name, in intel_backlight_setup()
1647 str_enabled_disabled(panel->backlight.enabled), in intel_backlight_setup()
1648 panel->backlight.level, panel->backlight.max); in intel_backlight_setup()
1655 /* dispose of the pwm */ in intel_backlight_destroy()
1656 if (panel->backlight.pwm) in intel_backlight_destroy()
1657 pwm_put(panel->backlight.pwm); in intel_backlight_destroy()
1659 panel->backlight.present = false; in intel_backlight_destroy()
1750 /* Set up chip specific backlight functions */
1755 struct drm_i915_private *dev_priv = to_i915(connector->base.dev); in intel_backlight_init_funcs()
1757 if (connector->base.connector_type == DRM_MODE_CONNECTOR_DSI && in intel_backlight_init_funcs()
1762 panel->backlight.pwm_funcs = &bxt_pwm_funcs; in intel_backlight_init_funcs()
1764 panel->backlight.pwm_funcs = &cnp_pwm_funcs; in intel_backlight_init_funcs()
1767 panel->backlight.pwm_funcs = &lpt_pwm_funcs; in intel_backlight_init_funcs()
1769 panel->backlight.pwm_funcs = &spt_pwm_funcs; in intel_backlight_init_funcs()
1771 panel->backlight.pwm_funcs = &pch_pwm_funcs; in intel_backlight_init_funcs()
1773 if (connector->base.connector_type == DRM_MODE_CONNECTOR_DSI) { in intel_backlight_init_funcs()
1774 panel->backlight.pwm_funcs = &ext_pwm_funcs; in intel_backlight_init_funcs()
1776 panel->backlight.pwm_funcs = &vlv_pwm_funcs; in intel_backlight_init_funcs()
1779 panel->backlight.pwm_funcs = &i965_pwm_funcs; in intel_backlight_init_funcs()
1781 panel->backlight.pwm_funcs = &i9xx_pwm_funcs; in intel_backlight_init_funcs()
1784 if (connector->base.connector_type == DRM_MODE_CONNECTOR_eDP) { in intel_backlight_init_funcs()
1789 connector->panel.backlight.power = intel_pps_backlight_power; in intel_backlight_init_funcs()
1792 /* We're using a standard PWM backlight interface */ in intel_backlight_init_funcs()
1793 panel->backlight.funcs = &pwm_bl_funcs; in intel_backlight_init_funcs()