1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com)
8 #include <drm/drm_bridge.h>
9 #include <drm/drm_crtc.h>
10 #include <drm/drm_encoder.h>
11 #include <drm/drm_device.h>
15 static struct drm_encoder_funcs arcpgu_drm_encoder_funcs
= {
16 .destroy
= drm_encoder_cleanup
,
19 int arcpgu_drm_hdmi_init(struct drm_device
*drm
, struct device_node
*np
)
21 struct drm_encoder
*encoder
;
22 struct drm_bridge
*bridge
;
26 encoder
= devm_kzalloc(drm
->dev
, sizeof(*encoder
), GFP_KERNEL
);
30 /* Locate drm bridge from the hdmi encoder DT node */
31 bridge
= of_drm_find_bridge(np
);
35 encoder
->possible_crtcs
= 1;
36 encoder
->possible_clones
= 0;
37 ret
= drm_encoder_init(drm
, encoder
, &arcpgu_drm_encoder_funcs
,
38 DRM_MODE_ENCODER_TMDS
, NULL
);
42 /* Link drm_bridge to encoder */
43 ret
= drm_bridge_attach(encoder
, bridge
, NULL
, 0);
45 drm_encoder_cleanup(encoder
);