summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2025-02-08 00:31:56 +0200
committerVille Syrjälä <ville.syrjala@linux.intel.com>2025-02-12 19:22:06 +0200
commitcdef53897cda82bc3261bf23acb0e8205ec8b19a (patch)
tree7ca41df6dfa44b2add0a858f18a3bdeb50048524
parentc9178dfba53ffd055c35f0daea9c35de89b45219 (diff)
drm/i915/dsb: Introduce intel_dsb_poll()
Add a function for emitting a DSB poll instruction. We'll allow the caller to specify the poll parameters. v2: s/wait/wait_us/ (Ankit) Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250207223159.14132-6-ville.syrjala@linux.intel.com
-rw-r--r--drivers/gpu/drm/i915/display/intel_dsb.c19
-rw-r--r--drivers/gpu/drm/i915/display/intel_dsb.h3
2 files changed, 22 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c
index 01e3bd385cac..aba57ddfbb92 100644
--- a/drivers/gpu/drm/i915/display/intel_dsb.c
+++ b/drivers/gpu/drm/i915/display/intel_dsb.c
@@ -459,6 +459,25 @@ void intel_dsb_wait_scanline_out(struct intel_atomic_state *state,
start, end);
}
+void intel_dsb_poll(struct intel_dsb *dsb,
+ i915_reg_t reg, u32 mask, u32 val,
+ int wait_us, int count)
+{
+ struct intel_crtc *crtc = dsb->crtc;
+ enum pipe pipe = crtc->pipe;
+
+ intel_dsb_reg_write(dsb, DSB_POLLMASK(pipe, dsb->id), mask);
+ intel_dsb_reg_write(dsb, DSB_POLLFUNC(pipe, dsb->id),
+ DSB_POLL_ENABLE |
+ DSB_POLL_WAIT(wait_us) | DSB_POLL_COUNT(count));
+
+ intel_dsb_noop(dsb, 5);
+
+ intel_dsb_emit(dsb, val,
+ (DSB_OPCODE_POLL << DSB_OPCODE_SHIFT) |
+ i915_mmio_reg_offset(reg));
+}
+
static void intel_dsb_align_tail(struct intel_dsb *dsb)
{
u32 aligned_tail, tail;
diff --git a/drivers/gpu/drm/i915/display/intel_dsb.h b/drivers/gpu/drm/i915/display/intel_dsb.h
index da6df07a3c83..e843c52bf97c 100644
--- a/drivers/gpu/drm/i915/display/intel_dsb.h
+++ b/drivers/gpu/drm/i915/display/intel_dsb.h
@@ -54,6 +54,9 @@ void intel_dsb_wait_scanline_out(struct intel_atomic_state *state,
int lower, int upper);
void intel_dsb_vblank_evade(struct intel_atomic_state *state,
struct intel_dsb *dsb);
+void intel_dsb_poll(struct intel_dsb *dsb,
+ i915_reg_t reg, u32 mask, u32 val,
+ int wait_us, int count);
void intel_dsb_chain(struct intel_atomic_state *state,
struct intel_dsb *dsb,
struct intel_dsb *chained_dsb,