@@ -432,7 +432,7 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
432
432
struct vc4_hdmi_encoder * vc4_encoder = to_vc4_hdmi_encoder (encoder );
433
433
struct drm_connector * connector = & vc4_hdmi -> connector ;
434
434
struct drm_connector_state * cstate = connector -> state ;
435
- struct drm_crtc * crtc = cstate -> crtc ;
435
+ struct drm_crtc * crtc = encoder -> crtc ;
436
436
const struct drm_display_mode * mode = & crtc -> state -> adjusted_mode ;
437
437
union hdmi_infoframe frame ;
438
438
int ret ;
@@ -537,11 +537,8 @@ static bool vc4_hdmi_supports_scrambling(struct drm_encoder *encoder,
537
537
538
538
static void vc4_hdmi_enable_scrambling (struct drm_encoder * encoder )
539
539
{
540
+ struct drm_display_mode * mode = & encoder -> crtc -> state -> adjusted_mode ;
540
541
struct vc4_hdmi * vc4_hdmi = encoder_to_vc4_hdmi (encoder );
541
- struct drm_connector * connector = & vc4_hdmi -> connector ;
542
- struct drm_connector_state * cstate = connector -> state ;
543
- struct drm_crtc * crtc = cstate -> crtc ;
544
- struct drm_display_mode * mode = & crtc -> state -> adjusted_mode ;
545
542
546
543
if (!vc4_hdmi_supports_scrambling (encoder , mode ))
547
544
return ;
@@ -562,18 +559,17 @@ static void vc4_hdmi_enable_scrambling(struct drm_encoder *encoder)
562
559
static void vc4_hdmi_disable_scrambling (struct drm_encoder * encoder )
563
560
{
564
561
struct vc4_hdmi * vc4_hdmi = encoder_to_vc4_hdmi (encoder );
565
- struct drm_connector * connector = & vc4_hdmi -> connector ;
566
- struct drm_connector_state * cstate = connector -> state ;
562
+ struct drm_crtc * crtc = encoder -> crtc ;
567
563
568
564
/*
569
- * At boot, connector->state will be NULL. Since we don't know the
565
+ * At boot, encoder->crtc will be NULL. Since we don't know the
570
566
* state of the scrambler and in order to avoid any
571
567
* inconsistency, let's disable it all the time.
572
568
*/
573
- if (cstate && !vc4_hdmi_supports_scrambling (encoder , & cstate -> crtc -> mode ))
569
+ if (crtc && !vc4_hdmi_supports_scrambling (encoder , & crtc -> mode ))
574
570
return ;
575
571
576
- if (cstate && !vc4_hdmi_mode_needs_scrambling (& cstate -> crtc -> mode ))
572
+ if (crtc && !vc4_hdmi_mode_needs_scrambling (& crtc -> mode ))
577
573
return ;
578
574
579
575
if (delayed_work_pending (& vc4_hdmi -> scrambling_work ))
@@ -895,9 +891,7 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder,
895
891
vc4_hdmi_encoder_get_connector_state (encoder , state );
896
892
struct vc4_hdmi_connector_state * vc4_conn_state =
897
893
conn_state_to_vc4_hdmi_conn_state (conn_state );
898
- struct drm_crtc_state * crtc_state =
899
- drm_atomic_get_new_crtc_state (state , conn_state -> crtc );
900
- struct drm_display_mode * mode = & crtc_state -> adjusted_mode ;
894
+ struct drm_display_mode * mode = & encoder -> crtc -> state -> adjusted_mode ;
901
895
struct vc4_hdmi * vc4_hdmi = encoder_to_vc4_hdmi (encoder );
902
896
unsigned long bvb_rate , pixel_rate , hsm_rate ;
903
897
int ret ;
@@ -991,11 +985,7 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder,
991
985
static void vc4_hdmi_encoder_pre_crtc_enable (struct drm_encoder * encoder ,
992
986
struct drm_atomic_state * state )
993
987
{
994
- struct drm_connector_state * conn_state =
995
- vc4_hdmi_encoder_get_connector_state (encoder , state );
996
- struct drm_crtc_state * crtc_state =
997
- drm_atomic_get_new_crtc_state (state , conn_state -> crtc );
998
- struct drm_display_mode * mode = & crtc_state -> adjusted_mode ;
988
+ struct drm_display_mode * mode = & encoder -> crtc -> state -> adjusted_mode ;
999
989
struct vc4_hdmi_encoder * vc4_encoder = to_vc4_hdmi_encoder (encoder );
1000
990
struct vc4_hdmi * vc4_hdmi = encoder_to_vc4_hdmi (encoder );
1001
991
@@ -1018,11 +1008,7 @@ static void vc4_hdmi_encoder_pre_crtc_enable(struct drm_encoder *encoder,
1018
1008
static void vc4_hdmi_encoder_post_crtc_enable (struct drm_encoder * encoder ,
1019
1009
struct drm_atomic_state * state )
1020
1010
{
1021
- struct drm_connector_state * conn_state =
1022
- vc4_hdmi_encoder_get_connector_state (encoder , state );
1023
- struct drm_crtc_state * crtc_state =
1024
- drm_atomic_get_new_crtc_state (state , conn_state -> crtc );
1025
- struct drm_display_mode * mode = & crtc_state -> adjusted_mode ;
1011
+ struct drm_display_mode * mode = & encoder -> crtc -> state -> adjusted_mode ;
1026
1012
struct vc4_hdmi * vc4_hdmi = encoder_to_vc4_hdmi (encoder );
1027
1013
struct vc4_hdmi_encoder * vc4_encoder = to_vc4_hdmi_encoder (encoder );
1028
1014
bool hsync_pos = mode -> flags & DRM_MODE_FLAG_PHSYNC ;
@@ -1210,8 +1196,8 @@ static void vc4_hdmi_audio_set_mai_clock(struct vc4_hdmi *vc4_hdmi,
1210
1196
1211
1197
static void vc4_hdmi_set_n_cts (struct vc4_hdmi * vc4_hdmi , unsigned int samplerate )
1212
1198
{
1213
- struct drm_connector * connector = & vc4_hdmi -> connector ;
1214
- struct drm_crtc * crtc = connector -> state -> crtc ;
1199
+ struct drm_encoder * encoder = & vc4_hdmi -> encoder . base . base ;
1200
+ struct drm_crtc * crtc = encoder -> crtc ;
1215
1201
const struct drm_display_mode * mode = & crtc -> state -> adjusted_mode ;
1216
1202
u32 n , cts ;
1217
1203
u64 tmp ;
@@ -1244,13 +1230,13 @@ static inline struct vc4_hdmi *dai_to_hdmi(struct snd_soc_dai *dai)
1244
1230
static int vc4_hdmi_audio_startup (struct device * dev , void * data )
1245
1231
{
1246
1232
struct vc4_hdmi * vc4_hdmi = dev_get_drvdata (dev );
1247
- struct drm_connector * connector = & vc4_hdmi -> connector ;
1233
+ struct drm_encoder * encoder = & vc4_hdmi -> encoder . base . base ;
1248
1234
1249
1235
/*
1250
1236
* If the HDMI encoder hasn't probed, or the encoder is
1251
1237
* currently in DVI mode, treat the codec dai as missing.
1252
1238
*/
1253
- if (!connector -> state || !(HDMI_READ (HDMI_RAM_PACKET_CONFIG ) &
1239
+ if (!encoder -> crtc || !(HDMI_READ (HDMI_RAM_PACKET_CONFIG ) &
1254
1240
VC4_HDMI_RAM_PACKET_ENABLE ))
1255
1241
return - ENODEV ;
1256
1242
0 commit comments