Commit a70882aa authored by Alex Deucher's avatar Alex Deucher Committed by Dave Airlie

drm/radeon/kms: add connectors even if i2c fails

Sometimes the i2c test in i2c_bit_add_bus fails
if this happens we fail to register the i2c adapter and
eventually fail to add the connector.  If i2c fails,
add the connector to the user can at least force
it on.

Note that some distros set i2c-algo-bit.bit_test to 1 by
default which sometimes fails preventing the ddc i2c adapter
from being added.  The i2c adapter works even if the bit test
fails, probably due to pre/post_xfer not getting called in
the test_bit function.  I have another patch to follow
up on that.

See:
https://bugs.freedesktop.org/show_bug.cgi?id=36221Signed-off-by: default avatarAlex Deucher <alexdeucher@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 8e461123
...@@ -1199,7 +1199,7 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1199,7 +1199,7 @@ radeon_add_atom_connector(struct drm_device *dev,
if (router->ddc_valid || router->cd_valid) { if (router->ddc_valid || router->cd_valid) {
radeon_connector->router_bus = radeon_i2c_lookup(rdev, &router->i2c_info); radeon_connector->router_bus = radeon_i2c_lookup(rdev, &router->i2c_info);
if (!radeon_connector->router_bus) if (!radeon_connector->router_bus)
goto failed; DRM_ERROR("Failed to assign router i2c bus! Check dmesg for i2c errors.\n");
} }
switch (connector_type) { switch (connector_type) {
case DRM_MODE_CONNECTOR_VGA: case DRM_MODE_CONNECTOR_VGA:
...@@ -1208,7 +1208,7 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1208,7 +1208,7 @@ radeon_add_atom_connector(struct drm_device *dev,
if (i2c_bus->valid) { if (i2c_bus->valid) {
radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
if (!radeon_connector->ddc_bus) if (!radeon_connector->ddc_bus)
goto failed; DRM_ERROR("VGA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
} }
radeon_connector->dac_load_detect = true; radeon_connector->dac_load_detect = true;
drm_connector_attach_property(&radeon_connector->base, drm_connector_attach_property(&radeon_connector->base,
...@@ -1226,7 +1226,7 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1226,7 +1226,7 @@ radeon_add_atom_connector(struct drm_device *dev,
if (i2c_bus->valid) { if (i2c_bus->valid) {
radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
if (!radeon_connector->ddc_bus) if (!radeon_connector->ddc_bus)
goto failed; DRM_ERROR("DVIA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
} }
radeon_connector->dac_load_detect = true; radeon_connector->dac_load_detect = true;
drm_connector_attach_property(&radeon_connector->base, drm_connector_attach_property(&radeon_connector->base,
...@@ -1249,7 +1249,7 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1249,7 +1249,7 @@ radeon_add_atom_connector(struct drm_device *dev,
if (i2c_bus->valid) { if (i2c_bus->valid) {
radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
if (!radeon_connector->ddc_bus) if (!radeon_connector->ddc_bus)
goto failed; DRM_ERROR("DVI: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
} }
subpixel_order = SubPixelHorizontalRGB; subpixel_order = SubPixelHorizontalRGB;
drm_connector_attach_property(&radeon_connector->base, drm_connector_attach_property(&radeon_connector->base,
...@@ -1290,7 +1290,7 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1290,7 +1290,7 @@ radeon_add_atom_connector(struct drm_device *dev,
if (i2c_bus->valid) { if (i2c_bus->valid) {
radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
if (!radeon_connector->ddc_bus) if (!radeon_connector->ddc_bus)
goto failed; DRM_ERROR("HDMI: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
} }
drm_connector_attach_property(&radeon_connector->base, drm_connector_attach_property(&radeon_connector->base,
rdev->mode_info.coherent_mode_property, rdev->mode_info.coherent_mode_property,
...@@ -1329,10 +1329,10 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1329,10 +1329,10 @@ radeon_add_atom_connector(struct drm_device *dev,
else else
radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch");
if (!radeon_dig_connector->dp_i2c_bus) if (!radeon_dig_connector->dp_i2c_bus)
goto failed; DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n");
radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
if (!radeon_connector->ddc_bus) if (!radeon_connector->ddc_bus)
goto failed; DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
} }
subpixel_order = SubPixelHorizontalRGB; subpixel_order = SubPixelHorizontalRGB;
drm_connector_attach_property(&radeon_connector->base, drm_connector_attach_property(&radeon_connector->base,
...@@ -1381,7 +1381,7 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1381,7 +1381,7 @@ radeon_add_atom_connector(struct drm_device *dev,
if (i2c_bus->valid) { if (i2c_bus->valid) {
radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
if (!radeon_connector->ddc_bus) if (!radeon_connector->ddc_bus)
goto failed; DRM_ERROR("LVDS: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
} }
drm_connector_attach_property(&radeon_connector->base, drm_connector_attach_property(&radeon_connector->base,
dev->mode_config.scaling_mode_property, dev->mode_config.scaling_mode_property,
...@@ -1457,7 +1457,7 @@ radeon_add_legacy_connector(struct drm_device *dev, ...@@ -1457,7 +1457,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
if (i2c_bus->valid) { if (i2c_bus->valid) {
radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
if (!radeon_connector->ddc_bus) if (!radeon_connector->ddc_bus)
goto failed; DRM_ERROR("VGA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
} }
radeon_connector->dac_load_detect = true; radeon_connector->dac_load_detect = true;
drm_connector_attach_property(&radeon_connector->base, drm_connector_attach_property(&radeon_connector->base,
...@@ -1475,7 +1475,7 @@ radeon_add_legacy_connector(struct drm_device *dev, ...@@ -1475,7 +1475,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
if (i2c_bus->valid) { if (i2c_bus->valid) {
radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
if (!radeon_connector->ddc_bus) if (!radeon_connector->ddc_bus)
goto failed; DRM_ERROR("DVIA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
} }
radeon_connector->dac_load_detect = true; radeon_connector->dac_load_detect = true;
drm_connector_attach_property(&radeon_connector->base, drm_connector_attach_property(&radeon_connector->base,
...@@ -1493,7 +1493,7 @@ radeon_add_legacy_connector(struct drm_device *dev, ...@@ -1493,7 +1493,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
if (i2c_bus->valid) { if (i2c_bus->valid) {
radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
if (!radeon_connector->ddc_bus) if (!radeon_connector->ddc_bus)
goto failed; DRM_ERROR("DVI: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
} }
if (connector_type == DRM_MODE_CONNECTOR_DVII) { if (connector_type == DRM_MODE_CONNECTOR_DVII) {
radeon_connector->dac_load_detect = true; radeon_connector->dac_load_detect = true;
...@@ -1538,7 +1538,7 @@ radeon_add_legacy_connector(struct drm_device *dev, ...@@ -1538,7 +1538,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
if (i2c_bus->valid) { if (i2c_bus->valid) {
radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
if (!radeon_connector->ddc_bus) if (!radeon_connector->ddc_bus)
goto failed; DRM_ERROR("LVDS: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
} }
drm_connector_attach_property(&radeon_connector->base, drm_connector_attach_property(&radeon_connector->base,
dev->mode_config.scaling_mode_property, dev->mode_config.scaling_mode_property,
...@@ -1567,9 +1567,4 @@ radeon_add_legacy_connector(struct drm_device *dev, ...@@ -1567,9 +1567,4 @@ radeon_add_legacy_connector(struct drm_device *dev,
radeon_legacy_backlight_init(radeon_encoder, connector); radeon_legacy_backlight_init(radeon_encoder, connector);
} }
} }
return;
failed:
drm_connector_cleanup(connector);
kfree(connector);
} }
...@@ -1096,6 +1096,9 @@ void radeon_router_select_ddc_port(struct radeon_connector *radeon_connector) ...@@ -1096,6 +1096,9 @@ void radeon_router_select_ddc_port(struct radeon_connector *radeon_connector)
if (!radeon_connector->router.ddc_valid) if (!radeon_connector->router.ddc_valid)
return; return;
if (!radeon_connector->router_bus)
return;
radeon_i2c_get_byte(radeon_connector->router_bus, radeon_i2c_get_byte(radeon_connector->router_bus,
radeon_connector->router.i2c_addr, radeon_connector->router.i2c_addr,
0x3, &val); 0x3, &val);
...@@ -1121,6 +1124,9 @@ void radeon_router_select_cd_port(struct radeon_connector *radeon_connector) ...@@ -1121,6 +1124,9 @@ void radeon_router_select_cd_port(struct radeon_connector *radeon_connector)
if (!radeon_connector->router.cd_valid) if (!radeon_connector->router.cd_valid)
return; return;
if (!radeon_connector->router_bus)
return;
radeon_i2c_get_byte(radeon_connector->router_bus, radeon_i2c_get_byte(radeon_connector->router_bus,
radeon_connector->router.i2c_addr, radeon_connector->router.i2c_addr,
0x3, &val); 0x3, &val);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment