@@ -42,6 +42,16 @@ static const struct ast_astdp_mode_index_table_entry ast_astdp_mode_index_table[
42
42
{ 0 }
43
43
};
44
44
45
+ struct ast_astdp_connector_state {
46
+ struct drm_connector_state base ;
47
+ };
48
+
49
+ static struct ast_astdp_connector_state *
50
+ to_ast_astdp_connector_state (const struct drm_connector_state * state )
51
+ {
52
+ return container_of (state , struct ast_astdp_connector_state , base );
53
+ }
54
+
45
55
static int __ast_astdp_get_mode_index (unsigned int hdisplay , unsigned int vdisplay )
46
56
{
47
57
const struct ast_astdp_mode_index_table_entry * entry = ast_astdp_mode_index_table ;
@@ -442,18 +452,58 @@ static const struct drm_connector_helper_funcs ast_astdp_connector_helper_funcs
442
452
.detect_ctx = ast_astdp_connector_helper_detect_ctx ,
443
453
};
444
454
445
- /*
446
- * Output
447
- */
455
+ static void ast_astdp_connector_reset (struct drm_connector * connector )
456
+ {
457
+ struct ast_astdp_connector_state * astdp_state =
458
+ kzalloc (sizeof (* astdp_state ), GFP_KERNEL );
459
+
460
+ if (connector -> state )
461
+ connector -> funcs -> atomic_destroy_state (connector , connector -> state );
462
+
463
+ if (astdp_state )
464
+ __drm_atomic_helper_connector_reset (connector , & astdp_state -> base );
465
+ else
466
+ __drm_atomic_helper_connector_reset (connector , NULL );
467
+ }
468
+
469
+ static struct drm_connector_state *
470
+ ast_astdp_connector_atomic_duplicate_state (struct drm_connector * connector )
471
+ {
472
+ struct ast_astdp_connector_state * new_astdp_state ;
473
+ struct drm_device * dev = connector -> dev ;
474
+
475
+ if (drm_WARN_ON (dev , !connector -> state ))
476
+ return NULL ;
477
+
478
+ new_astdp_state = kmalloc (sizeof (* new_astdp_state ), GFP_KERNEL );
479
+ if (!new_astdp_state )
480
+ return NULL ;
481
+ __drm_atomic_helper_connector_duplicate_state (connector , & new_astdp_state -> base );
482
+
483
+ return & new_astdp_state -> base ;
484
+ }
485
+
486
+ static void ast_astdp_connector_atomic_destroy_state (struct drm_connector * connector ,
487
+ struct drm_connector_state * state )
488
+ {
489
+ struct ast_astdp_connector_state * astdp_state = to_ast_astdp_connector_state (state );
490
+
491
+ __drm_atomic_helper_connector_destroy_state (& astdp_state -> base );
492
+ kfree (astdp_state );
493
+ }
448
494
449
495
static const struct drm_connector_funcs ast_astdp_connector_funcs = {
450
- .reset = drm_atomic_helper_connector_reset ,
496
+ .reset = ast_astdp_connector_reset ,
451
497
.fill_modes = drm_helper_probe_single_connector_modes ,
452
498
.destroy = drm_connector_cleanup ,
453
- .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state ,
454
- .atomic_destroy_state = drm_atomic_helper_connector_destroy_state ,
499
+ .atomic_duplicate_state = ast_astdp_connector_atomic_duplicate_state ,
500
+ .atomic_destroy_state = ast_astdp_connector_atomic_destroy_state ,
455
501
};
456
502
503
+ /*
504
+ * Output
505
+ */
506
+
457
507
int ast_astdp_output_init (struct ast_device * ast )
458
508
{
459
509
struct drm_device * dev = & ast -> base ;
0 commit comments