Skip to content

Commit 68dcffe

Browse files
committed
drm: xlnx: zynqmp_dpsub: Move CRTC to zynqmp_dpsub structure
Decouple the zynqmp_disp, which handles the hardware configuration, from the DRM CRTC by moving the CRTC to the zynqmp_dpsub structure. The CRTC handling code will be moved to a separate file in a subsequent step. Signed-off-by: Laurent Pinchart <[email protected]>
1 parent c979296 commit 68dcffe

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

drivers/gpu/drm/xlnx/zynqmp_disp.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ struct zynqmp_disp_layer {
162162
* @dev: Device structure
163163
* @drm: DRM core
164164
* @dpsub: Display subsystem
165-
* @crtc: DRM CRTC
166165
* @blend.base: Register I/O base address for the blender
167166
* @avbuf.base: Register I/O base address for the audio/video buffer manager
168167
* @audio.base: Registers I/O base address for the audio mixer
@@ -173,8 +172,6 @@ struct zynqmp_disp {
173172
struct drm_device *drm;
174173
struct zynqmp_dpsub *dpsub;
175174

176-
struct drm_crtc crtc;
177-
178175
struct {
179176
void __iomem *base;
180177
} blend;
@@ -901,7 +898,7 @@ static void zynqmp_disp_audio_disable(struct zynqmp_disp *disp)
901898
*/
902899
void zynqmp_disp_handle_vblank(struct zynqmp_disp *disp)
903900
{
904-
struct drm_crtc *crtc = &disp->crtc;
901+
struct drm_crtc *crtc = &disp->dpsub->crtc;
905902

906903
drm_crtc_handle_vblank(crtc);
907904
}
@@ -914,7 +911,7 @@ void zynqmp_disp_handle_vblank(struct zynqmp_disp *disp)
914911
*/
915912
uint32_t zynqmp_disp_get_crtc_mask(struct zynqmp_disp *disp)
916913
{
917-
return drm_crtc_mask(&disp->crtc);
914+
return drm_crtc_mask(&disp->dpsub->crtc);
918915
}
919916

920917
/* -----------------------------------------------------------------------------
@@ -1409,7 +1406,7 @@ static int zynqmp_disp_setup_clock(struct zynqmp_disp *disp,
14091406

14101407
static inline struct zynqmp_disp *crtc_to_disp(struct drm_crtc *crtc)
14111408
{
1412-
return container_of(crtc, struct zynqmp_disp, crtc);
1409+
return container_of(crtc, struct zynqmp_dpsub, crtc)->disp;
14131410
}
14141411

14151412
static void
@@ -1457,7 +1454,7 @@ zynqmp_disp_crtc_atomic_disable(struct drm_crtc *crtc,
14571454

14581455
zynqmp_disp_disable(disp);
14591456

1460-
drm_crtc_vblank_off(&disp->crtc);
1457+
drm_crtc_vblank_off(crtc);
14611458

14621459
spin_lock_irq(&crtc->dev->event_lock);
14631460
if (crtc->state->event) {
@@ -1542,24 +1539,25 @@ static const struct drm_crtc_funcs zynqmp_disp_crtc_funcs = {
15421539
static int zynqmp_disp_create_crtc(struct zynqmp_disp *disp)
15431540
{
15441541
struct drm_plane *plane = &disp->layers[ZYNQMP_DISP_LAYER_GFX].plane;
1542+
struct drm_crtc *crtc = &disp->dpsub->crtc;
15451543
int ret;
15461544

1547-
ret = drm_crtc_init_with_planes(disp->drm, &disp->crtc, plane,
1545+
ret = drm_crtc_init_with_planes(disp->drm, crtc, plane,
15481546
NULL, &zynqmp_disp_crtc_funcs, NULL);
15491547
if (ret < 0)
15501548
return ret;
15511549

1552-
drm_crtc_helper_add(&disp->crtc, &zynqmp_disp_crtc_helper_funcs);
1550+
drm_crtc_helper_add(crtc, &zynqmp_disp_crtc_helper_funcs);
15531551

15541552
/* Start with vertical blanking interrupt reporting disabled. */
1555-
drm_crtc_vblank_off(&disp->crtc);
1553+
drm_crtc_vblank_off(crtc);
15561554

15571555
return 0;
15581556
}
15591557

15601558
static void zynqmp_disp_map_crtc_to_plane(struct zynqmp_disp *disp)
15611559
{
1562-
u32 possible_crtcs = drm_crtc_mask(&disp->crtc);
1560+
u32 possible_crtcs = drm_crtc_mask(&disp->dpsub->crtc);
15631561
unsigned int i;
15641562

15651563
for (i = 0; i < ARRAY_SIZE(disp->layers); i++)

drivers/gpu/drm/xlnx/zynqmp_dpsub.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#ifndef _ZYNQMP_DPSUB_H_
1313
#define _ZYNQMP_DPSUB_H_
1414

15+
#include <drm/drm_crtc.h>
1516
#include <drm/drm_encoder.h>
1617

1718
struct clk;
@@ -37,6 +38,7 @@ enum zynqmp_dpsub_format {
3738
* @vid_clk_from_ps: True of the video clock comes from PS, false from PL
3839
* @aud_clk: Audio clock
3940
* @aud_clk_from_ps: True of the audio clock comes from PS, false from PL
41+
* @crtc: The DRM CRTC
4042
* @encoder: The dummy DRM encoder
4143
* @bridge: The DP encoder bridge
4244
* @disp: The display controller
@@ -53,6 +55,7 @@ struct zynqmp_dpsub {
5355
struct clk *aud_clk;
5456
bool aud_clk_from_ps;
5557

58+
struct drm_crtc crtc;
5659
struct drm_encoder encoder;
5760
struct drm_bridge *bridge;
5861

0 commit comments

Comments
 (0)