aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/0692-drm-amd-display-Fix-ckeckpatch-problems-in-amdgpu_dm.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/0692-drm-amd-display-Fix-ckeckpatch-problems-in-amdgpu_dm.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/0692-drm-amd-display-Fix-ckeckpatch-problems-in-amdgpu_dm.patch521
1 files changed, 521 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/0692-drm-amd-display-Fix-ckeckpatch-problems-in-amdgpu_dm.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/0692-drm-amd-display-Fix-ckeckpatch-problems-in-amdgpu_dm.patch
new file mode 100644
index 00000000..67e174c3
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/0692-drm-amd-display-Fix-ckeckpatch-problems-in-amdgpu_dm.patch
@@ -0,0 +1,521 @@
+From 62ff0d831cfc5225ac1a8db7da23c669492e74d5 Mon Sep 17 00:00:00 2001
+From: Harry Wentland <harry.wentland@amd.com>
+Date: Wed, 26 Jul 2017 21:03:22 -0400
+Subject: [PATCH 0692/4131] drm/amd/display: Fix ckeckpatch problems in
+ amdgpu_dm
+
+Signed-off-by: Harry Wentland <harry.wentland@amd.com>
+Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
+Acked-by: Harry Wentland <Harry.Wentland@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 179 ++++++++++++----------
+ 1 file changed, 94 insertions(+), 85 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+index e84e157..9825af7 100644
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+@@ -1687,14 +1687,13 @@ static int dm_crtc_cursor_set(
+ int ret;
+
+ struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
+- ret = EINVAL;
++ ret = EINVAL;
+
+- DRM_DEBUG_KMS(
+- "%s: crtc_id=%d with size %d to %d \n",
+- __func__,
+- amdgpu_crtc->crtc_id,
+- width,
+- height);
++ DRM_DEBUG_KMS("%s: crtc_id=%d with size %d to %d \n",
++ __func__,
++ amdgpu_crtc->crtc_id,
++ width,
++ height);
+
+ if (!address) {
+ /* turn off cursor */
+@@ -1844,6 +1843,7 @@ static int get_fb_info(
+ {
+ struct amdgpu_bo *rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+ int r = amdgpu_bo_reserve(rbo, false);
++
+ if (unlikely(r)) {
+ DRM_ERROR("Unable to reserve buffer\n");
+ return r;
+@@ -1951,10 +1951,9 @@ static int fill_plane_attributes_from_fb(
+
+ memset(&surface->tiling_info, 0, sizeof(surface->tiling_info));
+
+- /* Fill GFX params */
+- if (AMDGPU_TILING_GET(tiling_flags, ARRAY_MODE) == DC_ARRAY_2D_TILED_THIN1)
+- {
+- unsigned bankw, bankh, mtaspect, tile_split, num_banks;
++ /* Fill GFX8 params */
++ if (AMDGPU_TILING_GET(tiling_flags, ARRAY_MODE) == DC_ARRAY_2D_TILED_THIN1) {
++ unsigned int bankw, bankh, mtaspect, tile_split, num_banks;
+
+ bankw = AMDGPU_TILING_GET(tiling_flags, BANK_WIDTH);
+ bankh = AMDGPU_TILING_GET(tiling_flags, BANK_HEIGHT);
+@@ -2167,7 +2166,8 @@ static enum dc_color_depth convert_color_depth_from_display_info(
+ uint32_t bpc = connector->display_info.bpc;
+
+ /* Limited color depth to 8bit
+- * TODO: Still need to handle deep color*/
++ * TODO: Still need to handle deep color
++ */
+ if (bpc > 8)
+ bpc = 8;
+
+@@ -2200,6 +2200,7 @@ static enum dc_aspect_ratio get_aspect_ratio(
+ {
+ int32_t width = mode_in->crtc_hdisplay * 9;
+ int32_t height = mode_in->crtc_vdisplay * 16;
++
+ if ((width - height) < 10 && (width - height) > -10)
+ return ASPECT_RATIO_16_9;
+ else
+@@ -2257,6 +2258,7 @@ static void fill_stream_properties_from_drm_display_mode(
+ const struct drm_connector *connector)
+ {
+ struct dc_crtc_timing *timing_out = &stream->timing;
++
+ memset(timing_out, 0, sizeof(struct dc_crtc_timing));
+
+ timing_out->h_border_left = 0;
+@@ -2301,6 +2303,7 @@ static void fill_stream_properties_from_drm_display_mode(
+
+ {
+ struct dc_transfer_func *tf = dc_create_transfer_func();
++
+ tf->type = TF_TYPE_PREDEFINED;
+ tf->tf = TRANSFER_FUNCTION_SRGB;
+ stream->out_transfer_func = tf;
+@@ -2327,7 +2330,7 @@ static void fill_audio_info(
+ i++;
+ }
+
+- if(cea_revision >= 3) {
++ if (cea_revision >= 3) {
+ audio_info->mode_count = edid_caps->audio_mode_count;
+
+ for (i = 0; i < audio_info->mode_count; ++i) {
+@@ -2346,7 +2349,7 @@ static void fill_audio_info(
+ audio_info->flags.all = edid_caps->speaker_flags;
+
+ /* TODO: We only check for the progressive mode, check for interlace mode too */
+- if(drm_connector->latency_present[0]) {
++ if (drm_connector->latency_present[0]) {
+ audio_info->video_latency = drm_connector->video_latency[0];
+ audio_info->audio_latency = drm_connector->audio_latency[0];
+ }
+@@ -2364,7 +2367,7 @@ static void copy_crtc_timing_for_drm_display_mode(
+ dst_mode->crtc_clock = src_mode->crtc_clock;
+ dst_mode->crtc_hblank_start = src_mode->crtc_hblank_start;
+ dst_mode->crtc_hblank_end = src_mode->crtc_hblank_end;
+- dst_mode->crtc_hsync_start= src_mode->crtc_hsync_start;
++ dst_mode->crtc_hsync_start = src_mode->crtc_hsync_start;
+ dst_mode->crtc_hsync_end = src_mode->crtc_hsync_end;
+ dst_mode->crtc_htotal = src_mode->crtc_htotal;
+ dst_mode->crtc_hskew = src_mode->crtc_hskew;
+@@ -2402,12 +2405,12 @@ static struct dc_stream *create_stream_for_sink(
+ struct drm_display_mode mode = *drm_mode;
+ bool native_mode_found = false;
+
+- if (NULL == aconnector) {
++ if (aconnector == NULL) {
+ DRM_ERROR("aconnector is NULL!\n");
+ goto drm_connector_null;
+ }
+
+- if (NULL == dm_state) {
++ if (dm_state == NULL) {
+ DRM_ERROR("dm_state is NULL!\n");
+ goto dm_state_null;
+ }
+@@ -2415,7 +2418,7 @@ static struct dc_stream *create_stream_for_sink(
+ drm_connector = &aconnector->base;
+ stream = dc_create_stream_for_sink(aconnector->dc_sink);
+
+- if (NULL == stream) {
++ if (stream == NULL) {
+ DRM_ERROR("Failed to create stream for sink!\n");
+ goto stream_create_fail;
+ }
+@@ -2433,7 +2436,7 @@ static struct dc_stream *create_stream_for_sink(
+ struct drm_display_mode,
+ head);
+
+- if (NULL == preferred_mode) {
++ if (preferred_mode == NULL) {
+ /* This may not be an error, the use case is when we we have no
+ * usermode calls to reset and set mode upon hotplug. In this
+ * case, we call set mode ourselves to restore the previous mode
+@@ -2967,13 +2970,13 @@ int amdgpu_dm_connector_mode_valid(
+
+ dc_sink = to_amdgpu_connector(connector)->dc_sink;
+
+- if (NULL == dc_sink) {
++ if (dc_sink == NULL) {
+ DRM_ERROR("dc_sink is NULL!\n");
+ goto fail;
+ }
+
+ stream = dc_create_stream_for_sink(dc_sink);
+- if (NULL == stream) {
++ if (stream == NULL) {
+ DRM_ERROR("Failed to create stream for sink!\n");
+ goto fail;
+ }
+@@ -2998,11 +3001,11 @@ int amdgpu_dm_connector_mode_valid(
+ static const struct drm_connector_helper_funcs
+ amdgpu_dm_connector_helper_funcs = {
+ /*
+- * If hotplug a second bigger display in FB Con mode, bigger resolution
+- * modes will be filtered by drm_mode_validate_size(), and those modes
+- * is missing after user start lightdm. So we need to renew modes list.
+- * in get_modes call back, not just return the modes count
+- */
++ * If hotplug a second bigger display in FB Con mode, bigger resolution
++ * modes will be filtered by drm_mode_validate_size(), and those modes
++ * is missing after user start lightdm. So we need to renew modes list.
++ * in get_modes call back, not just return the modes count
++ */
+ .get_modes = get_modes,
+ .mode_valid = amdgpu_dm_connector_mode_valid,
+ .best_encoder = best_encoder
+@@ -3214,11 +3217,11 @@ static void dm_plane_helper_cleanup_fb(
+ if (unlikely(r)) {
+ DRM_ERROR("failed to reserve rbo before unpin\n");
+ return;
+- } else {
+- amdgpu_bo_unpin(rbo);
+- amdgpu_bo_unreserve(rbo);
+- amdgpu_bo_unref(&rbo);
+- };
++ }
++
++ amdgpu_bo_unpin(rbo);
++ amdgpu_bo_unreserve(rbo);
++ amdgpu_bo_unref(&rbo);
+ }
+
+ int dm_create_validation_set_for_connector(struct drm_connector *connector,
+@@ -3234,14 +3237,14 @@ int dm_create_validation_set_for_connector(struct drm_connector *connector,
+ (mode->flags & DRM_MODE_FLAG_DBLSCAN))
+ return result;
+
+- if (NULL == dc_sink) {
++ if (dc_sink == NULL) {
+ DRM_ERROR("dc_sink is NULL!\n");
+ return result;
+ }
+
+ stream = dc_create_stream_for_sink(dc_sink);
+
+- if (NULL == stream) {
++ if (stream == NULL) {
+ DRM_ERROR("Failed to create stream for sink!\n");
+ return result;
+ }
+@@ -3380,10 +3383,8 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
+ return 0;
+
+ fail:
+- if (acrtc)
+- kfree(acrtc);
+- if (cursor_plane)
+- kfree(cursor_plane);
++ kfree(acrtc);
++ kfree(cursor_plane);
+ acrtc->crtc_id = -1;
+ return res;
+ }
+@@ -3430,12 +3431,13 @@ static void amdgpu_dm_get_native_mode(struct drm_connector *connector)
+
+ if (!list_empty(&connector->probed_modes)) {
+ struct drm_display_mode *preferred_mode = NULL;
++
+ list_for_each_entry(preferred_mode,
+- &connector->probed_modes,
+- head) {
+- if (preferred_mode->type & DRM_MODE_TYPE_PREFERRED) {
+- amdgpu_encoder->native_mode = *preferred_mode;
+- }
++ &connector->probed_modes,
++ head) {
++ if (preferred_mode->type & DRM_MODE_TYPE_PREFERRED)
++ amdgpu_encoder->native_mode = *preferred_mode;
++
+ break;
+ }
+
+@@ -3453,7 +3455,7 @@ static struct drm_display_mode *amdgpu_dm_create_common_mode(
+
+ mode = drm_mode_duplicate(dev, native_mode);
+
+- if(mode == NULL)
++ if (mode == NULL)
+ return NULL;
+
+ mode->hdisplay = hdisplay;
+@@ -3479,7 +3481,7 @@ static void amdgpu_dm_connector_add_common_modes(struct drm_encoder *encoder,
+ char name[DRM_DISPLAY_MODE_LEN];
+ int w;
+ int h;
+- }common_modes[] = {
++ } common_modes[] = {
+ { "640x480", 640, 480},
+ { "800x600", 800, 600},
+ { "1024x768", 1024, 768},
+@@ -3493,21 +3495,21 @@ static void amdgpu_dm_connector_add_common_modes(struct drm_encoder *encoder,
+ {"1920x1200", 1920, 1200}
+ };
+
+- n = sizeof(common_modes) / sizeof(common_modes[0]);
++ n = ARRAY_SIZE(common_modes);
+
+ for (i = 0; i < n; i++) {
+ struct drm_display_mode *curmode = NULL;
+ bool mode_existed = false;
+
+ if (common_modes[i].w > native_mode->hdisplay ||
+- common_modes[i].h > native_mode->vdisplay ||
+- (common_modes[i].w == native_mode->hdisplay &&
+- common_modes[i].h == native_mode->vdisplay))
+- continue;
++ common_modes[i].h > native_mode->vdisplay ||
++ (common_modes[i].w == native_mode->hdisplay &&
++ common_modes[i].h == native_mode->vdisplay))
++ continue;
+
+ list_for_each_entry(curmode, &connector->probed_modes, head) {
+ if (common_modes[i].w == curmode->hdisplay &&
+- common_modes[i].h == curmode->vdisplay) {
++ common_modes[i].h == curmode->vdisplay) {
+ mode_existed = true;
+ break;
+ }
+@@ -3579,8 +3581,9 @@ void amdgpu_dm_connector_init_helper(
+
+ mutex_init(&aconnector->hpd_lock);
+
+- /*configure suport HPD hot plug connector_>polled default value is 0
+- * which means HPD hot plug not supported*/
++ /* configure support HPD hot plug connector_>polled default value is 0
++ * which means HPD hot plug not supported
++ */
+ switch (connector_type) {
+ case DRM_MODE_CONNECTOR_HDMIA:
+ aconnector->base.polled = DRM_CONNECTOR_POLL_HPD;
+@@ -3628,7 +3631,7 @@ int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap,
+ int i;
+ int result = -EIO;
+
+- cmd.payloads = kzalloc(num * sizeof(struct i2c_payload), GFP_KERNEL);
++ cmd.payloads = kcalloc(num, sizeof(struct i2c_payload), GFP_KERNEL);
+
+ if (!cmd.payloads)
+ return result;
+@@ -3672,12 +3675,12 @@ static struct amdgpu_i2c_adapter *create_i2c(
+ struct amdgpu_device *adev = ddc_service->ctx->driver_context;
+ struct amdgpu_i2c_adapter *i2c;
+
+- i2c = kzalloc(sizeof (struct amdgpu_i2c_adapter), GFP_KERNEL);
++ i2c = kzalloc(sizeof(struct amdgpu_i2c_adapter), GFP_KERNEL);
+ i2c->base.owner = THIS_MODULE;
+ i2c->base.class = I2C_CLASS_DDC;
+ i2c->base.dev.parent = &adev->pdev->dev;
+ i2c->base.algo = &amdgpu_dm_i2c_algo;
+- snprintf(i2c->base.name, sizeof (i2c->base.name), "AMDGPU DM i2c hw bus %d", link_index);
++ snprintf(i2c->base.name, sizeof(i2c->base.name), "AMDGPU DM i2c hw bus %d", link_index);
+ i2c_set_adapdata(&i2c->base, i2c);
+ i2c->ddc_service = ddc_service;
+
+@@ -3685,7 +3688,8 @@ static struct amdgpu_i2c_adapter *create_i2c(
+ }
+
+ /* Note: this function assumes that dc_link_detect() was called for the
+- * dc_link which will be represented by this aconnector. */
++ * dc_link which will be represented by this aconnector.
++ */
+ int amdgpu_dm_connector_init(
+ struct amdgpu_display_manager *dm,
+ struct amdgpu_connector *aconnector,
+@@ -3757,7 +3761,8 @@ int amdgpu_dm_connector_init(
+ if (link->connector_signal & (SIGNAL_TYPE_EDP | SIGNAL_TYPE_LVDS)) {
+ /* Event if registration failed, we should continue with
+ * DM initialization because not having a backlight control
+- * is better then a black screen. */
++ * is better then a black screen.
++ */
+ amdgpu_dm_register_backlight_device(dm);
+
+ if (dm->backlight_dev)
+@@ -3859,9 +3864,9 @@ static bool is_scaling_state_different(
+ } else if (dm_state->underscan_enable && !old_dm_state->underscan_enable) {
+ if (dm_state->underscan_hborder != 0 && dm_state->underscan_vborder != 0)
+ return true;
+- } else if (dm_state->underscan_hborder != old_dm_state->underscan_hborder
+- || dm_state->underscan_vborder != old_dm_state->underscan_vborder)
+- return true;
++ } else if (dm_state->underscan_hborder != old_dm_state->underscan_hborder ||
++ dm_state->underscan_vborder != old_dm_state->underscan_vborder)
++ return true;
+ return false;
+ }
+
+@@ -3952,11 +3957,11 @@ static void amdgpu_dm_do_flip(
+ target_vblank = target - drm_crtc_vblank_count(crtc) +
+ amdgpu_get_vblank_counter_kms(crtc->dev, acrtc->crtc_id);
+
+- /*TODO This might fail and hence better not used, wait
++ /* TODO This might fail and hence better not used, wait
+ * explicitly on fences instead
+ * and in general should be called for
+ * blocking commit to as per framework helpers
+- * */
++ */
+ r = amdgpu_bo_reserve(abo, true);
+ if (unlikely(r != 0)) {
+ DRM_ERROR("failed to reserve buffer before flip\n");
+@@ -4055,7 +4060,7 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state,
+ DRM_ERROR("add_surface: acrtc %d, already busy\n",
+ acrtc_attach->crtc_id);
+ spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
+- /* In comit tail framework this cannot happen */
++ /* In commit tail framework this cannot happen */
+ WARN_ON(1);
+ }
+ spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
+@@ -4174,6 +4179,7 @@ void amdgpu_dm_atomic_commit_tail(
+ for_each_crtc_in_state(state, crtc, old_crtc_state, i) {
+ struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
+ struct drm_crtc_state *new_state = crtc->state;
++
+ new_acrtc_state = to_dm_crtc_state(new_state);
+ old_acrtc_state = to_dm_crtc_state(old_crtc_state);
+
+@@ -4199,20 +4205,20 @@ void amdgpu_dm_atomic_commit_tail(
+
+ if (!new_acrtc_state->stream) {
+ /*
+- * this could happen because of issues with
+- * userspace notifications delivery.
+- * In this case userspace tries to set mode on
+- * display which is disconnect in fact.
+- * dc_sink in NULL in this case on aconnector.
+- * We expect reset mode will come soon.
+- *
+- * This can also happen when unplug is done
+- * during resume sequence ended
+- *
+- * In this case, we want to pretend we still
+- * have a sink to keep the pipe running so that
+- * hw state is consistent with the sw state
+- */
++ * this could happen because of issues with
++ * userspace notifications delivery.
++ * In this case userspace tries to set mode on
++ * display which is disconnect in fact.
++ * dc_sink in NULL in this case on aconnector.
++ * We expect reset mode will come soon.
++ *
++ * This can also happen when unplug is done
++ * during resume sequence ended
++ *
++ * In this case, we want to pretend we still
++ * have a sink to keep the pipe running so that
++ * hw state is consistent with the sw state
++ */
+ DRM_DEBUG_KMS("%s: Failed to create new stream for crtc %d\n",
+ __func__, acrtc->base.base.id);
+ continue;
+@@ -4255,6 +4261,7 @@ void amdgpu_dm_atomic_commit_tail(
+ if (adev->dm.freesync_module) {
+ for (i = 0; i < new_crtcs_count; i++) {
+ struct amdgpu_connector *aconnector = NULL;
++
+ new_acrtc_state = to_dm_crtc_state(new_crtcs[i]->base.state);
+
+ new_stream = new_acrtc_state->stream;
+@@ -4264,10 +4271,9 @@ void amdgpu_dm_atomic_commit_tail(
+ &new_crtcs[i]->base,
+ false);
+ if (!aconnector) {
+- DRM_INFO(
+- "Atomic commit: Failed to find connector for acrtc id:%d "
+- "skipping freesync init\n",
+- new_crtcs[i]->crtc_id);
++ DRM_INFO("Atomic commit: Failed to find connector for acrtc id:%d "
++ "skipping freesync init\n",
++ new_crtcs[i]->crtc_id);
+ continue;
+ }
+
+@@ -4282,6 +4288,7 @@ void amdgpu_dm_atomic_commit_tail(
+
+ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+ struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
++
+ new_acrtc_state = to_dm_crtc_state(crtc->state);
+
+ if (new_acrtc_state->stream != NULL) {
+@@ -4339,6 +4346,7 @@ void amdgpu_dm_atomic_commit_tail(
+ * loop to enable interrupts on newly arrived crtc
+ */
+ struct amdgpu_crtc *acrtc = new_crtcs[i];
++
+ new_acrtc_state = to_dm_crtc_state(acrtc->base.state);
+
+ if (adev->dm.freesync_module)
+@@ -4533,9 +4541,8 @@ static uint32_t remove_from_val_sets(
+
+ set_count--;
+
+- for (; i < set_count; i++) {
++ for (; i < set_count; i++)
+ val_sets[i] = val_sets[i + 1];
+- }
+
+ return set_count;
+ }
+@@ -4582,7 +4589,7 @@ static int do_aquire_global_lock(
+
+ if (ret == 0)
+ DRM_ERROR("[CRTC:%d:%s] hw_done or flip_done "
+- "timed out\n", crtc->base.id, crtc->name);
++ "timed out\n", crtc->base.id, crtc->name);
+
+ drm_crtc_commit_put(commit);
+ }
+@@ -4641,6 +4648,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
+ for_each_crtc_in_state(state, crtc, crtc_state, i) {
+ struct amdgpu_crtc *acrtc = NULL;
+ struct amdgpu_connector *aconnector = NULL;
++
+ old_acrtc_state = to_dm_crtc_state(crtc->state);
+ new_acrtc_state = to_dm_crtc_state(crtc_state);
+ acrtc = to_amdgpu_crtc(crtc);
+@@ -4749,7 +4757,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
+ if (!acrtc || drm_atomic_crtc_needs_modeset(acrtc->base.state))
+ continue;
+
+- /* Skip any thing not scale or underscan chnages */
++ /* Skip any thing not scale or underscan changes */
+ if (!is_scaling_state_different(con_new_state, con_old_state))
+ continue;
+
+@@ -4882,6 +4890,7 @@ void amdgpu_dm_add_sink_to_freesync_module(
+
+ struct drm_device *dev = connector->dev;
+ struct amdgpu_device *adev = dev->dev_private;
++
+ edid_check_required = false;
+ if (!amdgpu_connector->dc_sink) {
+ DRM_ERROR("dc_sink NULL, could not add free_sync module.\n");
+--
+2.7.4
+