Skip to contentSkip to conversation

drm/amd/display: introduce quirks for i2c adaptor

PATCH In review Shirish S 3 participants 3 messages Apr 17, 2018 – Apr 23, 2018 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Shirish S

author
#0 lore raw

PATCH 1/1 drm/amd/display: introduce quirks for i2c adaptor

The dp aux channel cannot read messages of size greater than 16 bytes, this patch adds quirks feild accordingly at the initialization of the adaptor.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +5 -0
index 782491e..f7d6d9a 100644
@@ -464,10 +464,15 @@ static const struct drm_dp_mst_topology_cbs dm_mst_cbs = {
 	.register_connector = dm_dp_mst_register_connector
 };
 
+/* I2C adapter quirks, max read len is 16 bytes. */
+static const struct i2c_adapter_quirks dm_dp_aux_quirks = {
+	.max_read_len = 128,
+};
 void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
 				       struct amdgpu_dm_connector *aconnector)
 {
 	aconnector->dm_dp_aux.aux.name = "dmdc";
+	aconnector->dm_dp_aux.aux.ddc.quirks = &dm_dp_aux_quirks;
 	aconnector->dm_dp_aux.aux.dev = dm->adev->dev;
 	aconnector->dm_dp_aux.aux.transfer = dm_dp_aux_transfer;
 	aconnector->dm_dp_aux.ddc_service = aconnector->dc_link->ddc;
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1523948276-7277-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 3 lines · Shirish S

The dp aux channel cannot read messages of size greater than 16 bytes, this patch adds quirks feild accordingly at the initialization of the adaptor.

Is this in response to a bug?

I don't see any other DRM driver using quirks like this, even though they also wouldn't be able to transfer more than 16 bytes when using i2c-over-aux. This makes me wonder why we need it.

Harry

Quoted 17 lines
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2 -0
index 782491e..f7d6d9a 100644
@@ -464,10 +464,15 @@ static const struct drm_dp_mst_topology_cbs dm_mst_cbs = {
 	.register_connector = dm_dp_mst_register_connector
 };
 
+/* I2C adapter quirks, max read len is 16 bytes. */
+static const struct i2c_adapter_quirks dm_dp_aux_quirks = {

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c static const struct drm_dp_mst_topology_cbs dm_mst_cbs = { · line 478

Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +3 -0
+	.max_read_len = 128,
+};
 void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
 				       struct amdgpu_dm_connector *aconnector)
 {
 	aconnector->dm_dp_aux.aux.name = "dmdc";
+	aconnector->dm_dp_aux.aux.ddc.quirks = &dm_dp_aux_quirks;
 	aconnector->dm_dp_aux.aux.dev = dm->adev->dev;
 	aconnector->dm_dp_aux.aux.transfer = dm_dp_aux_transfer;
 	aconnector->dm_dp_aux.ddc_service = aconnector->dc_link->ddc;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 3f51799b-0413-55c9-58fe-36a81b584d40-5C7GfCeVMHo@public.gmane.org

#4 lore raw
Quoted 5 lines · Harry Wentland
Quoted 3 lines · Shirish S

The dp aux channel cannot read messages of size greater than 16 bytes, this patch adds quirks feild accordingly at the initialization of the adaptor.

Is this in response to a bug?

Yes, its in continuation to the dm_dp_aux_transfer() return bug but also with an intention to clean up.
Currently we are in a more reactive mode, i.e., in dm_dp_aux_transfer() we have a WARN_ON for the message size,
i.e., at this time the i2c framework has already created a list of msg->sizes's, however by adding a quirk not only can we get rid of the WARN_ON but also ensure that the i2c framework knows about it and do not let form message reads > 16 bytes.

Quoted 18 lines

I don't see any other DRM driver using quirks like this, even though they also wouldn't be able to transfer more than 16 bytes when using i2c-over-aux. This makes me wonder why we need it.

Harry

Quoted 13 lines
---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +0 -0
index 782491e..f7d6d9a 100644
@@ -464,10 +464,15 @@ static const struct drm_dp_mst_topology_cbs dm_mst_cbs = {
  	.register_connector = dm_dp_mst_register_connector
  };
 
Quoted 13 lines

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c static const struct drm_dp_mst_topology_cbs dm_mst_cbs = { · line 478

Quoted 13 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +5 -0
+/* I2C adapter quirks, max read len is 16 bytes. */
+static const struct i2c_adapter_quirks dm_dp_aux_quirks = {
+	.max_read_len = 128,
+};
  void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
  				       struct amdgpu_dm_connector *aconnector)
  {
  	aconnector->dm_dp_aux.aux.name = "dmdc";
+	aconnector->dm_dp_aux.aux.ddc.quirks = &dm_dp_aux_quirks;
  	aconnector->dm_dp_aux.aux.dev = dm->adev->dev;
  	aconnector->dm_dp_aux.aux.transfer = dm_dp_aux_transfer;
  	aconnector->dm_dp_aux.ddc_service = aconnector->dc_link->ddc;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx