Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/display/dm: handle OEM i2c buses in i2c functions

Allow the creation of an OEM i2c bus and use the proper
DC helpers for that case.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

+21 -9
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
··· 609 609 struct i2c_adapter base; 610 610 611 611 struct ddc_service *ddc_service; 612 + bool oem; 612 613 }; 613 614 614 615 #define TO_DM_AUX(x) container_of((x), struct amdgpu_dm_dp_aux, aux)
+20 -9
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 8301 8301 cmd.payloads[i].data = msgs[i].buf; 8302 8302 } 8303 8303 8304 - if (dc_submit_i2c( 8305 - ddc_service->ctx->dc, 8306 - ddc_service->link->link_index, 8307 - &cmd)) 8308 - result = num; 8304 + if (i2c->oem) { 8305 + if (dc_submit_i2c_oem( 8306 + ddc_service->ctx->dc, 8307 + &cmd)) 8308 + result = num; 8309 + } else { 8310 + if (dc_submit_i2c( 8311 + ddc_service->ctx->dc, 8312 + ddc_service->link->link_index, 8313 + &cmd)) 8314 + result = num; 8315 + } 8309 8316 8310 8317 kfree(cmd.payloads); 8311 8318 return result; ··· 8329 8322 }; 8330 8323 8331 8324 static struct amdgpu_i2c_adapter * 8332 - create_i2c(struct ddc_service *ddc_service) 8325 + create_i2c(struct ddc_service *ddc_service, bool oem) 8333 8326 { 8334 8327 struct amdgpu_device *adev = ddc_service->ctx->driver_context; 8335 8328 struct amdgpu_i2c_adapter *i2c; ··· 8340 8333 i2c->base.owner = THIS_MODULE; 8341 8334 i2c->base.dev.parent = &adev->pdev->dev; 8342 8335 i2c->base.algo = &amdgpu_dm_i2c_algo; 8343 - snprintf(i2c->base.name, sizeof(i2c->base.name), "AMDGPU DM i2c hw bus %d", 8344 - ddc_service->link->link_index); 8336 + if (oem) 8337 + snprintf(i2c->base.name, sizeof(i2c->base.name), "AMDGPU DM i2c OEM bus"); 8338 + else 8339 + snprintf(i2c->base.name, sizeof(i2c->base.name), "AMDGPU DM i2c hw bus %d", 8340 + ddc_service->link->link_index); 8345 8341 i2c_set_adapdata(&i2c->base, i2c); 8346 8342 i2c->ddc_service = ddc_service; 8343 + i2c->oem = oem; 8347 8344 8348 8345 return i2c; 8349 8346 } ··· 8393 8382 link->priv = aconnector; 8394 8383 8395 8384 8396 - i2c = create_i2c(link->ddc); 8385 + i2c = create_i2c(link->ddc, false); 8397 8386 if (!i2c) { 8398 8387 DRM_ERROR("Failed to create i2c adapter data\n"); 8399 8388 return -ENOMEM;