drm/i915: Pass connector state to intel_panel_set_backlight_acpi
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Mon, 12 Jun 2017 10:21:14 +0000 (12:21 +0200)
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Mon, 12 Jun 2017 14:06:10 +0000 (16:06 +0200)
Passing the state is also needed to convert the backlight functions
to use the correct state instead of looking it up.

This is done as a separate commit to allow easier bisecting.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100022
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170612102115.23665-3-maarten.lankhorst@linux.intel.com
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_opregion.c
drivers/gpu/drm/i915/intel_panel.c

index f08899becfe2028ac1645dbd46e1341896c8c886..e53506bdaf3b1ccdb86b6e095ddc1d1ef2c3e5d5 100644 (file)
@@ -1712,7 +1712,7 @@ void intel_pch_panel_fitting(struct intel_crtc *crtc,
 void intel_gmch_panel_fitting(struct intel_crtc *crtc,
                              struct intel_crtc_state *pipe_config,
                              int fitting_mode);
-void intel_panel_set_backlight_acpi(struct intel_connector *connector,
+void intel_panel_set_backlight_acpi(const struct drm_connector_state *conn_state,
                                    u32 level, u32 max);
 int intel_panel_setup_backlight(struct drm_connector *connector,
                                enum pipe pipe);
index d44465190dc185fa8978a3988437ae1f3c08430a..2bd03001cc709fbd278af5c3a94a7d6eb21654f2 100644 (file)
@@ -461,7 +461,7 @@ static u32 asle_set_backlight(struct drm_i915_private *dev_priv, u32 bclp)
        DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
        drm_connector_list_iter_begin(dev, &conn_iter);
        for_each_intel_connector_iter(connector, &conn_iter)
-               intel_panel_set_backlight_acpi(connector, bclp, 255);
+               intel_panel_set_backlight_acpi(connector->base.state, bclp, 255);
        drm_connector_list_iter_end(&conn_iter);
        asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID;
 
index 2567533544aa411a437926df404d8e1149cad2b4..8cb573166421f7b99bc1aae5c6818df981c052ee 100644 (file)
@@ -671,21 +671,21 @@ static void intel_panel_set_backlight(struct intel_connector *connector,
 /* set backlight brightness to level in range [0..max], assuming hw min is
  * respected.
  */
-void intel_panel_set_backlight_acpi(struct intel_connector *connector,
+void intel_panel_set_backlight_acpi(const struct drm_connector_state *conn_state,
                                    u32 user_level, u32 user_max)
 {
+       struct intel_connector *connector = to_intel_connector(conn_state->connector);
        struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
        struct intel_panel *panel = &connector->panel;
-       enum pipe pipe = intel_get_pipe_from_connector(connector);
        u32 hw_level;
 
        /*
-        * INVALID_PIPE may occur during driver init because
+        * Lack of crtc may occur during driver init because
         * connection_mutex isn't held across the entire backlight
         * setup + modeset readout, and the BIOS can issue the
         * requests at any time.
         */
-       if (!panel->backlight.present || pipe == INVALID_PIPE)
+       if (!panel->backlight.present || !conn_state->crtc)
                return;
 
        mutex_lock(&dev_priv->backlight_lock);