]> Git Repo - linux.git/commitdiff
Merge branch 'drm/tegra/fixes' into drm/tegra/for-next
authorThierry Reding <[email protected]>
Tue, 30 Mar 2021 17:53:03 +0000 (19:53 +0200)
committerThierry Reding <[email protected]>
Tue, 30 Mar 2021 17:53:03 +0000 (19:53 +0200)
1  2 
drivers/gpu/drm/tegra/dc.c

index da6afe7f0c7dcbed588a9e945f1ffe228c8e0bc4,134986dc2783f77ad6ef295692d7f2a5bfed479d..c9385cfd0fc19da1bec61a9ad9b288808b04fe5f
@@@ -604,25 -604,23 +604,25 @@@ static const u64 tegra124_modifiers[] 
  };
  
  static int tegra_plane_atomic_check(struct drm_plane *plane,
 -                                  struct drm_plane_state *state)
 +                                  struct drm_atomic_state *state)
  {
 -      struct tegra_plane_state *plane_state = to_tegra_plane_state(state);
 +      struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
 +                                                                               plane);
 +      struct tegra_plane_state *plane_state = to_tegra_plane_state(new_plane_state);
        unsigned int supported_rotation = DRM_MODE_ROTATE_0 |
                                          DRM_MODE_REFLECT_X |
                                          DRM_MODE_REFLECT_Y;
 -      unsigned int rotation = state->rotation;
 +      unsigned int rotation = new_plane_state->rotation;
        struct tegra_bo_tiling *tiling = &plane_state->tiling;
        struct tegra_plane *tegra = to_tegra_plane(plane);
 -      struct tegra_dc *dc = to_tegra_dc(state->crtc);
 +      struct tegra_dc *dc = to_tegra_dc(new_plane_state->crtc);
        int err;
  
        /* no need for further checks if the plane is being disabled */
 -      if (!state->crtc)
 +      if (!new_plane_state->crtc)
                return 0;
  
 -      err = tegra_plane_format(state->fb->format->format,
 +      err = tegra_plane_format(new_plane_state->fb->format->format,
                                 &plane_state->format,
                                 &plane_state->swap);
        if (err < 0)
                        return err;
        }
  
 -      err = tegra_fb_get_tiling(state->fb, tiling);
 +      err = tegra_fb_get_tiling(new_plane_state->fb, tiling);
        if (err < 0)
                return err;
  
         * property in order to achieve the same result.  The legacy BO flag
         * duplicates the DRM rotation property when both are set.
         */
 -      if (tegra_fb_is_bottom_up(state->fb))
 +      if (tegra_fb_is_bottom_up(new_plane_state->fb))
                rotation |= DRM_MODE_REFLECT_Y;
  
        rotation = drm_rotation_simplify(rotation, supported_rotation);
         * error out if the user tries to display a framebuffer with such a
         * configuration.
         */
 -      if (state->fb->format->num_planes > 2) {
 -              if (state->fb->pitches[2] != state->fb->pitches[1]) {
 +      if (new_plane_state->fb->format->num_planes > 2) {
 +              if (new_plane_state->fb->pitches[2] != new_plane_state->fb->pitches[1]) {
                        DRM_ERROR("unsupported UV-plane configuration\n");
                        return -EINVAL;
                }
        }
  
 -      err = tegra_plane_state_add(tegra, state);
 +      err = tegra_plane_state_add(tegra, new_plane_state);
        if (err < 0)
                return err;
  
  }
  
  static void tegra_plane_atomic_disable(struct drm_plane *plane,
 -                                     struct drm_plane_state *old_state)
 +                                     struct drm_atomic_state *state)
  {
 +      struct drm_plane_state *old_state = drm_atomic_get_old_plane_state(state,
 +                                                                         plane);
        struct tegra_plane *p = to_tegra_plane(plane);
        u32 value;
  
  }
  
  static void tegra_plane_atomic_update(struct drm_plane *plane,
 -                                    struct drm_plane_state *old_state)
 +                                    struct drm_atomic_state *state)
  {
 -      struct tegra_plane_state *state = to_tegra_plane_state(plane->state);
 -      struct drm_framebuffer *fb = plane->state->fb;
 +      struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
 +                                                                         plane);
 +      struct tegra_plane_state *tegra_plane_state = to_tegra_plane_state(new_state);
 +      struct drm_framebuffer *fb = new_state->fb;
        struct tegra_plane *p = to_tegra_plane(plane);
        struct tegra_dc_window window;
        unsigned int i;
  
        /* rien ne va plus */
 -      if (!plane->state->crtc || !plane->state->fb)
 +      if (!new_state->crtc || !new_state->fb)
                return;
  
 -      if (!plane->state->visible)
 -              return tegra_plane_atomic_disable(plane, old_state);
 +      if (!new_state->visible)
 +              return tegra_plane_atomic_disable(plane, state);
  
        memset(&window, 0, sizeof(window));
 -      window.src.x = plane->state->src.x1 >> 16;
 -      window.src.y = plane->state->src.y1 >> 16;
 -      window.src.w = drm_rect_width(&plane->state->src) >> 16;
 -      window.src.h = drm_rect_height(&plane->state->src) >> 16;
 -      window.dst.x = plane->state->dst.x1;
 -      window.dst.y = plane->state->dst.y1;
 -      window.dst.w = drm_rect_width(&plane->state->dst);
 -      window.dst.h = drm_rect_height(&plane->state->dst);
 +      window.src.x = new_state->src.x1 >> 16;
 +      window.src.y = new_state->src.y1 >> 16;
 +      window.src.w = drm_rect_width(&new_state->src) >> 16;
 +      window.src.h = drm_rect_height(&new_state->src) >> 16;
 +      window.dst.x = new_state->dst.x1;
 +      window.dst.y = new_state->dst.y1;
 +      window.dst.w = drm_rect_width(&new_state->dst);
 +      window.dst.h = drm_rect_height(&new_state->dst);
        window.bits_per_pixel = fb->format->cpp[0] * 8;
 -      window.reflect_x = state->reflect_x;
 -      window.reflect_y = state->reflect_y;
 +      window.reflect_x = tegra_plane_state->reflect_x;
 +      window.reflect_y = tegra_plane_state->reflect_y;
  
        /* copy from state */
 -      window.zpos = plane->state->normalized_zpos;
 -      window.tiling = state->tiling;
 -      window.format = state->format;
 -      window.swap = state->swap;
 +      window.zpos = new_state->normalized_zpos;
 +      window.tiling = tegra_plane_state->tiling;
 +      window.format = tegra_plane_state->format;
 +      window.swap = tegra_plane_state->swap;
  
        for (i = 0; i < fb->format->num_planes; i++) {
 -              window.base[i] = state->iova[i] + fb->offsets[i];
 +              window.base[i] = tegra_plane_state->iova[i] + fb->offsets[i];
  
                /*
                 * Tegra uses a shared stride for UV planes. Framebuffers are
@@@ -837,31 -831,29 +837,31 @@@ static const u32 tegra_cursor_plane_for
  };
  
  static int tegra_cursor_atomic_check(struct drm_plane *plane,
 -                                   struct drm_plane_state *state)
 +                                   struct drm_atomic_state *state)
  {
 +      struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
 +                                                                               plane);
        struct tegra_plane *tegra = to_tegra_plane(plane);
        int err;
  
        /* no need for further checks if the plane is being disabled */
 -      if (!state->crtc)
 +      if (!new_plane_state->crtc)
                return 0;
  
        /* scaling not supported for cursor */
 -      if ((state->src_w >> 16 != state->crtc_w) ||
 -          (state->src_h >> 16 != state->crtc_h))
 +      if ((new_plane_state->src_w >> 16 != new_plane_state->crtc_w) ||
 +          (new_plane_state->src_h >> 16 != new_plane_state->crtc_h))
                return -EINVAL;
  
        /* only square cursors supported */
 -      if (state->src_w != state->src_h)
 +      if (new_plane_state->src_w != new_plane_state->src_h)
                return -EINVAL;
  
 -      if (state->crtc_w != 32 && state->crtc_w != 64 &&
 -          state->crtc_w != 128 && state->crtc_w != 256)
 +      if (new_plane_state->crtc_w != 32 && new_plane_state->crtc_w != 64 &&
 +          new_plane_state->crtc_w != 128 && new_plane_state->crtc_w != 256)
                return -EINVAL;
  
 -      err = tegra_plane_state_add(tegra, state);
 +      err = tegra_plane_state_add(tegra, new_plane_state);
        if (err < 0)
                return err;
  
  }
  
  static void tegra_cursor_atomic_update(struct drm_plane *plane,
 -                                     struct drm_plane_state *old_state)
 +                                     struct drm_atomic_state *state)
  {
 -      struct tegra_plane_state *state = to_tegra_plane_state(plane->state);
 -      struct tegra_dc *dc = to_tegra_dc(plane->state->crtc);
 +      struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
 +                                                                         plane);
 +      struct tegra_plane_state *tegra_plane_state = to_tegra_plane_state(new_state);
 +      struct tegra_dc *dc = to_tegra_dc(new_state->crtc);
        u32 value = CURSOR_CLIP_DISPLAY;
  
        /* rien ne va plus */
 -      if (!plane->state->crtc || !plane->state->fb)
 +      if (!new_state->crtc || !new_state->fb)
                return;
  
 -      switch (plane->state->crtc_w) {
 +      switch (new_state->crtc_w) {
        case 32:
                value |= CURSOR_SIZE_32x32;
                break;
  
        default:
                WARN(1, "cursor size %ux%u not supported\n",
 -                   plane->state->crtc_w, plane->state->crtc_h);
 +                   new_state->crtc_w, new_state->crtc_h);
                return;
        }
  
 -      value |= (state->iova[0] >> 10) & 0x3fffff;
 +      value |= (tegra_plane_state->iova[0] >> 10) & 0x3fffff;
        tegra_dc_writel(dc, value, DC_DISP_CURSOR_START_ADDR);
  
  #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
 -      value = (state->iova[0] >> 32) & 0x3;
 +      value = (tegra_plane_state->iova[0] >> 32) & 0x3;
        tegra_dc_writel(dc, value, DC_DISP_CURSOR_START_ADDR_HI);
  #endif
  
        tegra_dc_writel(dc, value, DC_DISP_BLEND_CURSOR_CONTROL);
  
        /* position the cursor */
 -      value = (plane->state->crtc_y & 0x3fff) << 16 |
 -              (plane->state->crtc_x & 0x3fff);
 +      value = (new_state->crtc_y & 0x3fff) << 16 |
 +              (new_state->crtc_x & 0x3fff);
        tegra_dc_writel(dc, value, DC_DISP_CURSOR_POSITION);
  }
  
  static void tegra_cursor_atomic_disable(struct drm_plane *plane,
 -                                      struct drm_plane_state *old_state)
 +                                      struct drm_atomic_state *state)
  {
 +      struct drm_plane_state *old_state = drm_atomic_get_old_plane_state(state,
 +                                                                         plane);
        struct tegra_dc *dc;
        u32 value;
  
@@@ -1700,6 -1688,11 +1700,11 @@@ static void tegra_dc_commit_state(struc
                        dev_err(dc->dev,
                                "failed to set clock rate to %lu Hz\n",
                                state->pclk);
+               err = clk_set_rate(dc->clk, state->pclk);
+               if (err < 0)
+                       dev_err(dc->dev, "failed to set clock %pC to %lu Hz: %d\n",
+                               dc->clk, state->pclk, err);
        }
  
        DRM_DEBUG_KMS("rate: %lu, div: %u\n", clk_get_rate(dc->clk),
                value = SHIFT_CLK_DIVIDER(state->div) | PIXEL_CLK_DIVIDER_PCD1;
                tegra_dc_writel(dc, value, DC_DISP_DISP_CLOCK_CONTROL);
        }
-       err = clk_set_rate(dc->clk, state->pclk);
-       if (err < 0)
-               dev_err(dc->dev, "failed to set clock %pC to %lu Hz: %d\n",
-                       dc->clk, state->pclk, err);
  }
  
  static void tegra_dc_stop(struct tegra_dc *dc)
@@@ -2513,22 -2501,18 +2513,18 @@@ static int tegra_dc_couple(struct tegra
         * POWER_CONTROL registers during CRTC enabling.
         */
        if (dc->soc->coupled_pm && dc->pipe == 1) {
-               u32 flags = DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE_CONSUMER;
-               struct device_link *link;
-               struct device *partner;
+               struct device *companion;
+               struct tegra_dc *parent;
  
-               partner = driver_find_device(dc->dev->driver, NULL, NULL,
-                                            tegra_dc_match_by_pipe);
-               if (!partner)
+               companion = driver_find_device(dc->dev->driver, NULL, (const void *)0,
+                                              tegra_dc_match_by_pipe);
+               if (!companion)
                        return -EPROBE_DEFER;
  
-               link = device_link_add(dc->dev, partner, flags);
-               if (!link) {
-                       dev_err(dc->dev, "failed to link controllers\n");
-                       return -EINVAL;
-               }
+               parent = dev_get_drvdata(companion);
+               dc->client.parent = &parent->client;
  
-               dev_dbg(dc->dev, "coupled to %s\n", dev_name(partner));
+               dev_dbg(dc->dev, "coupled to %s\n", dev_name(companion));
        }
  
        return 0;
This page took 0.082719 seconds and 4 git commands to generate.