History

Merge tag 'exynos-drm-next-for-v5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-next

Two cleanups - These patches make Exynos DRM driver to use pm_runtime_resume_and_get() function instead of m_runtime_get_sync() to deal with usage counter. pm_runtime_get_sync() increases the usage counter even when it failed, which could make callers to forget to decrease the usage counter. pm_runtime_resume_and_get() decreases the usage counter regardless of whether it failed or not. Signed-off-by: Dave Airlie <airlied@redhat.com>

Dave Airlie committed 5 years ago

Commit 1bd8a7d2 parents 2a7005c 445d3be12 files · +86 −22Browse files

Unified · Split

12 files
  1. drivers/gpu/drm/exynos/exynos5433_drm_decon.c +6 −1
  2. drivers/gpu/drm/exynos/exynos7_drm_decon.c +6 −1
  3. drivers/gpu/drm/exynos/exynos_drm_dsi.c +6 −1
  4. drivers/gpu/drm/exynos/exynos_drm_fimc.c +7 −1
  5. drivers/gpu/drm/exynos/exynos_drm_fimd.c +20 −5
  6. drivers/gpu/drm/exynos/exynos_drm_g2d.c +8 −1
  7. drivers/gpu/drm/exynos/exynos_drm_gsc.c +6 −1
  8. drivers/gpu/drm/exynos/exynos_drm_mic.c +2 −4
  9. drivers/gpu/drm/exynos/exynos_drm_rotator.c +6 −1
  10. drivers/gpu/drm/exynos/exynos_drm_scaler.c +6 −4
  11. drivers/gpu/drm/exynos/exynos_hdmi.c +7 −1
  12. drivers/gpu/drm/exynos/exynos_mixer.c +6 −1
drivers/gpu/drm/exynos/exynos5433_drm_decon.c+6−1
@@ -513,8 +513,13 @@ static void decon_swreset(struct decon_context *ctx) · 512 unmodified lines
513513 static void decon_atomic_enable(struct exynos_drm_crtc *crtc)
514514 {
515515 struct decon_context *ctx = crtc->ctx;
516+ int ret;
516517
517− pm_runtime_get_sync(ctx->dev);
518+ ret = pm_runtime_resume_and_get(ctx->dev);
519+ if (ret < 0) {
520+ DRM_DEV_ERROR(ctx->dev, "failed to enable DECON device.\n");
521+ return;
522+ }
518523
519524 exynos_drm_pipe_clk_enable(crtc, true);
520525
drivers/gpu/drm/exynos/exynos7_drm_decon.c+6−1
@@ -531,11 +531,16 @@ static void decon_init(struct decon_context *ctx) · 530 unmodified lines
531531 static void decon_atomic_enable(struct exynos_drm_crtc *crtc)
532532 {
533533 struct decon_context *ctx = crtc->ctx;
534+ int ret;
534535
535536 if (!ctx->suspended)
536537 return;
537538
538− pm_runtime_get_sync(ctx->dev);
539+ ret = pm_runtime_resume_and_get(ctx->dev);
540+ if (ret < 0) {
541+ DRM_DEV_ERROR(ctx->dev, "failed to enable DECON device.\n");
542+ return;
543+ }
539544
540545 decon_init(ctx);
541546
drivers/gpu/drm/exynos/exynos_drm_dsi.c+6−1
@@ -1383,7 +1383,12 @@ static void exynos_dsi_enable(struct drm_encoder *encoder) · 1382 unmodified lines
13831383 if (dsi->state & DSIM_STATE_ENABLED)
13841384 return;
13851385
1386− pm_runtime_get_sync(dsi->dev);
1386+ ret = pm_runtime_resume_and_get(dsi->dev);
1387+ if (ret < 0) {
1388+ dev_err(dsi->dev, "failed to enable DSI device.\n");
1389+ return;
1390+ }
1391+
13871392 dsi->state |= DSIM_STATE_ENABLED;
13881393
13891394 if (dsi->panel) {
drivers/gpu/drm/exynos/exynos_drm_fimc.c+7−1
@@ -1085,8 +1085,14 @@ static int fimc_commit(struct exynos_drm_ipp *ipp, · 1084 unmodified lines
10851085 {
10861086 struct fimc_context *ctx =
10871087 container_of(ipp, struct fimc_context, ipp);
1088+ int ret;
1089+
1090+ ret = pm_runtime_resume_and_get(ctx->dev);
1091+ if (ret < 0) {
1092+ dev_err(ctx->dev, "failed to enable FIMC device.\n");
1093+ return ret;
1094+ }
10881095
1089− pm_runtime_get_sync(ctx->dev);
10901096 ctx->task = task;
10911097
10921098 fimc_src_set_fmt(ctx, task->src.buf.fourcc, task->src.buf.modifier);
drivers/gpu/drm/exynos/exynos_drm_fimd.c+20−5
@@ -343,13 +343,18 @@ static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, · 342 unmodified lines
343343 writel(val, ctx->regs + SHADOWCON);
344344 }
345345
346−static void fimd_clear_channels(struct exynos_drm_crtc *crtc)
346+static int fimd_clear_channels(struct exynos_drm_crtc *crtc)
347347 {
348348 struct fimd_context *ctx = crtc->ctx;
349349 unsigned int win, ch_enabled = 0;
350+ int ret;
350351
351352 /* Hardware is in unknown state, so ensure it gets enabled properly */
352− pm_runtime_get_sync(ctx->dev);
353+ ret = pm_runtime_resume_and_get(ctx->dev);
354+ if (ret < 0) {
355+ dev_err(ctx->dev, "failed to enable FIMD device.\n");
356+ return ret;
357+ }
353358
354359 clk_prepare_enable(ctx->bus_clk);
355360 clk_prepare_enable(ctx->lcd_clk);
@@ -384,6 +389,8 @@ static void fimd_clear_channels(struct exynos_drm_crtc *crtc) · 28 unmodified lines
384389 clk_disable_unprepare(ctx->bus_clk);
385390
386391 pm_runtime_put(ctx->dev);
392+
393+ return 0;
387394 }
388395
389396
@@ -905,7 +912,10 @@ static void fimd_atomic_enable(struct exynos_drm_crtc *crtc) · 515 unmodified lines
905912
906913 ctx->suspended = false;
907914
908− pm_runtime_get_sync(ctx->dev);
915+ if (pm_runtime_resume_and_get(ctx->dev) < 0) {
916+ dev_warn(ctx->dev, "failed to enable FIMD device.\n");
917+ return;
918+ }
909919
910920 /* if vblank was enabled status, enable it again. */
911921 if (test_and_clear_bit(0, &ctx->irq_flags))
@@ -1089,8 +1099,13 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) · 177 unmodified lines
10891099 if (ctx->encoder)
10901100 exynos_dpi_bind(drm_dev, ctx->encoder);
10911101
1092− if (is_drm_iommu_supported(drm_dev))
1093− fimd_clear_channels(ctx->crtc);
1102+ if (is_drm_iommu_supported(drm_dev)) {
1103+ int ret;
1104+
1105+ ret = fimd_clear_channels(ctx->crtc);
1106+ if (ret < 0)
1107+ return ret;
1108+ }
10941109
10951110 return exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv);
10961111 }
drivers/gpu/drm/exynos/exynos_drm_g2d.c+8−1
@@ -892,7 +892,14 @@ static void g2d_runqueue_worker(struct work_struct *work) · 891 unmodified lines
892892 g2d->runqueue_node = g2d_get_runqueue_node(g2d);
893893
894894 if (g2d->runqueue_node) {
895− pm_runtime_get_sync(g2d->dev);
895+ int ret;
896+
897+ ret = pm_runtime_resume_and_get(g2d->dev);
898+ if (ret < 0) {
899+ dev_err(g2d->dev, "failed to enable G2D device.\n");
900+ return;
901+ }
902+
896903 g2d_dma_start(g2d, g2d->runqueue_node);
897904 }
898905 }
drivers/gpu/drm/exynos/exynos_drm_gsc.c+6−1
@@ -1118,7 +1118,12 @@ static int gsc_commit(struct exynos_drm_ipp *ipp, · 1117 unmodified lines
11181118 struct gsc_context *ctx = container_of(ipp, struct gsc_context, ipp);
11191119 int ret;
11201120
1121− pm_runtime_get_sync(ctx->dev);
1121+ ret = pm_runtime_resume_and_get(ctx->dev);
1122+ if (ret < 0) {
1123+ dev_err(ctx->dev, "failed to enable GScaler device.\n");
1124+ return ret;
1125+ }
1126+
11221127 ctx->task = task;
11231128
11241129 ret = gsc_reset(ctx);
drivers/gpu/drm/exynos/exynos_drm_mic.c+2−4
@@ -268,11 +268,9 @@ static void mic_pre_enable(struct drm_bridge *bridge) · 267 unmodified lines
268268 if (mic->enabled)
269269 goto unlock;
270270
271− ret = pm_runtime_get_sync(mic->dev);
272− if (ret < 0) {
273− pm_runtime_put_noidle(mic->dev);
271+ ret = pm_runtime_resume_and_get(mic->dev);
272+ if (ret < 0)
274273 goto unlock;
275− }
276274
277275 mic_set_path(mic, 1);
278276
drivers/gpu/drm/exynos/exynos_drm_rotator.c+6−1
@@ -219,8 +219,13 @@ static int rotator_commit(struct exynos_drm_ipp *ipp, · 218 unmodified lines
219219 {
220220 struct rot_context *rot =
221221 container_of(ipp, struct rot_context, ipp);
222+ int ret;
222223
223− pm_runtime_get_sync(rot->dev);
224+ ret = pm_runtime_resume_and_get(rot->dev);
225+ if (ret < 0) {
226+ dev_err(rot->dev, "failed to enable ROTATOR device.\n");
227+ return ret;
228+ }
224229 rot->task = task;
225230
226231 rotator_src_set_fmt(rot, task->src.buf.fourcc);
drivers/gpu/drm/exynos/exynos_drm_scaler.c+6−4
@@ -362,15 +362,17 @@ static int scaler_commit(struct exynos_drm_ipp *ipp, · 361 unmodified lines
362362 struct drm_exynos_ipp_task_rect *src_pos = &task->src.rect;
363363 struct drm_exynos_ipp_task_rect *dst_pos = &task->dst.rect;
364364 const struct scaler_format *src_fmt, *dst_fmt;
365+ int ret = 0;
365366
366367 src_fmt = scaler_get_format(task->src.buf.fourcc);
367368 dst_fmt = scaler_get_format(task->dst.buf.fourcc);
368369
369− pm_runtime_get_sync(scaler->dev);
370− if (scaler_reset(scaler)) {
371− pm_runtime_put(scaler->dev);
370+ ret = pm_runtime_resume_and_get(scaler->dev);
371+ if (ret < 0)
372+ return ret;
373+
374+ if (scaler_reset(scaler))
372375 return -EIO;
373− }
374376
375377 scaler->task = task;
376378
drivers/gpu/drm/exynos/exynos_hdmi.c+7−1
@@ -1483,10 +1483,16 @@ static void hdmi_set_refclk(struct hdmi_context *hdata, bool on) · 1482 unmodified lines
14831483 /* Should be called with hdata->mutex mutex held. */
14841484 static void hdmiphy_enable(struct hdmi_context *hdata)
14851485 {
1486+ int ret;
1487+
14861488 if (hdata->powered)
14871489 return;
14881490
1489− pm_runtime_get_sync(hdata->dev);
1491+ ret = pm_runtime_resume_and_get(hdata->dev);
1492+ if (ret < 0) {
1493+ dev_err(hdata->dev, "failed to enable HDMIPHY device.\n");
1494+ return;
1495+ }
14901496
14911497 if (regulator_bulk_enable(ARRAY_SIZE(supply), hdata->regul_bulk))
14921498 DRM_DEV_DEBUG_KMS(hdata->dev,
drivers/gpu/drm/exynos/exynos_mixer.c+6−1
@@ -992,11 +992,16 @@ static void mixer_atomic_flush(struct exynos_drm_crtc *crtc) · 991 unmodified lines
992992 static void mixer_atomic_enable(struct exynos_drm_crtc *crtc)
993993 {
994994 struct mixer_context *ctx = crtc->ctx;
995+ int ret;
995996
996997 if (test_bit(MXR_BIT_POWERED, &ctx->flags))
997998 return;
998999
999− pm_runtime_get_sync(ctx->dev);
1000+ ret = pm_runtime_resume_and_get(ctx->dev);
1001+ if (ret < 0) {
1002+ dev_err(ctx->dev, "failed to enable MIXER device.\n");
1003+ return;
1004+ }
10001005
10011006 exynos_drm_pipe_clk_enable(crtc, true);
10021007

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t