1 // SPDX-License-Identifier: MIT 2 /* 3 * Copyright © 2024 Intel Corporation 4 */ 5 6 #include <linux/workqueue.h> 7 8 #include "i915_drv.h" 9 10 #include "intel_display_types.h" 11 #include "intel_encoder.h" 12 13 static void intel_encoder_link_check_work_fn(struct work_struct *work) 14 { 15 struct intel_encoder *encoder = 16 container_of(work, typeof(*encoder), link_check_work.work); 17 18 encoder->link_check(encoder); 19 } 20 21 void intel_encoder_link_check_init(struct intel_encoder *encoder, 22 void (*callback)(struct intel_encoder *encoder)) 23 { 24 INIT_DELAYED_WORK(&encoder->link_check_work, intel_encoder_link_check_work_fn); 25 encoder->link_check = callback; 26 } 27 28 void intel_encoder_link_check_flush_work(struct intel_encoder *encoder) 29 { 30 cancel_delayed_work_sync(&encoder->link_check_work); 31 } 32 33 void intel_encoder_link_check_queue_work(struct intel_encoder *encoder, int delay_ms) 34 { 35 struct drm_i915_private *i915 = to_i915(encoder->base.dev); 36 37 mod_delayed_work(i915->unordered_wq, 38 &encoder->link_check_work, msecs_to_jiffies(delay_ms)); 39 } 40