drm/i915/lvds: Populate connector->ddc
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 29 Aug 2023 11:39:12 +0000 (14:39 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 15 Sep 2023 11:47:29 +0000 (14:47 +0300)
Populate connector->ddc, and thus create the "ddc" symlink
in sysfs for the LVDS port.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230829113920.13713-5-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_lvds.c

index 3ace56979b70e0bed3bc442624a23a603a8d7036..2306e133e3f60d8933a2d26aaa73cfe66af0d435 100644 (file)
@@ -837,7 +837,7 @@ void intel_lvds_init(struct drm_i915_private *i915)
        struct intel_encoder *encoder;
        i915_reg_t lvds_reg;
        u32 lvds;
-       u8 pin;
+       u8 ddc_pin;
 
        /* Skip init on machines we know falsely report LVDS */
        if (dmi_check_system(intel_no_lvds)) {
@@ -864,8 +864,8 @@ void intel_lvds_init(struct drm_i915_private *i915)
                        return;
        }
 
-       pin = GMBUS_PIN_PANEL;
-       if (!intel_bios_is_lvds_present(i915, &pin)) {
+       ddc_pin = GMBUS_PIN_PANEL;
+       if (!intel_bios_is_lvds_present(i915, &ddc_pin)) {
                if ((lvds & LVDS_PORT_EN) == 0) {
                        drm_dbg_kms(&i915->drm,
                                    "LVDS is not present in VBT\n");
@@ -888,8 +888,10 @@ void intel_lvds_init(struct drm_i915_private *i915)
        lvds_encoder->attached_connector = connector;
        encoder = &lvds_encoder->base;
 
-       drm_connector_init(&i915->drm, &connector->base, &intel_lvds_connector_funcs,
-                          DRM_MODE_CONNECTOR_LVDS);
+       drm_connector_init_with_ddc(&i915->drm, &connector->base,
+                                   &intel_lvds_connector_funcs,
+                                   DRM_MODE_CONNECTOR_LVDS,
+                                   intel_gmbus_get_adapter(i915, ddc_pin));
 
        drm_encoder_init(&i915->drm, &encoder->base, &intel_lvds_enc_funcs,
                         DRM_MODE_ENCODER_LVDS, "LVDS");
@@ -943,13 +945,10 @@ void intel_lvds_init(struct drm_i915_private *i915)
         * preferred mode is the right one.
         */
        mutex_lock(&i915->drm.mode_config.mutex);
-       if (vga_switcheroo_handler_flags() & VGA_SWITCHEROO_CAN_SWITCH_DDC) {
-               drm_edid = drm_edid_read_switcheroo(&connector->base,
-                                                   intel_gmbus_get_adapter(i915, pin));
-       } else {
-               drm_edid = drm_edid_read_ddc(&connector->base,
-                                            intel_gmbus_get_adapter(i915, pin));
-       }
+       if (vga_switcheroo_handler_flags() & VGA_SWITCHEROO_CAN_SWITCH_DDC)
+               drm_edid = drm_edid_read_switcheroo(&connector->base, connector->base.ddc);
+       else
+               drm_edid = drm_edid_read_ddc(&connector->base, connector->base.ddc);
        if (drm_edid) {
                if (drm_edid_connector_update(&connector->base, drm_edid) ||
                    !drm_edid_connector_add_modes(&connector->base)) {