Skip to content

Commit e1898f9

Browse files
committed
Merge tag 'drm-misc-fixes-2018-04-18-1' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-fixes: stable: vc4: Fix memory leak during BO teardown (Daniel) dp: Add i2c retry for LSPCON adapters (Imre) hdcp: Fix device count mask (Ramalingam) Cc: Daniel J Blueman <[email protected] Cc: Imre Deak <[email protected]> Cc: Ramalingam C <[email protected]> * tag 'drm-misc-fixes-2018-04-18-1' of git://anongit.freedesktop.org/drm/drm-misc: drm/i915: Fix LSPCON TMDS output buffer enabling from low-power state drm: Fix HDCP downstream dev count read drm/vc4: Fix memory leak during BO teardown
2 parents a10beab + 7eb2c4d commit e1898f9

File tree

4 files changed

+36
-8
lines changed

4 files changed

+36
-8
lines changed

drivers/gpu/drm/drm_dp_dual_mode_helper.c

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -350,19 +350,44 @@ int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type,
350350
{
351351
uint8_t tmds_oen = enable ? 0 : DP_DUAL_MODE_TMDS_DISABLE;
352352
ssize_t ret;
353+
int retry;
353354

354355
if (type < DRM_DP_DUAL_MODE_TYPE2_DVI)
355356
return 0;
356357

357-
ret = drm_dp_dual_mode_write(adapter, DP_DUAL_MODE_TMDS_OEN,
358-
&tmds_oen, sizeof(tmds_oen));
359-
if (ret) {
360-
DRM_DEBUG_KMS("Failed to %s TMDS output buffers\n",
361-
enable ? "enable" : "disable");
362-
return ret;
358+
/*
359+
* LSPCON adapters in low-power state may ignore the first write, so
360+
* read back and verify the written value a few times.
361+
*/
362+
for (retry = 0; retry < 3; retry++) {
363+
uint8_t tmp;
364+
365+
ret = drm_dp_dual_mode_write(adapter, DP_DUAL_MODE_TMDS_OEN,
366+
&tmds_oen, sizeof(tmds_oen));
367+
if (ret) {
368+
DRM_DEBUG_KMS("Failed to %s TMDS output buffers (%d attempts)\n",
369+
enable ? "enable" : "disable",
370+
retry + 1);
371+
return ret;
372+
}
373+
374+
ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_TMDS_OEN,
375+
&tmp, sizeof(tmp));
376+
if (ret) {
377+
DRM_DEBUG_KMS("I2C read failed during TMDS output buffer %s (%d attempts)\n",
378+
enable ? "enabling" : "disabling",
379+
retry + 1);
380+
return ret;
381+
}
382+
383+
if (tmp == tmds_oen)
384+
return 0;
363385
}
364386

365-
return 0;
387+
DRM_DEBUG_KMS("I2C write value mismatch during TMDS output buffer %s\n",
388+
enable ? "enabling" : "disabling");
389+
390+
return -EIO;
366391
}
367392
EXPORT_SYMBOL(drm_dp_dual_mode_set_tmds_output);
368393

drivers/gpu/drm/vc4/vc4_bo.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ static void vc4_bo_destroy(struct vc4_bo *bo)
195195
vc4_bo_set_label(obj, -1);
196196

197197
if (bo->validated_shader) {
198+
kfree(bo->validated_shader->uniform_addr_offsets);
198199
kfree(bo->validated_shader->texture_samples);
199200
kfree(bo->validated_shader);
200201
bo->validated_shader = NULL;
@@ -591,6 +592,7 @@ void vc4_free_object(struct drm_gem_object *gem_bo)
591592
}
592593

593594
if (bo->validated_shader) {
595+
kfree(bo->validated_shader->uniform_addr_offsets);
594596
kfree(bo->validated_shader->texture_samples);
595597
kfree(bo->validated_shader);
596598
bo->validated_shader = NULL;

drivers/gpu/drm/vc4/vc4_validate_shaders.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj)
942942
fail:
943943
kfree(validation_state.branch_targets);
944944
if (validated_shader) {
945+
kfree(validated_shader->uniform_addr_offsets);
945946
kfree(validated_shader->texture_samples);
946947
kfree(validated_shader);
947948
}

include/drm/drm_hdcp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define DRM_HDCP_RI_LEN 2
2020
#define DRM_HDCP_V_PRIME_PART_LEN 4
2121
#define DRM_HDCP_V_PRIME_NUM_PARTS 5
22-
#define DRM_HDCP_NUM_DOWNSTREAM(x) (x & 0x3f)
22+
#define DRM_HDCP_NUM_DOWNSTREAM(x) (x & 0x7f)
2323
#define DRM_HDCP_MAX_CASCADE_EXCEEDED(x) (x & BIT(3))
2424
#define DRM_HDCP_MAX_DEVICE_EXCEEDED(x) (x & BIT(7))
2525

0 commit comments

Comments
 (0)